W3C home > Mailing lists > Public > w3c-rdfcore-wg@w3.org > July 2003

Re: take 2: primer text for parseType="Literal"

From: Frank Manola <fmanola@mitre.org>
Date: Thu, 24 Jul 2003 15:05:06 -0400
Message-ID: <3F202DE2.3060508@mitre.org>
To: Brian McBride <bwm@hplb.hpl.hp.com>
CC: rdf core <w3c-rdfcore-wg@w3.org>, Martin Duerst <duerst@w3.org>, i18n <w3c-i18n-ig@w3.org>

Based on Brian's last "take", I propose to put the following text in the 
Primer for parseType="Literal".  The typed literal given for the value 
of <dc:title> in the triple is that produced by the RDF Validation 
Service, but someone may want to check this further anyway.

4.5  XML Literals

Sometimes the value of a property needs to be a fragment of XML, or text 
that might contain XML markup.  For example, a publisher might maintain 
RDF metadata that includes the titles of books and articles.  While such 
titles are often just simple strings of characters, this is not always 
the case.  For instance, the titles of books on mathematics may contain 
mathematical formulas that could be represented using MathML [MATHML]. 
Titles might also include markup for other reasons, such as for Ruby 
annotations [RUBY], or for bidirectional rendering or special glyph 
variants (see, e.g., [CHARMOD]).

RDF/XML provides a special notation to make it easy to write literals of 
this kind.  This is done using a third value of the rdf:parseType 
attribute.  Giving an element the attribute rdf:parseType="Literal" 
indicates that the contents of the element are to be interpreted as an 
XML fragment.  Example 22 illustrates the use of rdf:parseType="Literal":

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

   <rdf:Description rdf:ID="book12345">
     <dc:title rdf:parseType="Literal">
        <span xml:lang="en">
          The <em>&lt;br /&gt;</em> Element Considered Harmful.


The RDF/XML in Example 22 describes a graph containing one triple:

ex:book12345 <dc:title> "&lt;span xml:lang="en"&gt; The &lt;em&gt;&lt;br 
/&gt;&lt;/em&gt; Element Considered Harmful. 
&lt;/span&gt;"^^rdf:XMLLiteral .

The rdf:parseType="Literal" attribute in the RDF/XML indicates that all 
the XML within the <dc:title> element is an XML fragment that is the 
value of the dc:title property.

The value of the property is a typed literal, whose datatype, 
rdf:XMLLiteral, is defined in [RDF-CONCEPTS] specifically to represent 
fragments of XML.  The XML fragment is canonicalized according to the 
XML Exclusive Canonicalization recommendation [XML-XC14N].  This causes 
declarations of used namespaces to be added to the fragment, the 
escaping of reserved characters such as '<', '>' and '&', and possibly, 
the re-ordering of attributes.  Contextual attributes, such as xml:lang 
and xml:base are not inherited from the RDF/XML document, and, if 
required, must, as shown in the example, be explicitly specified in the 
XML fragment.

This example illustrates that care must be taken designing RDF data.  It 
might appear at first glance that titles are simple strings best 
represented as plain literals, and only later might it be discovered 
that some titles contain markup.  In cases where the value of a property may
sometimes contain markup and sometimes not, either 
rdf:parseType="Literal" should be used throughout, or software must 
handle both plain literals and rdf:XMLLiterals as values of this property.

@@Informational References to be added:

[RUBY] Ruby Annotations, Sawicki, M., Suignard, M., Ishikawa, M., Durst, 
M., Texin, T., World Wide Web Consortium, 31 May 2001.  This version is 
http://www.w3.org/TR/2001/REC-ruby-20010531/.  The latest version is 

[XML-XC14N] @@use citation in Syntax

[CHARMOD]  @@use citation in Syntax

[MATHML] Mathematical Markup Language (MathML) Version 2.0, Carlisle, 
D., Ion, P., Miner, R., Poppelier, N. (Editors); Ausbrooks, R., Buswell, 
S., Dalmas, S., Devitt, S., Diaz, A., Hunter, R., Smith, B., Soiffer, 
N., Sutor, R., Watt, S. (Principal Authors), World Wide Web Consortium, 
21 February 2001.  This version is 
http://www.w3.org/TR/2001/REC-MathML2-20010221.  The latest version is 

Frank Manola                   The MITRE Corporation
202 Burlington Road, MS A345   Bedford, MA 01730-1420
mailto:fmanola@mitre.org       voice: 781-271-8147   FAX: 781-271-875
Received on Thursday, 24 July 2003 14:40:58 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:24:24 UTC