W3C home > Mailing lists > Public > w3c-rdfcore-wg@w3.org > August 2002

XML Schema is untidy (was RE: type test case)

From: <Patrick.Stickler@nokia.com>
Date: Thu, 8 Aug 2002 10:07:23 +0300
Message-ID: <A03E60B17132A84F9B4BB5EEDE57957B5FBA77@trebe006.NOE.Nokia.com>
To: <melnik@db.stanford.edu>
Cc: <jos.deroo.jd@belgium.agfa.com>, <Graham.Klyne@MIMEsweeper.com>, <jjc@hplb.hpl.hp.com>, <w3c-rdfcore-wg@w3.org>


> > So, even if the "range" of xsi:type is a QName, that QName is
> > expected to denote an XML Schema type.
> > 
> > No?
> 
> This is not my reading. The first sentence of the paragraph 
> refers to a 
> usual case when the type is determined by the type associated 
> with the 
> XML element in the schema (i.e., no xsi:type is used). However, when 
> xsi:type is there, its value is a QName, nothing said about 
> it referring 
> to an XSD type definition or anything else.
> 
> Correct me if I'm wrong...

I thought I did ;-)

The text in question from the XML Schema spec is

   "The Simple Type Definition (§2.2.1.2) or Complex Type Definition (§2.2.1.3) used in ·validation· of an element is usually determined by reference to the appropriate schema components. An element information item in an instance may, however, explicitly assert its type using the attribute xsi:type. The value of this attribute is a ·QName·; see QName Interpretation (§3.15.3) for the means by which the ·QName· is associated with a type definition."

I.e., the type is *usually* specified in the schema, but can be specified
for each instance.

This is exactly the same relation as what should exist in RDF for local
versus global datatyping. I.e. one can assert a range for a property in
a schema to specify the type of the value denoted by the literal, or
one can assert the type locally for each instance of a literal.

Thus, the following two are very similar:

   <xsd:element name="USPrice" type="xsd:decimal"/>
   <USPrice>10.50</USPrice>
vs
   <USPrice xsi:type="xsd:decimal">10.50</USPrice>

or

   WidgetX USPrice "10.05" .
   USPrice rdfs:range xsd:decimal .
vs
   WidgetX USPrice [ xsd:decimal "10.05" ] .

In both cases, the element/property value denotes an actual
datatype value, but the datatype which is paired with the
lexical representation is either globally asserted by
schema, or locally asserted with the instance.

In other words, XML Schema employs *untidy* semantics for
lexical representations!

Patrick

   
Received on Thursday, 8 August 2002 03:07:29 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 3 September 2003 09:50:24 EDT