- From: Jeremy Carroll <jjc@hplb.hpl.hp.com>
- Date: Wed, 29 Sep 2004 15:14:57 +0100
- To: SWBPD <public-swbp-wg@w3.org>
Summary: [There is an answer: Two XML Schema Datatype values $a and $b are the same if the XPath2 expression "$a eq $b" evaluates to true. ] READING ======= The XML Schema WG suggested looking at: http://www.w3.org/TR/2004/WD-xpath-functions-20040723/ The relevant bits are: http://www.w3.org/TR/2004/WD-xpath-functions-20040723/#func-numeric-equal 6.3.1 op:numeric-equal http://www.w3.org/TR/2004/WD-xpath-functions-20040723/#func-anyURI-equal 8.2 op:anyURI-equal http://www.w3.org/TR/2004/WD-xpath-functions-20040723/#func-boolean-equal 9.2.1 op:boolean-equal etc. and http://www.w3.org/TR/2004/WD-xpath-functions-20040723/#casting 17 Casting particularly the table at the end of 17.1 To get a satisfactory answer we also need to look at xpath 2 http://www.w3.org/TR/2004/WD-xpath20-20040723/ particularly http://www.w3.org/TR/2004/WD-xpath20-20040723/#id-value-comparisons 3.5.1 Value Comparisons and http://www.w3.org/TR/2004/WD-xpath20-20040723/#mapping B.2 Operator Mapping, particularly this bit: A eq B numeric numeric op:numeric-equal(A, B) xs:boolean A eq B xs:boolean xs:boolean op:boolean-equal(A, B) xs:boolean A eq B xs:string xs:string op:numeric-equal(fn:compare(A, B), 1) xs:boolean A eq B xs:date xs:date op:date-equal(A, B) xs:boolean A eq B xs:time xs:time op:time-equal(A, B) xs:boolean A eq B xs:dateTime xs:dateTime op:datetime-equal(A, B) xs:boolean A eq B xdt:yearMonthDuration xdt:yearMonthDuration op:yearMonthDuration-equal(A, B) xs:boolean A eq B xdt:dayTimeDuration xdt:dayTimeDuration op:dayTimeDuration-equal(A, B) xs:boolean A eq B Gregorian Gregorian op:gYear-equal(A, B) etc. xs:boolean A eq B xs:hexBinary xs:hexBinary op:hex-binary-equal(A, B) xs:boolean A eq B xs:base64Binary xs:base64Binary op:base64-binary-equal(A, B) xs:boolean A eq B xs:anyURI xs:anyURI op:anyURI-equal(A, B) xs:boolean A eq B xs:QName xs:QName op:QName-equal(A, B) xs:boolean A eq B xs:NOTATION xs:NOTATION op:NOTATION-equal(A, B) xs:boolean ANALYSIS ======== The claim of the XML Schema WG is that the XQuery/XSLT stuff depends on a denotational semantics, as opposed to the operational semantics of XML Schema, and hence should be more appropriate for Semantic Web purposes. This claim is only partially true. A particular problem with F&O is that equality is not defined in this document, only a number of different equalities. The general purpose framework for equality is giving under casting (section 17), which is inherently an operational matter. The casting section starts off with the grand sounding, but unfortunately false claim: [[ cast expressions [...] convert a source value, SV, of a source type, ST, to a target value, TV, of the given target type, TT, with identical semantics and different syntax. ]] This is false because the casting rules permit "00"^^xsd:string to be cast to "0"^^xsd:integer and "0"^^xsd:string to be cast to "0"^^xsd:integer and hence we may conclude that "00"^^xsd:string has the same semantics as "0"^^xsd:integer and "0"^^xsd:string has the same semantics as "0"^^xsd:integer but "00"^^xsd:string does not have the same semantics as "0"^^xsd:string However, F&O is intended to be used with xpath2.0 (e.g. F&O defines logical not, but the logical and and logical or are defined in xpath2.0). If we look there, we see that the operator "eq" is what is used for value comparison, and apart from not "NaN"^^xsd:float eq "NaN^^xsd:float and possible rounding issues, and implementation dependencies to do with float/double conversion to decimal etc. eq behaves as an equivalence relation. Thus, I conclude, that: F&O does not contain a denotational semantics for XML Schema datatypes but modulo a few worries about floats and doubles XPath & F&O together have an implicit denotational semantics In particular we get "0"^^xsd:float = "0"^^xsd:int but that "0"^^xsd:string is different. We also get value space of xsd:anyURI does not interesect value space of xsd:string Thus, I float a straw man, that on the issue facing the TF of when do two XML Schema datatypes have equal values, and forming an OWL description of these relationships, we could, and probably should, give a more declarative and denotational account of work already done by XSLT/XQuery WGs, without changing any of the basic results. Note: I guess I need to read the formal semantics document for XQuery/XSLT ... Jeremy
Received on Wednesday, 29 September 2004 14:15:23 UTC