[Home] [By Thread] [By Date] [Recent Entries]
On 16 September 2016 at 11:41, Costello, Roger L. <costello@m...> wrote: > Hi Folks, > > The meaning of the word “semantics” is fuzzy in the realm of data > interoperability. But in XPath the meaning of “semantics” and “syntax” is > clear: > > Semantics: the value returned from evaluating the XPath expression. The use of "semantics" in the xpath 2 spec is mostly in reference to the formal semantics as specified at https://www.w3.org/TR/xquery-semantics which is hard to reconcile with that description. > > Syntax: the form of the XPath expression. > > Example: Let’s illustrate the use of these terms with an XPath expression > for querying this XML document: > > <Book> > <Title>Parsing Techniques</Title> > <Author>Dick Grune</Author> > <Author>Ceriel Jacobs</Author> > <Publisher>Springer</Publisher> > </Book> > > > > Here is the XPath expression: > > > > /Book/Author > > > > The semantics of that XPath expression are the values returned when > evaluating the XPath expression on the XML document. These are the values > returned: > > > <Author>Dick Grune</Author> > <Author>Ceriel Jacobs</Author> > > > > That’s the semantics of the XPath expression. No, that is the _value_ of the expression when evaluated on that particular input, but you should be able to give the semantics of the Xpath expression without reference to any particular input. > > > > Here is an XPath expression with identical semantics, but different syntax: > > > > /Book/*[self::Author] > > > > Why does the XPath language allow expressions with different syntax and > identical semantics? Because checking that two expressions in a non trivial language always give the same result is more or less the "word problem" which is either hard or unsolvable depending on the exact context. So in practice it's not possible to specify a language that does not allow this. > > > > The rationale, in this example, is that it allows a syntactic distinction to > be made between dereferencing a field in a composite object (with the slash > operator) and performing an indexed lookup (with the predicate), even though > there is no semantic distinction between the two. > > > > Comments? > > > > /Roger David
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |

Cart



