W3C home > Mailing lists > Public > www-html@w3.org > May 2006

RDF/A typed literals in XHTML 2.0

From: Richard Smith <richard@ex-parrot.com>
Date: Mon, 22 May 2006 21:17:43 +0200
To: www-html@w3.org
Message-ID: <Pine.LNX.4.58.0605221559270.13038@sphinx.mythic-beasts.com>




My apologies if this is not the correct forum to raise this
question, or if it is already documented somewhere -- I've
searched the W3 website quite extensively and can't see
anything, though.

Section 23.1 of the current XHTML 2.0 draft gives an example
of the datatype attribute being used to provide a typed
literal as the object of a RDF triple,

   <meta about="http://www.example.com/"
         property="dc:created"
         datatype="xsd:date">2004-03-20</meta>

Presumably this is to be interpreted as the N-Triple,

   <http://www.example.com/>
     <http://purl.org/dc/elements/1.1/created>
     "2004-03-20"^^<http://www.w3.org/2001/XMLSchema#date> .

According to section 23.2, the QName in the property
attribute (and presumably datatype attribute, though this is
not explicitly stated) is converted to tha URI by
concatenating the namespace URI and local part -- i.e.
exactly as done in other RDF-related specs.  This means that
for this N-Triple interpretation to hold, the following
namespace bindings would need to be declared:

   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema#"

The trailing '#' on the xsd namespace declaration is a
potential problem: it is needed so that concatenation of the
URI and local part gives the correct datatype URI; however,
it is not the correct namespace URI for other "normal" uses
of the xsd namespace where a trailing '#' must *not* be
given.  (The XML namespace spec is quite specific about this
-- the namespace URI is treated as a string and namespace
URIs are only treated as equal if they are lexically
identical.)

Ordinarily in XHTML, there are unlikely to be any other uses
of the xsd namespace, so the trailing '#' is unlikely to be
a problem; however, if the XHTML is embedded in some other
language (e.g. in an <xsd:annotation> element in an XML
Schema document, or within a SOAP response), the two
variants of the xsd namespace are likely to cause problems.

Is there a standard way of dealing with this?  Currently
I've got around it by declaring both

   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:xsd4rdf="http://www.w3.org/2001/XMLSchema#"

but this seems somewhat error-prone.

The situation could be improved somewhat by the use of
CURIEs, thus allowing something like the following:

   <meta xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         about="http://www.example.com/"
         property="dc:created"
         datatype="xsd:#date"
         xsi:type="xsd:date">2004-03-20</meta>

(The xsi:type is simply an example of something that needs
the other namespace.)  This is still not perfect as it still
requires authors to remember which elements really take a
QName (e.g. xsi:type), and which simply use a QName as a
short-hand for specifying the URI (e.g. datatype).

Unfortunately the current draft of the RDF/A Syntax spec
only allows the use of CURIEs for the rel, rev and property
attributes, and the use of mixed CURIE/URIs in href and
about attributes; the datatype attribute is not mentioned.

(Allowing the use of a CURIE in the datatype attribute would
also allow the types of typed literals to be specified via
the xscd XPointer scheme.)

Are there any intentions of either allowing the CURIEs as
datatypes, or of removing this potential confusion some
other way?

Thanks in advance,

Richard Smith
Received on Tuesday, 30 May 2006 09:30:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:06 GMT