Skip to content

Commit

Permalink
Functions for the base direction feature
Browse files Browse the repository at this point in the history
  • Loading branch information
afs committed Dec 4, 2024
1 parent e884490 commit 49c5366
Showing 1 changed file with 158 additions and 3 deletions.
161 changes: 158 additions & 3 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6238,6 +6238,128 @@ <h5>LANG</h5>
</div>
</div>
</div>

<table>
<thead>
<tr>
<th>Function</th>
<th><code>"abc"@ar</code></th>
<th><code>"abc"@ar--rtl</code></th>
<th>notes</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>LANG</code></td>
<td><code>"ar"</code></td>
<td><code>"ar"</code></td>
<td>behaves like old text</td>
</tr>
<tr>
<td><code>LANGDIR</code></td>
<td><code>""</code></td>
<td><code>"rtl"</code></td>
<td>New function</td>
</tr>
<tr>
<td><code>DATATYPE</code></td>
<td><code>rdf:langString</code></td>
<td><code>rdf:dirLangString</code></td>
<td></td>
</tr>
</tbody>
</table>
</section>
<section id="func-islang">
<h5>isLANG</h5>
<pre class="prototype nohighlight"> <span class="return">xsd:string</span> <span class="operator">isLANG</span> (<span class="type">RDF term</span> <span class="name">term</span>)
</pre>
<p>
The function <code>isLang</code> returns <code>true</code> if the
argument is a literal with a language
tag. Otherwise, the function returns false.
</p>
<p>If the argument is a literal, the function is
equivalent to testing for the datatype of the
literal being either <code>rdf:langString</code>
or <code>rdf:dirLangString</code>.
</p>
<div class="result">
<table>
<thead>
<tr>
<th>Expression</th>
<th><code>Result</code></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>isLANG("abc"@en)</code></td>
<td><code>true</code></td>
</tr>
<tr>
<td><code>isLANG(1)</code></td>
<td><code>false</code></td>
</tr>
<tr>
<td><code>isLANG(&lt;http://example/&gt;)</code></td>
<td><code>false</code></td>
</tr>
<tr>
<td><code>isLANG("abc@"en--ltr)</code></td>
<td><code>true</code></td>
</tr>
<tr>
<td><code>isLANG("تصميم المواقع"@ar--rtl)</code></td>
<td><code>true</code></td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="func-langdir">
<h5>LANGDIR</h5>
<pre class="prototype nohighlight"> <span class="return">xsd:string</span> <span class="operator">LANGDIR</span> (<span class="type"><span class="type literal">literal</span></span> <span class="name">ltrl</span>)
</pre>
<p>
If the argument is a literal,
the function <code>LANGDIR</code> returns the
<a data-cite="RDF12-CONCEPTS##dfn-base-direction">base direction</a>
of the literal with datatype <code>rdf:dirLangString</code>.
Otherwise, the function returns the empty string.
</p>
<div class="result">
<table>
<thead>
<tr>
<th>Expression</th>
<th><code>Result</code></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>LANGDIR("abc"@en--ltr)</code></td>
<td><code>"ltr"</code></td>
</tr>
<tr>
<td><code>LANGDIR("abc"@en)</code></td>
<td><code>""</code></td>
</tr>
<tr>
<td><code>LANGDIR("abc")</code></td>
<td><code>""</code></td>
</tr>
<tr>
<td><code>LANGDIR(1)</code></td>
<td><code>""</code></td>
</tr>
<tr>
<td><code>LANGDIR(&lt;http://example/&gt;)</code></td>
<td><code>error</code></td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="func-datatype">
<h5>DATATYPE</h5>
Expand Down Expand Up @@ -6431,9 +6553,27 @@ <h6>Argument Compatibility Rules</h6>
functions raises an error.</p>
<p>Compatibility of two arguments is defined as:</p>
<ul>
<li>The arguments are literals with datatype <code>xsd:string</code></li>
<li>The arguments are literals with identical language tags</li>
<li>The first argument is a literal with a language tag and the second argument is a literal with datatype <code>xsd:string</code></li>
<li>
The arguments are literals with datatype <code>xsd:string</code>
</li>
<li>
The arguments are literals with datatype <code>rdf:langString</code>
and the same <a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tags</a>
</li>
<li>
The arguments are literals with datatype <code>rdf:dirLangString</code>
and the same
<a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a>
and <a data-cite="RDF12-CONCEPTS#dfn-base-direction">base direction</a>
</li>
<li>
The first argument is a literal with datatype <code>rdf:langString</code>
and the second argument is a literal with datatype <code>xsd:string</code>
</li>
<li>
The first argument is a literal with datatype <code>rdf:dirLangString</code>,
and the second argument has datatype <code>xsd:string</code>
</li>
</ul>
<div class="result">
<table>
Expand Down Expand Up @@ -6470,9 +6610,24 @@ <h6>Argument Compatibility Rules</h6>
</tr>
<tr>
<td>"abc"</td>
<td>"b"@en-ltr</td>
<td>no</td>
</tr>
<tr>
<td>"abc"@en-ltr</td>
<td>"b"@en-ltr</td>
<td>yes</td>
</tr>
<tr>
<td>"abc"@en-ltr</td>
<td>"b"@en</td>
<td>no</td>
</tr>
<tr>
<td>"abc"@en-ltr</td>
<td>"z"</td>
<td>yes</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 49c5366

Please sign in to comment.