|
61 | 61 | <body>
|
62 | 62 | <section id='abstract'>
|
63 | 63 | <p>N-Triples is a line-based, plain text format for encoding an <a data-cite="RDF12-CONCEPTS#dfn-rdf-graph">RDF graph</a>.</p>
|
| 64 | + |
| 65 | + <p>RDF 1.2 N-Triples introduces <a data-cite="RDF12-CONCEPTS#dfn-quoted-triples">quoted triples</a> |
| 66 | + as a fourth kind of <a data-cite="RDF12-CONCEPTS#dfn-rdf-term">RDF term</a> |
| 67 | + which can be used as the |
| 68 | + <a data-cite="RDF12-CONCEPTS#dfn-subject">subject</a> or |
| 69 | + <a data-cite="RDF12-CONCEPTS#dfn-object">object</a> of another |
| 70 | + <a data-cite="RDF12-CONCEPTS#dfn-rdf-triple">triple</a>, |
| 71 | + making it possible to make statements about other statements.</p> |
64 | 72 | </section>
|
65 | 73 |
|
66 | 74 | <section id='sotd'>
|
@@ -144,21 +152,55 @@ <h3>Simple Triples</h3>
|
144 | 152 | (<a data-cite="RDF12-CONCEPTS#dfn-subject">subject</a>,
|
145 | 153 | <a data-cite="RDF12-CONCEPTS#dfn-predicate">predicate</a>, and
|
146 | 154 | <a data-cite="RDF12-CONCEPTS#dfn-object">object</a>) terms,
|
147 |
| - and terminated by '<code>.</code>'. |
| 155 | + and terminated by '<code>.</code>', |
| 156 | + which describes a <a data-cite="RDF12-CONCEPTS#dfn-simple-triple">simple triple</a>. |
148 | 157 | White space (spaces <code>U+0020</code> or tabs <code>U+0009</code>) may surround terms,
|
149 | 158 | except where significant as noted in the <a href="#n-triples-grammar">grammar</a>.</p>
|
150 | 159 |
|
151 | 160 | <p>Comments are treated as white space, and may be given after a '<code>#</code>' that is not part of
|
152 | 161 | another lexical token and continue to the end of the line.</p>
|
153 | 162 |
|
154 |
| - <pre id="ex-simple-triple" class="example ntriples" data-transform="updateExample" |
| 163 | + <p>Simple triples restrict <a data-cite="RDF12-CONCEPTS#dfn-subject">subject</a> |
| 164 | + and <a data-cite="RDF12-CONCEPTS#dfn-object">object</a> |
| 165 | + from being a <a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>.</p> |
| 166 | + |
| 167 | + <pre id="ex-simple-triple" class="example N-Triples" data-transform="updateExample" |
155 | 168 | title="Simple Triple">
|
156 | 169 | <!--
|
157 | 170 | <http://example.org/#spiderman> <http://www.perceive.net/schemas/relationship/enemyOf> <http://example.org/#green-goblin> .
|
158 | 171 | -->
|
159 | 172 | </pre>
|
160 | 173 | </section>
|
161 | 174 |
|
| 175 | + <section id="complex-triples"> |
| 176 | + <h3>Complex Triples</h3> |
| 177 | + |
| 178 | + <p>A <a data-cite="RDF12-CONCEPTS#dfn-complex-triple">complex triple</a> statement |
| 179 | + extends a simple triple statement |
| 180 | + to allow <a data-cite="RDF12-CONCEPTS#dfn-subject">subject</a> |
| 181 | + or <a data-cite="RDF12-CONCEPTS#dfn-object">object</a> |
| 182 | + to be a <a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>.</p> |
| 183 | + |
| 184 | + <p>A <a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a> |
| 185 | + is represented as a <code><a href="#grammar-production-quotedTriple">quotedTriple</a></code> with |
| 186 | + <code><a href="#grammar-production-subject">subject</a></code>, |
| 187 | + <code><a href="#grammar-production-predicate">predicate</a></code>, and |
| 188 | + <code><a href="#grammar-production-object">object</a></code> |
| 189 | + proceeded by `<<` and followed by `>>`. |
| 190 | + Note that <a data-cite="RDF12-CONCEPTS#dfn-complex-triple">complex triples</a> |
| 191 | + may be recursive. |
| 192 | + </p> |
| 193 | + |
| 194 | + <pre id="ex-complex-triple" class="example complex N-Triples" data-transform="updateExample" |
| 195 | + title="Complex Triple"> |
| 196 | + <!-- |
| 197 | + <http://example.org/employee38> <http://example.org/familyName> "Smith" . |
| 198 | + << <http://example.org/jobTitle> <http://example.org/jobTitle> "Assistant Designer" >> |
| 199 | + <http://example.org/accordingTo> <http://example.org/employee22> . |
| 200 | + --> |
| 201 | + </pre> |
| 202 | + </section> |
| 203 | + |
162 | 204 | <section id="sec-iri">
|
163 | 205 | <h3>IRIs</h3>
|
164 | 206 |
|
@@ -281,15 +323,15 @@ <h2>A Canonical form of N-Triples</h2>
|
281 | 323 | <li>There MUST be no comments.</li>
|
282 | 324 | <li><code>HEX</code> MUST use only uppercase letters (<code>[A-F]</code>).</li>
|
283 | 325 | <li>Characters MUST NOT be represented by <code>UCHAR</code>.</li>
|
284 |
| - <li>Within <a href="#grammar-production-STRING_LITERAL_QUOTE">STRING_LITERAL_QUOTE</a>, |
| 326 | + <li>Within <code><a href="#grammar-production-STRING_LITERAL_QUOTE">STRING_LITERAL_QUOTE</a></code>, |
285 | 327 | only the characters
|
286 | 328 | <code>U+0022</code>, <code>U+005C</code>, <code>U+000A</code>, <code>U+000D</code>
|
287 | 329 | are encoded using <code>ECHAR</code>.
|
288 | 330 | <code>ECHAR</code> MUST NOT be used for characters that are
|
289 | 331 | allowed directly in
|
290 | 332 | <a href="#grammar-production-STRING_LITERAL_QUOTE">STRING_LITERAL_QUOTE</a>. </li>
|
291 |
| - <li>The token EOL MUST be a single <code>U+000A</code>.</li> |
292 |
| - <li>The final EOL MUST be provided.</li> |
| 333 | + <li>The token `EOL` MUST be a single <code>U+000A</code>.</li> |
| 334 | + <li>The final `EOL` MUST be provided.</li> |
293 | 335 | </ul>
|
294 | 336 | <div class="issue" data-number="2">
|
295 | 337 | Note open errata:
|
@@ -468,17 +510,97 @@ <h2>Parsing</h2>
|
468 | 510 |
|
469 | 511 | <section id="sec-parsing-terms">
|
470 | 512 | <h3>RDF Term Constructors</h3>
|
471 |
| - <p>This table maps productions and lexical tokens to <code>RDF terms</code> or components of <code>RDF terms</code> listed in <a class="sectionRef sec-ref" href="#sec-parsing">section </a>:</p> |
| 513 | + <p>This table maps productions and lexical tokens to <code>RDF terms</code> or components of <code>RDF terms</code> listed in <a class="sectionRef sec-ref" href="#sec-parsing"></a>:</p> |
472 | 514 | <table class="simple">
|
473 | 515 | <thead>
|
474 | 516 | <tr><th>production</th><th>type</th><th>procedure</th></tr>
|
475 | 517 | </thead>
|
476 | 518 | <tbody>
|
477 |
| - <tr id="handle-IRIREF"><td style="text-align:left;"><a href="#grammar-production-IRIREF" class="type IRI">IRIREF</a></td><td><a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a></td><td>The characters between "<" and ">" are taken, with escape sequences unescaped, to form the unicode string of the IRI.</td></tr> |
478 |
| - <tr id="handle-STRING_LITERAL_QUOTE"><td style="text-align:left;"><a href="#grammar-production-STRING_LITERAL_QUOTE" class="type lexicalForm">STRING_LITERAL_QUOTE</a></td><td><a data-cite="RDF12-CONCEPTS#dfn-lexical-form">lexical form</a></td><td>The characters between the outermost '"'s are taken, with escape sequences unescaped, to form the unicode string of a lexical form.</td></tr> |
479 |
| - <tr id="handle-LANGTAG"><td style="text-align:left;"><a href="#grammar-production-LANGTAG" class="type langTag">LANGTAG</a></td><td><a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a></td><td>The characters following the <code>@</code> form the unicode string of the language tag.</td></tr> |
480 |
| - <tr id="handle-literal"><td style="text-align:left;"><a href="#grammar-production-literal" class="type literal">literal</a></td><td><a data-cite="RDF12-CONCEPTS#dfn-literal">literal</a></td><td>The literal has a lexical form of the first rule argument, <code> STRING_LITERAL_QUOTE</code>, and either a language tag of <code>LANGTAG</code> or a datatype IRI of <code>iri</code>, depending on which rule matched the input. If the <code>LANGTAG</code> rule matched, the datatype is <code>rdf:langString</code> and the language tag is <code>LANGTAG</code>. If neither a language tag nor a datatype IRI is provided, the literal has a datatype of <code>xsd:string</code>.</td></tr> |
481 |
| - <tr id="handle-BLANK_NODE_LABEL"><td style="text-align:left;"><a href="#grammar-production-BLANK_NODE_LABEL" class="type bNode">BLANK_NODE_LABEL</a></td><td><a data-cite="RDF12-CONCEPTS#dfn-blank-node">blank node</a></td><td>The string after '<code>_:</code>', is a key in <a href="#bnodeLabels">bnodeLabels</a>. If there is no corresponding blank node in the map, one is allocated.</td></tr> |
| 519 | + <tr id="handle-BLANK_NODE_LABEL"> |
| 520 | + <td style="text-align:left;"> |
| 521 | + <a href="#grammar-production-BLANK_NODE_LABEL" class="type bNode">BLANK_NODE_LABEL</a> |
| 522 | + </td> |
| 523 | + <td> |
| 524 | + <a data-cite="RDF12-CONCEPTS#dfn-blank-node">blank node</a> |
| 525 | + </td> |
| 526 | + <td> |
| 527 | + The string after '<code>_:</code>', |
| 528 | + is a key in <a href="#bnodeLabels">bnodeLabels</a>. |
| 529 | + If there is no corresponding blank node in the map, |
| 530 | + one is allocated. |
| 531 | + </td> |
| 532 | + </tr> |
| 533 | + <tr id="handle-IRIREF"> |
| 534 | + <td style="text-align:left;"> |
| 535 | + <a href="#grammar-production-IRIREF" class="type IRI">IRIREF</a> |
| 536 | + </td> |
| 537 | + <td> |
| 538 | + <a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a> |
| 539 | + </td> |
| 540 | + <td> |
| 541 | + The characters between "<" and ">" are taken, |
| 542 | + with escape sequences unescaped, |
| 543 | + to form the unicode string of the IRI. |
| 544 | + </td> |
| 545 | + </tr> |
| 546 | + <tr id="handle-LANGTAG"> |
| 547 | + <td style="text-align:left;"> |
| 548 | + <a href="#grammar-production-LANGTAG" class="type langTag">LANGTAG</a> |
| 549 | + </td> |
| 550 | + <td> |
| 551 | + <a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a> |
| 552 | + </td> |
| 553 | + <td> |
| 554 | + The characters following the <code>@</code> form the unicode string of the language tag. |
| 555 | + </td> |
| 556 | + </tr> |
| 557 | + <tr id="handle-STRING_LITERAL_QUOTE"> |
| 558 | + <td style="text-align:left;"> |
| 559 | + <a href="#grammar-production-STRING_LITERAL_QUOTE" class="type lexicalForm">STRING_LITERAL_QUOTE</a> |
| 560 | + </td> |
| 561 | + <td> |
| 562 | + <a data-cite="RDF12-CONCEPTS#dfn-lexical-form">lexical form</a> |
| 563 | + </td> |
| 564 | + <td> |
| 565 | + The characters between the outermost '"'s are taken, |
| 566 | + with escape sequences unescaped, |
| 567 | + to form the unicode string of a lexical form. |
| 568 | + </td> |
| 569 | + </tr> |
| 570 | + <tr id="handle-literal"> |
| 571 | + <td style="text-align:left;"> |
| 572 | + <a href="#grammar-production-literal" class="type literal">literal</a> |
| 573 | + </td> |
| 574 | + <td><a data-cite="RDF12-CONCEPTS#dfn-literal">literal</a> |
| 575 | + </td> |
| 576 | + <td> |
| 577 | + The literal has a lexical form of the first rule argument, |
| 578 | + <code>STRING_LITERAL_QUOTE</code>, |
| 579 | + and either a language tag of <code>LANGTAG</code> |
| 580 | + or a datatype IRI of <code>iri</code>, |
| 581 | + depending on which rule matched the input. |
| 582 | + If the <code>LANGTAG</code> rule matched, |
| 583 | + the datatype is <code>rdf:langString</code> |
| 584 | + and the language tag is <code>LANGTAG</code>. |
| 585 | + If neither a language tag nor a datatype IRI is provided, |
| 586 | + the literal has a datatype of <code>xsd:string</code>. |
| 587 | + </td> |
| 588 | + </tr> |
| 589 | + <tr id="handle-quotedTriple"> |
| 590 | + <td style="text-align:left;"> |
| 591 | + <a href="#grammar-production-quotedTriple" class="type quotedTriple">quotedTriple</a> |
| 592 | + </td> |
| 593 | + <td> |
| 594 | + <a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a> |
| 595 | + </td> |
| 596 | + <td> |
| 597 | + The <a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a> |
| 598 | + is composed of the terms constructed from |
| 599 | + the <code><a href="#grammar-production-subject">subject</a></code>, |
| 600 | + <code><a href="#grammar-production-predicate">predicate</a></code>, and |
| 601 | + <code><a href="#grammar-production-object">object</a></code> productions. |
| 602 | + </td> |
| 603 | + </tr> |
482 | 604 | </tbody>
|
483 | 605 | </table>
|
484 | 606 | </section>
|
@@ -552,6 +674,9 @@ <h2>Changes between RDF 1.1 and RDF 1.2</h2>
|
552 | 674 | for <a href="#sec-grammar-ws">White space</a> and
|
553 | 675 | <a href="#sec-grammar-comments">Comments</a>,
|
554 | 676 | better mirroring [[RDF12-TURTLE]].</li>
|
| 677 | + <li>Adds support for <a data-cite="RDF12-CONCEPTS#dfn-complex-triple">complex triples</a> |
| 678 | + as described in <a href="#complex-triples" class="sectionRef"></a> |
| 679 | + with updates to <a href="#sec-parsing-terms" class="sectionRef"></a>.</li> |
555 | 680 | <li>Updated the <a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a>
|
556 | 681 | grammar production to be consisten with with Turtle.</li>
|
557 | 682 | <li>Separated <a href="#security"></a> from <a href="#sec-mediaReg-n-triples"></a>
|
|
0 commit comments