Skip to content

Commit 31caead

Browse files
gkelloggTallTed
andauthored
Adds BNF and text to change LANGTAG to LANG_DIR to support base direction (#31)
* Adds BNF and text to change LANGTAG to LANG_DIR to support base direction and term constructors for creating directional language-tagged strings. --------- Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
1 parent 46b7e30 commit 31caead

3 files changed

Lines changed: 31 additions & 15 deletions

File tree

spec/index.html

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,12 @@
104104
<a data-cite="RDF12-CONCEPTS#dfn-subject">subject</a> or
105105
<a data-cite="RDF12-CONCEPTS#dfn-object">object</a> of another
106106
<a data-cite="RDF12-CONCEPTS#dfn-rdf-triple">triple</a>,
107-
making it possible to make statements about other statements.</p>
107+
making it possible to make statements about other statements.
108+
RDF 1.2 TriG also adds shares
109+
<a data-cite="RDF12-CONCEPTS#dfn-dir-lang-string">directional language-tagged strings</a>
110+
with [[RDF12-TURTLE]].</p>
108111

109-
<p>RDF 1.2 TriG also shares the <a data-cite="RDF12-TURTLE#annotation-syntax">annotation syntax</a> with [[RDF12-TURTLE]] which allows
112+
<p>In addition, RDF 1.2 TriG shares the <a data-cite="RDF12-TURTLE#annotation-syntax">annotation syntax</a> with [[RDF12-TURTLE]] which allows
110113
<a>quoted triples</a> to also be <a data-cite="RDF12-CONCEPTS#dfn-asserted-triple">asserted</a>.</p>
111114
</section>
112115

@@ -627,7 +630,7 @@ <h3>Grammar</h3>
627630
<li>
628631
The strings '<a href="#grammar-production-prefixID"><code class="grammar-literal">@prefix</code></a>'
629632
and '<a href="#grammar-production-base"><code class="grammar-literal">@base</code></a>'
630-
match the pattern for <a href="#grammar-production-LANGTAG"><code>LANGTAG</code></a>,
633+
match the pattern for <a href="#grammar-production-LANG_DIR"><code>LANG_DIR</code></a>,
631634
though neither <code class="grammar-literal">prefix</code>
632635
nor <code class="grammar-literal">base</code>
633636
are <a data-cite="?LANG-SUBTAG-REGISTRY#">registered language subtags</a>.
@@ -678,6 +681,11 @@ <h2>Selected Terminal Literal Strings</h2>
678681
<td><code title="apostrophe">'</code></td>
679682
<td>Apostrophe</td>
680683
</tr>
684+
<tr id="cp-hyphen">
685+
<td><code class="codepoint">U+002D</code></td>
686+
<td><code title="hyphen">-</code></td>
687+
<td>Hyphen</td>
688+
</tr>
681689
<tr id="cp-colon">
682690
<td><code class="codepoint">U+003B</code></td>
683691
<td><code title="colon">:</code></td>
@@ -724,7 +732,9 @@ <h2>Selected Terminal Literal Strings</h2>
724732
<dt id="cp-triple-quote"><code>"""</code></dt>
725733
<dd>three concatenated quotation mark characters, each having the code point <code class="codepoint">U+0022</code></dd>
726734
<dt id="cp-triple-apostrophe"><code>'''</code></dt>
727-
<dd>three concatenated apostrophes characters, each having the code point <code class="codepoint">U+0027</code></dd>
735+
<dd>three concatenated apostrophe characters, each having the code point <code class="codepoint">U+0027</code></dd>
736+
<dt id="cp-hyphen-hyphen"><code>--</code></dt>
737+
<dd>two concatenated <a href="#cp-hyphen"><code title="hyphen">-</code></a> characters</dd>
728738
</dl>
729739
</section>
730740
</section>
@@ -739,7 +749,10 @@ <h2>Parsing</h2>
739749
<a data-cite="RDF12-CONCEPTS#dfn-blank-node">blank nodes</a>, and
740750
<a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triples</a>.
741751

742-
Literals are composed of a <a data-cite="RDF12-CONCEPTS#dfn-lexical-form">lexical form</a> and an optional <a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a> [[!BCP47]] or datatype IRI.
752+
Literals are composed of a <a data-cite="RDF12-CONCEPTS#dfn-lexical-form">lexical form</a>
753+
and an optional <a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a> [[!BCP47]]
754+
– possibly including a <a data-cite="RDF12-CONCEPTS#dfn-base-direction">base direction</a>
755+
or an optional <a data-cite="RDF12-CONCEPTS#dfn-datatype-iri">datatype IRI</a>.
743756
An extra type, <code id="prefix" class="dfn">prefix</code>, is used during parsing to map string identifiers to namespace IRIs.
744757

745758
This section maps a string conforming to the grammar in <a href="#grammar-ebnf" class="sectionRef"></a>
@@ -802,23 +815,23 @@ <h3>RDF Term Constructors</h3>
802815
</thead>
803816
<tbody>
804817
<tr id="handle-IRIREF" ><td style="text-align:left;" ><a class="type IRI" href="#grammar-production-IRIREF" ><code>IRIREF</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-iri"> IRI </a></td><td>The characters between "&lt;" and "&gt;" are taken, after the <a href="#numeric">numeric escape sequences</a> are processed, to form the Unicode string of the IRI. <a data-cite="RDF12-CONCEPTS#dfn-relative-iri">Relative IRI reference</a> resolution is performed per <a href="#sec-iri-references" class="sectionRef"></a>.</td></tr>
805-
<tr id="handle-PNAME_NS" ><td style="text-align:left;" rowspan="2"><a class="type string" href="#grammar-production-PNAME_NS" ><code>PNAME_NS</code> </a></td><td><a href="#prefix"> prefix </a></td><td>When used in a <a href="#grammar-production-prefixID"><code>prefixID</code></a> or <a href="#grammar-production-sparqlPrefix"><code>sparqlPrefix</code></a> production, the <code>prefix</code> is the potentially empty Unicode string matching the first argument of the rule is a key into the <a href="#namespaces">namespaces map</a>.</td></tr>
818+
<tr id="handle-PNAME_NS" ><td style="text-align:left;" rowspan="2"><a class="type string" href="#grammar-production-PNAME_NS" ><code>PNAME_NS</code> </a></td><td><a href="#prefix"> prefix </a></td><td>When used in a <a href="#grammar-production-prefixID"><code>prefixID</code></a> or <a href="#grammar-production-sparqlPrefix"><code>sparqlPrefix</code></a> production, the <code>prefix</code> is the potentially empty Unicode string matching the first argument of the rule is a key into the <a href="#namespaces">namespaces map</a>.</td></tr>
806819
<tr id="handle-PNAME-IRI" > <td><a data-cite="RDF12-CONCEPTS#dfn-iri"> <code>IRI</code> </a></td><td>When used in a <a href="#grammar-production-PrefixedName"><code>PrefixedName</code></a> production, the <code>iri</code> is the value in the <a href="#namespaces">namespaces map</a> corresponding to the first argument of the rule.</td></tr>
807820
<tr id="handle-PNAME_LN" ><td style="text-align:left;" ><a class="type IRI" href="#grammar-production-PNAME_LN" ><code>PNAME_LN</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-iri"> <code>IRI</code> </a></td><td>A potentially empty <a href="#prefix">prefix</a> is identified by the first sequence, <a href="#grammar-production-PNAME_NS"><code>PNAME_NS</code></a>. The <a href="#namespaces">namespaces map</a> <em class="rfc2119">MUST</em> have a corresponding <code>namespace</code>. The Unicode string of the IRI is formed by unescaping the <a href="#reserved">reserved characters</a> in the second argument, <a href="#grammar-production-PN_LOCAL"><code>PN_LOCAL</code></a>, and concatenating this onto the <code>namespace</code>.</td></tr>
808821
<!-- tr id="handle-PrefixedName" ><td style="text-align:left;" ><a class="type IRI" href="#grammar-production-PrefixedName" >PrefixedName </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-iri"> IRI </a></td><td>.</td></tr -->
809822
<tr id="handle-STRING_LITERAL_SINGLE_QUOTE" ><td style="text-align:left;" ><a class="type lexicalForm" href="#grammar-production-STRING_LITERAL_SINGLE_QUOTE" ><code>STRING_LITERAL_SINGLE_QUOTE</code></a></td><td><a data-cite="RDF12-CONCEPTS#dfn-lexical-form">lexical form</a></td><td>The characters between the outermost <a href="#cp-apostrophe"><code title="apostrophe">'</code></a>s are taken, with <a href="#numeric">numeric</a> and <a href="#string">string</a> escape sequences unescaped, to form the Unicode string of a lexical form.</td></tr>
810823
<tr id="handle-STRING_LITERAL_QUOTE" ><td style="text-align:left;" ><a class="type lexicalForm" href="#grammar-production-STRING_LITERAL_QUOTE" ><code>STRING_LITERAL_QUOTE</code></a></td><td><a data-cite="RDF12-CONCEPTS#dfn-lexical-form">lexical form</a></td><td>The characters between the outermost <a href="#cp-quotation-mark"><code title="quotation mark">&quot;</code></a>s are taken, with <a href="#numeric">numeric</a> and <a href="#string">string</a> escape sequences unescaped, to form the Unicode string of a lexical form.</td></tr>
811824
<tr id="handle-STRING_LITERAL_LONG_SINGLE_QUOTE"><td style="text-align:left;" ><a class="type lexicalForm" href="#grammar-production-STRING_LITERAL_LONG_SINGLE_QUOTE"><code>STRING_LITERAL_LONG_SINGLE_QUOTE</code></a></td><td><a data-cite="RDF12-CONCEPTS#dfn-lexical-form">lexical form</a></td><td>The characters between the outermost <a href="#cp-triple-apostrophe"><code>'''</code></a>s are taken, with <a href="#numeric">numeric</a> and <a href="#string">string</a> escape sequences unescaped, to form the unicode string of a lexical form.</td></tr>
812825
<tr id="handle-STRING_LITERAL_LONG_QUOTE" ><td style="text-align:left;" ><a class="type lexicalForm" href="#grammar-production-STRING_LITERAL_LONG_QUOTE" ><code>STRING_LITERAL_LONG_QUOTE</code></a></td><td><a data-cite="RDF12-CONCEPTS#dfn-lexical-form">lexical form</a></td><td>The characters between the outermost <a href="#cp-triple-quote"><code>"""</code></a>s are taken, with <a href="#numeric">numeric</a> and <a href="#string">string</a> escape sequences unescaped, to form the Unicode string of a lexical form.</td></tr>
813-
<tr id="handle-LANGTAG" ><td style="text-align:left;" ><a class="type langTag" href="#grammar-production-LANGTAG" ><code>LANGTAG</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a></td><td>The characters following the <a href="#cp-at-sign"><code title="at sign">@</code></a> form the Unicode string of the language tag.</td></tr>
814-
<tr id="handle-RDFLiteral" ><td style="text-align:left;" ><a class="type literal" href="#grammar-production-RDFLiteral" ><code>RDFLiteral</code> </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</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>
826+
<tr id="handle-LANG_DIR" ><td style="text-align:left;" ><a class="type langDir" href="#grammar-production-LANG_DIR" >LANG_DIR </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a></td><td>The characters following the <a href="#cp-at-sign"><code title="at sign">@</code></a> form the <a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a> and optionally the <a data-cite="RDF12-CONCEPTS#dfn-base-direction">base direction</a>, if the matched characters include <a href="#cp-hyphen-hyphen"><code>--</code></a>.</td></tr>
827+
<tr id="handle-RDFLiteral" ><td style="text-align:left;" ><a class="type literal" href="#grammar-production-RDFLiteral" >RDFLiteral </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, <a href="#grammar-production-String"><code>String</code></a>. If the <code>'^^' iri</code> rule is matched, the <a data-cite="RDF12-CONCEPTS#dfn-datatype-iri">datatype IRI</a> is derived from the <code>iri</code>, and the literal has no language tag. If the <a href="#grammar-production-LANG_DIR" class="type langDir"><code>LANG_DIR</code></a> rule is matched, the <a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a> and <a data-cite="RDF12-CONCEPTS#dfn-base-direction">base direction</a> are taken from <a href=#handle-LANG_DIR class="type langDir"><code>LANG_DIR</code></a>. If there is no <a data-cite="RDF12-CONCEPTS#dfn-base-direction">base direction</a>, the datatype is <code>rdf:langString</code>. If there is a <a data-cite="RDF12-CONCEPTS#dfn-base-direction">base direction</a>, the datatype is <code>rdf:dirLangString</code>. If neither matched, the datatype is <code>xsd:string</code>, and the literal has no language tag.</td></tr>
815828
<tr id="handle-INTEGER" ><td style="text-align:left;" ><a class="type integer" href="#grammar-production-INTEGER" ><code>INTEGER</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-literal"> literal </a></td><td>The literal has a lexical form of the input string, and a datatype of <code>xsd:integer</code>.</td></tr>
816829
<tr id="handle-DECIMAL" ><td style="text-align:left;" ><a class="type decimal" href="#grammar-production-DECIMAL" ><code>DECIMAL</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-literal"> literal </a></td><td>The literal has a lexical form of the input string, and a datatype of <code>xsd:decimal</code>.</td></tr>
817830
<tr id="handle-DOUBLE" ><td style="text-align:left;" ><a class="type double" href="#grammar-production-DOUBLE" ><code>DOUBLE</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-literal"> literal </a></td><td>The literal has a lexical form of the input string, and a datatype of <code>xsd:double</code>.</td></tr>
818831
<tr id="handle-BooleanLiteral" ><td style="text-align:left;" ><a class="type boolean" href="#grammar-production-BooleanLiteral" ><code>BooleanLiteral</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-literal"> literal </a></td><td>The literal has a lexical form of the <code>true</code> or <code>false</code>, depending on which matched the input, and a datatype of <code>xsd:boolean</code>.</td></tr>
819832
<tr id="handle-BLANK_NODE_LABEL" ><td style="text-align:left;" ><a class="type bNode" href="#grammar-production-BLANK_NODE_LABEL" ><code>BLANK_NODE_LABEL</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-blank-node"> blank node </a></td><td>The string matching the second argument, <a href="#grammar-production-PN_LOCAL"><code>PN_LOCAL</code></a>, is a key in <a href="#bnodeLabels">bnodeLabels</a>. If there is no corresponding blank node in the map, one is allocated.</td></tr>
820833
<tr id="handle-ANON" ><td style="text-align:left;" ><a class="type bNode" href="#grammar-production-ANON" ><code>ANON</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-blank-node"> blank node </a></td><td>A blank node is generated.</td></tr>
821-
<tr id="handle-blankNodePropertyList" ><td style="text-align:left;" ><a class="type bNode" href="#grammar-production-blankNodePropertyList" ><code>blankNodePropertyList</code></a></td><td><a data-cite="RDF12-CONCEPTS#dfn-blank-node"> blank node </a></td><td>A blank node is generated. Note the rules for <code>blankNodePropertyList</code> in the next section.</td></tr>
834+
<tr id="handle-blankNodePropertyList" ><td style="text-align:left;" ><a class="type bNode" href="#grammar-production-blankNodePropertyList" ><code>blankNodePropertyList</code></a></td><td><a data-cite="RDF12-CONCEPTS#dfn-blank-node">blank node </a></td><td>A blank node is generated. Note the rules for <code>blankNodePropertyList</code> in the next section.</td></tr>
822835
<tr id="handle-collection" ><td style="text-align:left;" rowspan="2"><a class="type bNode" href="#grammar-production-collection" ><code>collection</code> </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-blank-node"> blank node </a></td><td>For non-empty lists, a blank node is generated. Note the rules for <code>collection</code> in the next section.</td></tr>
823836
<tr id="handle-collection-IRI" ><td ><a data-cite="RDF12-CONCEPTS#dfn-iri"> IRI </a></td><td>For empty lists, the resulting IRI is <code>rdf:nil</code>. Note the rules for <code>collection</code> in the next section.</td></tr>
824837
<tr id="handle-quotedTriple" ><td style="text-align:left;" ><a class="type quotedTriple" href="#grammar-production-quotedTriple" >quotedTriple </a></td><td><a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a></td>
@@ -1123,6 +1136,9 @@ <h2>Changes between RDF 1.1 and RDF 1.2</h2>
11231136
<li>Syntax is aligned to the Turtle [[RDF12-TURTLE]] recommendation for <a data-cite="RDF12-CONCEPTS#dfn-rdf-term">RDF terms</a>.</li>
11241137
<li>Separated <a href="#security"></a> from <a href="#sec-mediaReg"></a>
11251138
and updated language.</li>
1139+
<li>Changes the `LANGTAG` terminal production to
1140+
<a href="#grammar-production-LANG_DIR" class="type langDir"><code>LANG_DIR</code></a> to include
1141+
an optional <a data-cite="RDF12-CONCEPTS#dfn-base-direction">base direction</a>.</li>
11261142
</ul>
11271143
</section>
11281144

0 commit comments

Comments
 (0)