Numbers section
authorGavin Carothers <gavin@carothers.name>
Mon, 30 Apr 2012 18:42:56 -0700
changeset 265 28e16dc36b88
parent 264 ea85da6daebb
child 266 ffc45e068c65
Numbers section
rdf-turtle/index.html
--- a/rdf-turtle/index.html	Wed Apr 25 18:24:28 2012 -0700
+++ b/rdf-turtle/index.html	Mon Apr 30 18:42:56 2012 -0700
@@ -301,7 +301,7 @@
 
 
 				<p>
-				  Literals in Turtle N-Triples have a lexical form followed by a language tag, a datatype IRI, or neither.
+				  Literals in Turtle have a lexical form followed by a language tag, a datatype IRI, or neither.
 				  The representation of the lexical form consists of a delimiting <code>"</code>, a sequence of characters matching the regular expression <code>[^\"\\\n\r]</code> or <a href="#numeric">numeric escape sequence</a> or <a href="#string">string escape sequence</a>, and a final delimiting <code>"</code>.
 				  The corresponding <a href="../rdf-concepts/index.html#dfn-lexical-form">RDF lexical form</a> is the characters between the <code>""</code>s, after processing any escape sequences.
 				  If present, the <a href="../rdf-concepts/index.html#dfn-language-tagged-string">language tag</a> is preceded by a <code>@</code>.
@@ -342,27 +342,40 @@
 
 				</section>
 				<section id="abbrev">
-				<h3 >Abbreviating Common Datatypes in Turtle</h3>
-				<p>Integer values, arbitrary precision decimal values, double precision floating point values and boolean values may be written without quotes or datatypes as follows:</p>
-				<ul>
-				  <li>
-				    Integer values may be written as an optional sign and a series of digits. Integers match the regular expression "<code>[+-]?[0-9]+</code>".
-				  </li>
+				<h3 >Representing Numbers in Turtle</h3>
+				<p>Numbers can be written with lexical form and datatype (Example: <code>"-5.0"^^xsd:decimal</code>) but Turtle has syntax for writing integer values, arbitrary precision decimal values, double precision floating point values and boolean values.</p>
+				<table>
+					<thead>
+						<tr>
+							<th>Data Type</th>
+							<th>Abbreviated</th>
+							<th>Lexical</th>
+							<th>Description</th>
+						</tr>
+					</thead>
+					<tbody>
+						<tr>
+							<td><strong>xsd:integer</strong></td>
+							<td><code>-5</code></td>
+							<td><code>"-5"^^xsd:integer</code></td>
+							<td>Integer values may be written as an optional sign and a series of digits. Integers match the regular expression "<code>[+-]?[0-9]+</code>".</td>
+						</tr>
+						<tr>
+							<td><strong>xsd:decimal</strong></td>
+							<td><code>-5.0</code></td>
+							<td><code>"-5.0"^^xsd:decimal</code></td>
+							<td>Arbitrary-precision decimals may be written as an optional sign, zero or more digits, a decimal point and one or more digits. Decimals match the regular expression "<code>[+-]?[0-9]*\.[0-9]+</code>".</td>
+						</tr>
+						<tr>
+							<td><strong>xsd:double</strong></td>
+							<td><code>4.2E9</code></td>
+							<td><code>"4.2E9"^^xsd:double</code></td>
+							<td>Double-precision floating point values may be written as an optionally signed mantissa with an optional decimal point, the letter "e" or "E", and an optionally signed integer exponent. The exponent matches the regular expression "<code>[+-]?[0-9]+</code>" and the mantissa one of these regular expressions: "<code>[+-]?[0-9]+\.[0-9]+</code>", "<code>[+-]?\.[0-9]+</code>" or "<code>[+-]?[0-9]</code>".</td>
+						</tr>
+					</tbody>
+				</table>
 
-				  <li style="padding-top: 1ex;">
-				    Arbitrary-precision decimals may be written as an optional sign, zero or more digits, a decimal point and one or more digits. Decimals match the regular expression "<code>[+-]?[0-9]*\.[0-9]+</code>".
-				  </li>
-				  <li style="padding-top: 1ex;">
-				    Double-precision floating point values may be written as an optionally signed mantissa with an optional decimal point, the letter "e" or "E", and an optionally signed integer exponent.
-				    The exponent matches the regular expression "<code>[+-]?[0-9]+</code>" and the mantissa one of these regular expressions: "<code>[+-]?[0-9]+\.[0-9]+</code>", "<code>[+-]?\.[0-9]+</code>" or "<code>[+-]?[0-9]</code>".
-				  </li>
-
-				  <li style="padding-top: 1ex;">
-				    Boolean values may be written as either <code>true</code> or <code>false</code> (case-sensitive) and represent RDF literals with the datatype <a href="http://www.w3.org/TR/xmlschema-2/#boolean">xsd:boolean</a>.
-				  </li>
-				</ul>
-
-				<table class="separated">
+<!-- 				<table class="separated">
 				  <caption style="font-weight: bold;">Example numeric representations:</caption>
 				  <tbody>
 				    <tr><th><a href="http://www.w3.org/TR/xmlschema-2/#integer">xsd:integer</a></th>
@@ -373,17 +386,23 @@
 				    <td><code>-.5e1</code></td> <td><code>0E0</code></td> <td><code>1.234567890E0</code></td> <td><code>01e1</code></td> <td><code>+10e0</code></td></tr>
 				  </tbody>
 				</table>
-
-				<pre class="example"><script type="text/turtle">
[email protected] : <http://example.org/stats> .
+ -->
+				<pre class="example"><script type="text/turtle">@prefix : <http://example.org/stats> .
 <http://somecountry.example/census2007>
     :censusYear 2007 ;              # xsd:integer
     :birthsPerPerson .0135 ;        # xsd:decimal
     :gdpDollars 14074.2E9 ;         # xsd:double
-    :isLandlocked false .           # xsd:boolean
     :series "IV"^^my:romanNumeral . # no abbreviation available
 				</script></pre>
 			</section>
+			<section>
+				<h3>Representing Booleans in Turtle</h3>
+				<p>Boolean values may be written as either <code>true</code> or <code>false</code> (case-sensitive) and represent RDF literals with the datatype <a href="http://www.w3.org/TR/xmlschema-2/#boolean">xsd:boolean</a>.</p>
+				<pre class="example"><script type="text/turtle">@prefix : <http://example.org/stats> .
+<http://somecountry.example/census2007>
+    :isLandlocked false .           # xsd:boolean</script></pre>
+
+			</section>
 				<section id="literal-summary">
 				  <h3>Summary of Literal Representations in N-Triples and Turtle</h3>