For this final tutorial we will once again return to the same domain. Previously we have used a relational model, for which we have identified the following relations:
Now we will switch to a semi-structured data model.
Your first task is to come up with a schema for a semi-structured model of the same domain, in other words to create a DTD for the domain. Note that there are several ways of creating a DTD that would make perfect sense for this domain.
Once you have your second schema, construct a small sample XML document that conforms to it.
Note that XML is a fairly verbose language, and this task could take quite some time if you don't restrict yourself. The point is to practise the relationship between XML and DTDs, not to practise your skill at writing < and > symbols…
Use the second schema you constructed. For each of the following, write an XPath expression that:
Use the second schema you constructed. For each of the following, write an XQuery expression that:
You can assume that the standard aggregation functions exist, and that they work over lists of values. You may return in any format you think is suited, that retains all relevant data.
Files containing both the DTDs and XML data are available on-line:
These XML files have been validated using the W3C validation service.