Hi Folks, Michael Kay says (paraphrasing):
It is unwise to define a syntax without I hereby take this as best practice:
Every syntax must have an underlying data model. That is an incredibly important statement, with huge ramifications. Let’s first begin with the obvious question: What is a data model? [Definition] Quintessential: representing the most perfect or typical example of a quality or class. Arguably, the XQuery and XPath Data Model (XDM) is the quintessential data model. Let’s see how it specifies its data model.
The XDM specification creates and defines terms, specifies how one should view the data, and specifies operations on the data and the results of those operations. Phew! What does all that mean? I think it will become clearer
with an example. Example: The XDM specification introduces and defines a term “sequence.” This term is unique to the data model – there is no such concept in XML. In the XDM view of the world, an element consists of a sequence of items. Here
are some of the operations that can be performed on a sequence: select the first item of a sequence, select the last item of a sequence, select the nth item of a sequence, and so forth.
Let’s recap: the XDM specifies a way to view the data (as a sequence of items), it defines terms, and it specifies operations on values. That’s what a data model is. Here are two relevant quotes from the XDM specification: The XQuery 1.0 and XPath 2.0 Data Model
The XQuery 1.0 and XPath 2.0 Data Model specifies The next question to be addressed is this:
When should a data model be created? Answer: before you define the syntax. XML did it wrong. Ditto for Namespaces. They created a data model (the Infoset)
after they had already defined the syntax. Bad, bad, bad. Michael Kay gave a fascinating and illuminating
description of how XML and the Infoset were created in the wrong order: The Infoset spec refers to the XML spec,
Yes, the Infoset can be taken as the data model
Wow! That is mind-blowing. [Why did this happen?] Lessons Learned: 1. Create a data model that underlies your syntax. At the outset I stated that there are huge ramifications. Now it’s time to see one of them:
An XML Schema defines a new syntax so Any additions, changes, comments? /Roger |