Add list of XSD types and definition of datatype map
authorRichard Cyganiak <>
Sun, 20 Nov 2011 19:54:26 +0000
changeset 179 3de657928078
parent 178 fae093033aba
child 180 892080f58fac
Add list of XSD types and definition of datatype map
--- a/rdf-concepts/index.html	Fri Nov 18 22:18:51 2011 +0000
+++ b/rdf-concepts/index.html	Sun Nov 20 19:54:26 2011 +0000
@@ -5,6 +5,7 @@
     <title>RDF 1.1 Concepts and Abstract Syntax</title>
     <style type="text/css">
 .figure { font-weight: bold; text-align: center; }
+table.xsd-types td, table.xsd-types th { border: 1px solid #ddd; padding: 0.1em 0.5em; }
     <script src='../ReSpec.js/js/respec.js' class='remove'></script>
     <script class='remove'>
@@ -777,14 +778,99 @@
 <section id="xsd-datatypes">
     <h3>The XML Schema Built-in Datatypes</h3>
-    <p class="issue">This subsection should discuss
-    <a href="">the XSD datatype
-    map</a>.  This is
-    <a href="">ISSUE-70</a>.
-    <a href="">ISSUE-66</a>
-    tracks the integration of new XSD 1.1 datatypes.</p>
-    </p>
+    <p class="issue"><a href="">ISSUE-66</a>
+    tracks the integration of new XSD 1.1 datatypes.</p></p>
+    <p><a title="IRI">IRIs</a> of the form
+    <code><em>xxx</em></code>,
+    where <code><em>xxx</em></code>
+    is the name of a datatype, denote the built-in datatypes defined in
+    <em><a href="">XML Schema 1.1 Part 2:
+    Datatypes</a></em> [[!XMLSCHEMA11-2]]. The XML Schema built-in types
+    listed in the following table are the
+    <dfn>RDF-compatible XSD types</dfn>. Their use is RECOMMENDED.</p>
+    <table class="xsd-types" rules="all">
+    <tr><th></th><th>Datatype</th><th>Value space (informative)</th></tr>
+    <tr><th rowspan="4">Core types</th><td><a href=""><code>xsd:string</code></a></td><td>Character strings</td></tr>
+    <tr><td><a href=""><code>xsd:boolean</code></a></td><td>true, false</td></tr>
+    <tr><td><a href=""><code>xsd:decimal</code></a></td><td>Arbitrary-precision decimal numbers</td></tr>
+    <tr><td><a href=""><code>xsd:integer</code></a></td><td>Arbitrary-size integer numbers</td></tr>
+    <tr><th rowspan="2">IEEE floating-point<br />numbers</th>
+        <td><a href=""><code>xsd:double</code></a></td><td>64-bit floating point numbers incl. ±Inf, ±0, NaN</td></tr>
+    <tr><td><a href=""><code>xsd:float</code></a></td><td>32-bit floating point numbers incl. ±Inf, ±0, NaN</td></tr>
+    <tr><th rowspan="3">Time and date</th>
+        <td><a href=""><code>xsd:date</code></a></td><td>Dates (yyyy-mm-dd) with or without timezone</td></tr>
+    <tr><td><a href=""><code>xsd:time</code></a></td><td>Times (hh:mm:ss.sss…) with or without timezone</td></tr>
+    <tr><td><a href=""><code>xsd:dateTime</code></a></td><td>Date and time with or without timezone</td></tr>
+    <tr><th rowspan="5">Recurring and<br />partial dates</th>
+        <td><a href=""><code>xsd:gYear</code></a></td><td>Gregorian calendar year</td></tr>
+    <tr><td><a href=""><code>xsd:gMonth</code></a></td><td>Gregorian calendar month</td></tr>
+    <tr><td><a href=""><code>xsd:gDay</code></a></td><td>Gregorian calendar day of the month</td></tr>
+    <tr><td><a href=""><code>xsd:gYearMonth</code></a></td><td>Gregorian calendar year and month</td></tr>
+    <tr><td><a href=""><code>xsd:gMonthDay</code></a></td><td>Gregorian calendar month and day</td></tr>
+    <tr><th rowspan="12">Limited-range<br />integer numbers</th>
+        <td><a href=""><code>xsd:byte</code></a></td><td>-128…+127 (8 bit)</td></tr>
+    <tr><td><a href=""><code>xsd:short</code></a></td><td>-32768…+32767 (16 bit)</td></tr>
+    <tr><td><a href=""><code>xsd:int</code></a></td><td>-2147483648…+2147483647 (32 bit)</td></tr>
+    <tr><td><a href=""><code>xsd:long</code></a></td><td>-9223372036854775808…+9223372036854775807 (64 bit)</td></tr>
+    <tr><td><a href=""><code>xsd:unsignedByte</code></a></td><td>0…255 (8 bit)</td></tr>
+    <tr><td><a href=""><code>xsd:unsignedShort</code></a></td><td>0…65535 (16 bit)</td></tr>
+    <tr><td><a href=""><code>xsd:unsignedInt</code></a></td><td>0…4294967295 (32 bit)</td></tr>
+    <tr><td><a href=""><code>xsd:unsignedLong</code></a></td><td>0…18446744073709551615 (64 bit)</td></tr>
+    <tr><td><a href=""><code>xsd:positiveInteger</code></a></td><td>Integer numbers &gt;0</td></tr>
+    <tr><td><a href=""><code>xsd:nonNegativeInteger</code></a></td><td>Integer numbers ≥0</td></tr>
+    <tr><td><a href=""><code>xsd:negativeInteger</code></a></td><td>Integer numbers &lt;0</td></tr>
+    <tr><td><a href=""><code>xsd:nonPositiveInteger</code></a></td><td>Integer numbers ≤0</td></tr>
+    <tr><th rowspan="2">Encoded binary data</th>
+        <td><a href=""><code>xsd:hexBinary</code></a></td><td>Hex-encoded binary data</td></tr>
+    <tr><td><a href=""><code>xsd:base64Binary</code></a></td><td>Base64-encoded binary data</td></tr>
+    <tr><th rowspan="7">Miscellaneous<br />XSD types</th>
+        <td><a href=""><code>xsd:anyURI</code></a></td><td>Absolute or relative URIs and IRIs</td></tr>
+    <tr><td><a href=""><code>xsd:language</code></a></td><td>Language tags per [[BCP47]]</td></tr>
+    <tr><td><a href=""><code>xsd:normalizedString</code></a></td><td>Whitespace-normalized strings</td></tr>
+    <tr><td><a href=""><code>xsd:token</code></a></td><td>Tokenized strings</td></tr>
+    <tr><td><a href=""><code>xsd:NMTOKEN</code></a></td><td>XML NMTOKENs</td></tr>
+    <tr><td><a href=""><code>xsd:Name</code></a></td><td>XML Names</td></tr>
+    <tr><td><a href=""><code>xsd:NCName</code></a></td><td>XML NCNames</td></tr>
+    </table>
+    <div class="note">
+    The other built-in XML Schema datatypes are unsuitable
+    for various reasons, and SHOULD NOT be used:
+    <ul>
+    <li><a href=""><code>xsd:duration</code></a>
+    does not have a well-defined value space (this may be corrected
+    in later revisions of XML Schema datatypes, in which case the
+    revised datatype would be suitable for use in RDF datatyping).</li>
+    <li><a href=""><code>xsd:QName</code></a> 
+    and
+    <a href=""><code>xsd:ENTITY</code></a> 
+    require an enclosing XML document context.</li>
+    <li><a href=""><code>xsd:ID</code></a> 
+    and
+    <a href=""><code>xsd:IDREF</code></a>
+    are for cross references within an XML document.</li>
+    <li><a href=""><code>xsd:NOTATION</code></a> 
+    is not intended for direct use.</li>
+    <li><a href=""><code>xsd:IDREFS</code></a>, 
+    <a href=""><code>xsd:ENTITIES</code></a> 
+    and
+    <a href=""><code>xsd:NMTOKENS</code></a> 
+    are sequence-valued datatypes which do not fit the RDF <a>datatype</a>
+    model.</li>
+    </ul>
+    </div>
@@ -810,15 +896,12 @@
     <p><code><dfn>rdf:XMLLiteral</dfn></code> is defined as follows.</p>
-      <dt><a name="XMLLiteral-uri" id="XMLLiteral-uri">An IRI for
-identifying this datatype</a></dt>
+      <dt><a name="XMLLiteral-uri" id="XMLLiteral-uri">An IRI denoting
+      this datatype</a></dt>
       <dt><a name="XMLLiteral-lexical-space" id="XMLLiteral-lexical-space">The lexical space</a></dt>
 <dd>is the set of all
@@ -881,7 +964,7 @@
       <p class="note">RDF applications may use additional equivalence relations, such as
 that which relates an 
-<a href=""><code>xsd:string</code></a>
+<a href=""><code>xsd:string</code></a>
 with an <code>rdf:XMLLiteral</code> corresponding to
 a single text node of the same string.</p>
@@ -894,57 +977,54 @@
 <section id="datatype-maps">
     <h3>Datatype Maps</h3>
-    <p class="issue">This subsection should define the term “datatype map”
-    and consolidate all information related to the mapping from IRIs to
-    datatypes.</p>
+    <p>A <dfn>datatype map</dfn> is an implementation-defined set of
+    &lt;<a>IRI</a>, <a>datatype</a>&gt; pairs such that no
+    IRI appears twice in the set. It can be seen as a function from IRIs
+    to datatypes. It may only contain pairs in which the IRI denotes
+    the datatype. Every datatype map contains the pair
+    &lt;<code></code>,
+    <code><a>rdf:XMLLiteral</a></code>&gt;.</p>
+    <p>The <dfn>XSD datatype map</dfn> is the <a>datatype map</a>
+    which also contains the set of all pairs of the form
+    &lt;<code><em>xxx</em></code>,
+    <code>xsd:<em>xxx</em></code>&gt;, where <code>xsd:<em>xxx</em></code>
+    is the name of an
+    <a title="RDF-compatible XSD types">RDF-compatible XSD type</a>.</p>
 <section id="section-Literal-Value">
     <h3>The Value Corresponding to a Literal</h3>
-    <p>The <a>datatype IRI</a> of a literal denotes a <a>datatype</a>.
-    For XML Schema
-    <a href="">built-in</a>
-    datatypes, IRIs such as
-    <code></code> are used. The IRI
-    of the datatype <a href="#section-XMLLiteral"><tt>rdf:XMLLiteral</tt></a> may be used.
-    There may be other, implementation dependent, mechanisms by which
-    IRIs refer to datatypes.</p>
     <p>The <dfn>literal value</dfn> associated with a <a>literal</a> is:</p>
-    <ul>
-    <li><strong>If the literal is a <a>language-tagged string</a>:</strong>
-    a pair consisting of its <a>lexical form</a> and its <a>language tag</a>,
-    in that order.</li>
-    <li><strong>Otherwise:</strong> the result of applying the
-    <a>lexical-to-value mapping</a> associated with the <a>datatype IRI</a>
-    to the <a>lexical form</a>.</li>
-    </ul>
-    <p>If the <a>lexical form</a> is not in
-    the <a>lexical space</a> of the datatype,
-    then the typed literal is <dfn>ill-typed</dfn>, and no literal value can be
-    associated with the typed literal. Such a case, while in error, is not
-    <em>syntactically</em> ill-formed.</p>
+    <ol>
+    <li><strong>If the literal is a <a>language-tagged string</a>,</strong>
+    then the literal value is a pair consisting of its <a>lexical form</a>
+    and its <a>language tag</a>, in that order.</li>
+    <li><strong>If the literal's <a>datatype IRI</a> is not in the
+    <a>datatype map</a>,</strong> then the literal value is undefined.</li>
+    <li>Let <em>d</em> be the <a>datatype</a> associated with the
+    datatype IRI in the datatype map.</li> 
+    <li><strong>If the literal's <a>lexical form</a> is in the
+    <a>lexical space</a> of <em>d</em>,</strong> then the literal value
+    is the result of applying the <a>lexical-to-value mapping</a>
+    of <em>d</em> to the <a>lexical form</a>.</li>
+    <li><strong>Otherwise,</strong> the literal is
+    <dfn>ill-typed</dfn>, and no literal value can be
+    associated with the literal. Such a case, while in error, is not
+    <em>syntactically</em> ill-formed.</li>
+    </ol>
-      <p class="note">
-In application contexts, comparing the values of literals (see 
-<a href="#section-Literal-Value">
-is usually more helpful than comparing their syntactic forms (see 
-<a href="#section-Literal-Equality">
-Similarly, for comparing RDF Graphs,
-semantic notions of entailment (see 
-[[RDF-MT]]) are usually
-more helpful than syntactic equality (see 
-<a href="#section-graph-equality">
+    <p class="note">In application contexts, comparing the
+    <a title="literal value">values of literals</a> is usually
+    more helpful than comparing their syntactic forms
+    (<a>literal equality</a>).
+    Similarly, for comparing <a title="RDF graph">RDF Graphs</a>,
+    semantic notions of <a>entailment</a> are usually more helpful
+    than syntactic <a>graph equivalence</a>.</p>
@@ -1081,6 +1161,7 @@
   <h2>Changes from RDF 2004</h2>
+    <li>2011-11-20: Added table of <a>RDF-compatible XSD types</a>, and definition of <a>datatype map</a>, both adapted from previous content in [[RDF-MT]]
     <li>2011-11-18: Replaced informative <em>Introduction</em> and <em>RDF Concepts</em> sections with a new extended introduction. Folded some content from <em>RDF Concepts</em> into the later normative sections, mostly as examples and notes.</li>
     <li>2011-11-10: Changed XSD references to version 1.1</li>
     <li>2011-11-10: Replaced the <a href="#section-fragID">section on fragment identifiers</a> with an updated account that follows RFC 3986</li>