Some thoughts about XML literals in RDF

This page prepared as possible discussion notes concerning parseType="Literal" and XML literals in RDF.

Two orthogonal requirements:

  1. Lexical forms with XML-like markup. Don't wish to force escaping of every '<' and '&'.
  2. Literal values that are XML infosets

Two orthogonal solutions:

  1. rdf:parseType="Literal"
  2. rdf:datatype="&rdf;XMLLiteral"

The current solution is conflating these into a single mechanism, with the resulting stresses that we now witness (RDFcore discussions as of July 2003: see archive and references below).

If we separate these, we can have:

Simple text:

<rdf:Description>
  <ex:prop xml:lang="en">Some text</ex:prop>
</rdf:Description>

Simple text with markup:

<rdf:Description>
  <ex:prop xml:lang="en" rdf:parseType="Literal">
    Some <em>marked-up</em> text
  </ex:prop>
</rdf:Description>  

Simple text with XML infoset (based) value:

<rdf:Description>
  <ex:prop rdf:datatype="&rdf;XMLLiteral">Some XML text</ex:prop> 
</rdf:Description>  

XML text with XML infoset (based) value:

<rdf:Description> 
  <ex:prop rdf:datatype="&rdf;XMLLiteral"
           rdf:parseType="Literal">
    <record>
      <head>Data structure encoded in XML</head>
      <field1>XYZZY</field1>
      <field2>12345</field2>  
    </record>
  </ex:prop> 
</rdf:Description>

References:

  1. Martin Duerst's revised comments on I18N and XML Literals needing language tags: http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2003Jul/0126.html
  2. Pat Hayes "Tiger by the tail" commentary on usage of XML: http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2003Jul/0067.html
  3. My comments "XML literals considered textual": http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2003Jul/0117.html
  4. Dan Connolly's reference to #rdfms-literal-is-xml-structure: http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2003Jul/0035.html, which espouses a non-textual view ofXML literals in RDF.
  5. Patrick Stickler's simplifying proposal: http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2003Jul/0131.html
  6. My comments "XML literals lacking consensus": http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2003Jul/0155.html
  7. My comments: "Who feels the pain?", and thoughts on application use of RDF literals: http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2003Jul/0212.html, a precursor to this page.

For feedback please see: <http://www.ninebynine.org/index.html#Contact>
$Id: XMLLiterals.html,v 1.1 2003/07/17 22:10:16 graham Exp $