Add list of XSD types and definition of datatype map
authorRichard Cyganiak <richard@cyganiak.de>
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
rdf-concepts/index.html
--- 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; }
     </style>
     <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="http://www.w3.org/TR/rdf-mt/#dtype_interp">the XSD datatype
-    map</a>.  This is
-    <a href="http://www.w3.org/2011/rdf-wg/track/issues/70">ISSUE-70</a>.
-    <a href="http://www.w3.org/2011/rdf-wg/track/issues/66">ISSUE-66</a>
-    tracks the integration of new XSD 1.1 datatypes.</p>
-    </p>
+    <p class="issue"><a href="http://www.w3.org/2011/rdf-wg/track/issues/66">ISSUE-66</a>
+    tracks the integration of new XSD 1.1 datatypes.</p></p>
 
+    <p><a title="IRI">IRIs</a> of the form
+    <code>http://www.w3.org/2001/XMLSchema#<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="http://www.w3.org/TR/xmlschema11-2/">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="http://www.w3.org/TR/xmlschema-2/#string"><code>xsd:string</code></a></td><td>Character strings</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#boolean"><code>xsd:boolean</code></a></td><td>true, false</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#decimal"><code>xsd:decimal</code></a></td><td>Arbitrary-precision decimal numbers</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#integer"><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="http://www.w3.org/TR/xmlschema-2/#double"><code>xsd:double</code></a></td><td>64-bit floating point numbers incl. ±Inf, ±0, NaN</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#float"><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="http://www.w3.org/TR/xmlschema-2/#date"><code>xsd:date</code></a></td><td>Dates (yyyy-mm-dd) with or without timezone</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#time"><code>xsd:time</code></a></td><td>Times (hh:mm:ss.sss…) with or without timezone</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#dateTime"><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="http://www.w3.org/TR/xmlschema-2/#gYear"><code>xsd:gYear</code></a></td><td>Gregorian calendar year</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#gMonth"><code>xsd:gMonth</code></a></td><td>Gregorian calendar month</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#gDay"><code>xsd:gDay</code></a></td><td>Gregorian calendar day of the month</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#gYearMonth"><code>xsd:gYearMonth</code></a></td><td>Gregorian calendar year and month</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#gMonthDay"><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="http://www.w3.org/TR/xmlschema-2/#byte"><code>xsd:byte</code></a></td><td>-128…+127 (8 bit)</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#short"><code>xsd:short</code></a></td><td>-32768…+32767 (16 bit)</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#int"><code>xsd:int</code></a></td><td>-2147483648…+2147483647 (32 bit)</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#long"><code>xsd:long</code></a></td><td>-9223372036854775808…+9223372036854775807 (64 bit)</td></tr>
+
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#unsignedByte"><code>xsd:unsignedByte</code></a></td><td>0…255 (8 bit)</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#unsignedShort"><code>xsd:unsignedShort</code></a></td><td>0…65535 (16 bit)</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#unsignedInt"><code>xsd:unsignedInt</code></a></td><td>0…4294967295 (32 bit)</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#unsignedLong"><code>xsd:unsignedLong</code></a></td><td>0…18446744073709551615 (64 bit)</td></tr>
+
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#positiveInteger"><code>xsd:positiveInteger</code></a></td><td>Integer numbers &gt;0</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"><code>xsd:nonNegativeInteger</code></a></td><td>Integer numbers ≥0</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#negativeInteger"><code>xsd:negativeInteger</code></a></td><td>Integer numbers &lt;0</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"><code>xsd:nonPositiveInteger</code></a></td><td>Integer numbers ≤0</td></tr>
+
+    <tr><th rowspan="2">Encoded binary data</th>
+        <td><a href="http://www.w3.org/TR/xmlschema-2/#hexBinary"><code>xsd:hexBinary</code></a></td><td>Hex-encoded binary data</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#base64Binary"><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="http://www.w3.org/TR/xmlschema-2/#anyURI"><code>xsd:anyURI</code></a></td><td>Absolute or relative URIs and IRIs</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#language"><code>xsd:language</code></a></td><td>Language tags per [[BCP47]]</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#normalizedString"><code>xsd:normalizedString</code></a></td><td>Whitespace-normalized strings</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#token"><code>xsd:token</code></a></td><td>Tokenized strings</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"><code>xsd:NMTOKEN</code></a></td><td>XML NMTOKENs</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#Name"><code>xsd:Name</code></a></td><td>XML Names</td></tr>
+    <tr><td><a href="http://www.w3.org/TR/xmlschema-2/#NCName"><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="http://www.w3.org/TR/xmlschema-2/#duration"><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="http://www.w3.org/TR/xmlschema-2/#QName"><code>xsd:QName</code></a> 
+    and
+    <a href="http://www.w3.org/TR/xmlschema-2/#ENTITY"><code>xsd:ENTITY</code></a> 
+    require an enclosing XML document context.</li>
+    <li><a href="http://www.w3.org/TR/xmlschema-2/#ID"><code>xsd:ID</code></a> 
+    and
+    <a href="http://www.w3.org/TR/xmlschema-2/#IDREF"><code>xsd:IDREF</code></a>
+    are for cross references within an XML document.</li>
+    <li><a href="http://www.w3.org/TR/xmlschema-2/#NOTATION"><code>xsd:NOTATION</code></a> 
+    is not intended for direct use.</li>
+    <li><a href="http://www.w3.org/TR/xmlschema-2/#IDREFS"><code>xsd:IDREFS</code></a>, 
+    <a href="http://www.w3.org/TR/xmlschema-2/#ENTITIES"><code>xsd:ENTITIES</code></a> 
+    and
+    <a href="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"><code>xsd:NMTOKENS</code></a> 
+    are sequence-valued datatypes which do not fit the RDF <a>datatype</a>
+    model.</li>
+    </ul>
+    </div>
 
 </section>
 
@@ -810,15 +896,12 @@
     <p><code><dfn>rdf:XMLLiteral</dfn></code> is defined as follows.</p>
    
     <dl>
-      <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>
 
       <dd>is
       <code>http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral</code>.</dd>
 
-      
- 
-
       <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="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#string"><code>xsd:string</code></a>
+<a href="http://www.w3.org/TR/xmlschema-2/#string"><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>http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral</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>http://www.w3.org/2001/XMLSchema#<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>
 
 
 <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="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#built-in-datatypes">built-in</a>
-    datatypes, IRIs such as
-    <code>http://www.w3.org/2001/XMLSchema#int</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">
-section
-6.5.2</a>)
-is usually more helpful than comparing their syntactic forms (see 
-<a href="#section-Literal-Equality">
-section
-6.5.1</a>).
-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">
-section
-6.3</a>).</p>
+    <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>
 
 </section>
 
@@ -1081,6 +1161,7 @@
   <h2>Changes from RDF 2004</h2>
 
   <ul>
+    <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>