W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > February 2005

Re: XML result format and datatypes

From: Damian Steer <damian.steer@hp.com>
Date: Fri, 18 Feb 2005 12:26:02 +0000
Message-Id: <c14d2ecc813917c45a672cb8f15b43d4@hp.com>
To: public-rdf-dawg-comments@w3.org

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(I'm don't think this is an essential feature, but I felt it was worth 
mentioning)

The results binding format doesn't type datatyped literals in a way xml 
schema-aware tools can use.

Use case: sorting results.

Example (abbreviated):

<results>
   <result>
     <number datatype="http://www.w3.org/2001/XMLSchema#int">02</number>
     <value>second</value>
   </result>
   <result>
     <number datatype="http://www.w3.org/2001/XMLSchema#int">1</number>
     <value>first</value>
   </result>
</results>

Stylesheet (abbreviated again):

<xsl:template match="results">
   <xsl:for-each select="result">
     <xsl:sort select="number"/>
     <xsl:value-of select="value"/>
   </xsl:for-each>
</xsl:template>

Value 'second' comes before 'first'.

Using xsi:type="xsd:int" in the result format would enable schema aware 
tools (such as Saxon-SA) to perform more useful processing.

I appreciate the relationship between rdf and xml datatypes is not 
straightforward, but it would certainly be useful to process values 
correctly when possible.

Suggested resolutions:

1) Assume the user typically knows the type, and so will use casting
(xsd:int(number)).

2) Include both datatype and xsi:type attributes where the rdf datatype 
maps to an xsd type: <number datatype="..." xsi:type="...">

Damian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCFd7hAyLCB+mTtykRArF6AJ0csv8zJG0ReiBWT6LjIPPDJVkiTACdGUuc
ZzIVqZc8MSKRy9IeemFaZg0=
=fzbi
-----END PGP SIGNATURE-----
Received on Friday, 18 February 2005 12:26:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:47 GMT