Skip to content

Commit 389cbe6

Browse files
committed
GH-187: Revise RDFterm-equal; update RDF term equality
1 parent 75fabc0 commit 389cbe6

File tree

1 file changed

+149
-131
lines changed

1 file changed

+149
-131
lines changed

spec/index.html

Lines changed: 149 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ <h4>Terminology</h4>
511511
<a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a>
512512
</li>
513513
<li>
514-
<a data-cite="RDF12-CONCEPTS#dfn-base-direction">base direction</a>
514+
<!-- Resolve clash with i18-glossery -->
515+
<a data-cite="RDF12-CONCEPTS#dfn-base-direction" class="lint-ignore">base direction</a>
515516
</li>
516517
<li>
517518
<a data-cite="RDF12-CONCEPTS#dfn-datatype-iri">datatype IRI</a>
@@ -5669,158 +5670,67 @@ <h5>NOT IN</h5>
56695670
</section>
56705671
<section id="func-rdfTerms">
56715672
<h4>Functions on RDF Terms</h4>
5672-
<section id="func-RDFterm-equal">
5673-
<h5>RDFterm-equal</h5>
5674-
<pre class="prototype nohighlight">
5675-
<span class="return">xsd:boolean</span> <span class="operator" style="text-transform: none;">RDFterm-equal</span> (<span class="type"><span class="type RDFterm">RDF term</span></span> <span class="name">term1</span>, <span class="type"><span class="type RDFterm">RDF term</span></span> <span class="name">term2</span>)
5676-
</pre>
5677-
5678-
<p>This function cannot be used directly in expressions. The purpose
5679-
of this function is to define the semantics of the "=" operator when applied to
5680-
two RDF terms that do not fall into any of the other, more concrete cases
5681-
covered in the operator mapping table in Section
5682-
<a href="#OperatorMapping" class="sectionRef"></a>.
5683-
</p>
5684-
5685-
<p>The function is defined as follows:</p>
5686-
<ul>
56875673

5688-
<li>Returns TRUE if <code>term1</code> and <code>term2</code>
5689-
are <em>equal</em> RDF terms, as defined below.</li>
5690-
5691-
<li>Produces a type error if <code>term1</code> and <code>term2</code> are both
5692-
literals having the same
5693-
<a data-cite="RDF12-CONCEPTS#dfn-datatype-iri">datatype IRI</a>;
5694-
this datatype IRI is <em>not</em> in the set of
5695-
<a data-cite="RDF12-CONCEPTS#dfn-recognized-datatype-iri">recognized datatype IRIs</a>;
5696-
and the <a data-cite="RDF12-CONCEPTS#dfn-lexical-form">lexical forms</a>
5697-
of the two literals are different from one another.</li>
5674+
<section id="func-sameTerm">
5675+
<h5>sameTerm</h5>
5676+
<pre class="prototype nohighlight"> <span class="return">xsd:boolean</span> <span class="operator">sameTerm</span> (<span class="type"><span class="type RDFterm">RDF term</span></span> <span class="name">term1</span>, <span class="type"><span class="type RDFterm">RDF term</span></span> <span class="name">term2</span>)</pre>
5677+
<p>Returns TRUE if <code>term1</code> and <code>term2</code> are the same RDF term as
5678+
defined in [[[RDF12-CONCEPTS]]] [[RDF12-CONCEPTS]]; returns FALSE otherwise.</p>
56985679

5699-
<li>Returns FALSE otherwise.</li>
5680+
<p class="ednote" style="background-color: #EEE">
5681+
Finalize when
5682+
<a href="https://github.com/w3c/rdf-concepts/issues/154">RDF Concepts issue 154</a>
5683+
has been resolved.
5684+
</p>
57005685

5701-
</ul>
57025686
<p>
5703-
<code>term1</code> and <code>term2</code> are <em>equal</em> RDF terms if any of the following is
5704-
true:</p>
5687+
<code>term1</code> and <code>term2</code> are <em>equal</em> RDF terms
5688+
if any of the following is true:</p>
57055689
<ul>
57065690
<li>
5707-
<span class="name">term1</span> is an <span class="IRI type">IRI</span> and <span class="name">term2</span> is an <span class="IRI type">IRI</span>
5708-
such that these two <span class="IRI type">IRIs</span> are equal as per the notion of <a data-cite="RDF12-CONCEPTS#dfn-iri-equality">IRI equality</a> of
5691+
<span class="name">term1</span> is an <span class="IRI type">IRI</span>
5692+
and <span class="name">term2</span> is an <span class="IRI type">IRI</span>
5693+
such that these two <span class="IRI type">IRIs</span> are equal as per
5694+
the notion of <a data-cite="RDF12-CONCEPTS#dfn-iri-equality">IRI equality</a> of
57095695
[[RDF12-CONCEPTS]].
57105696
</li>
57115697
<li>
57125698
<span class="name">term1</span> is a <span class="literal type">literal</span> and
5713-
<span class="name">term2</span> is a <span class="literal type">literal</span> such that
5714-
these two <span class="literal type">literals</span> are equal as per the notion of <a data-cite="RDF12-CONCEPTS#dfn-literal-term-equality">Literal term equality</a> of
5715-
[[RDF12-CONCEPTS]].
5699+
<span class="name">term2</span> is a <span class="literal type">literal</span> such
5700+
that these two <span class="literal type">literals</span> are equal as per the
5701+
notion of
5702+
<a data-cite="RDF12-CONCEPTS#dfn-literal-term-equality">Literal term equality</a>
5703+
of [[RDF12-CONCEPTS]].
57165704
</li>
57175705
<li>
57185706
<span class="name">term1</span> is a <span class="literal type">literal</span> and
57195707
<span class="name">term2</span> is a <span class="literal type">literal</span>
57205708
such that the <a data-cite="RDF12-CONCEPTS#dfn-datatype-iri">datatype IRI</a>
57215709
of each of these two literals is in the set of
57225710
<a data-cite="RDF12-CONCEPTS#dfn-recognized-datatype-iri">recognized datatype IRIs</a>
5723-
and both literals have the same <a data-cite="RDF12-CONCEPTS#dfn-literal-value">literal value</a>.
57245711
</li>
57255712
<li>
57265713
<span class="name">term1</span> and <span class="name">term2</span> are the same
5727-
<span class="bnode type">blank node</span>.
5714+
<a data-cite="RDF12-CONCEPTS#dfn-blank-node">blank node</a>
57285715
</li>
57295716
</ul>
5730-
<p id="func-RDFterm-equal-note1" class="note">
5731-
An extended implementation may support additional datatypes for literals. An
5732-
implementation processing a query that tests for equivalence of literals with non-recognized datatypes
5733-
(and non-identical lexical form and datatype IRI) returns an error, indicating that it
5734-
is unable to determine whether or not the values of the compared literals are equivalent. For example, an
5735-
unextended implementation will produce an error when testing either <span class="queryExcerpt"><code>"iiii"^^my:romanNumeral =
5736-
"iv"^^my:romanNumeral</code></span> or <span class="queryExcerpt"><code>"iiii"^^my:romanNumeral !=
5737-
"iv"^^my:romanNumeral</code></span>.</p>
5738-
<div class="exampleGroup">
5739-
<pre class="data nohighlight">
5740-
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
5741-
5742-
_:a foaf:name "Alice".
5743-
_:a foaf:mbox &lt;mailto:alice@work.example&gt; .
5744-
5745-
_:b foaf:name "Ms A.".
5746-
_:b foaf:mbox &lt;mailto:alice@work.example&gt; .
5747-
</pre>
5748-
<div class="queryGroup">
5749-
<p>This query finds the people who have multiple <code>foaf:name</code> triples:</p>
5750-
<pre class="query nohighlight">
5751-
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
5752-
SELECT ?name1 ?name2
5753-
WHERE {
5754-
?x foaf:name ?name1 ;
5755-
foaf:mbox ?mbox1 .
5756-
?y foaf:name ?name2 ;
5757-
foaf:mbox ?mbox2 .
5758-
FILTER (?mbox1 = ?mbox2 &amp;& ?name1 != ?name2)
5759-
}</pre>
5760-
<p>Query result:</p>
5761-
<div class="result">
5762-
<table class="resultTable">
5763-
<tbody>
5764-
<tr>
5765-
<th>name1</th>
5766-
<th>name2</th>
5767-
</tr>
5768-
<tr>
5769-
<td>"Alice"</td>
5770-
<td>"Ms A."</td>
5771-
</tr>
5772-
<tr>
5773-
<td>"Ms A."</td>
5774-
<td>"Alice"</td>
5775-
</tr>
5776-
</tbody>
5777-
</table>
5778-
</div>
5779-
</div>
5717+
5718+
<div class="ednote" style="background-color: #EEE" >
5719+
<p>Update for RDF 1.2 Concepts equality definitions</p>
57805720
</div>
5781-
<p>In this query for documents that were annotated at a specific date and time (New
5782-
Year's Day 2005, measures in timezone +00:00), the RDF terms are not the same, but have
5783-
equivalent values according to their datatype:</p>
5784-
<div class="exampleGroup">
5785-
<pre class="data nohighlight">
5786-
PREFIX a: &lt;http://www.w3.org/2000/10/annotation-ns#&gt;
5787-
PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
5721+
<ul>
5722+
<li><a data-cite="RDF12-CONCEPTS#dfn-iri-equality">IRI equality</a></li>
5723+
<li><a data-cite="RDF12-CONCEPTS#dfn-literal-term-equality">Literal term equality</a></li>
5724+
<li><span class="name">term1</span> and <span class="name">term2</span> are the same
5725+
<a data-cite="RDF12-CONCEPTS#dfn-blank-node">blank node</a>
5726+
<span class="bnode type">blank node</span>.</li>
5727+
<li>Triple term equality</li>
5728+
</ul>
57885729

5789-
_:b a:annotates &lt;http://www.w3.org/TR/rdf-sparql-query/&gt; .
5790-
_:b dc:date "2004-12-31T19:00:00-05:00"^^&lt;http://www.w3.org/2001/XMLSchema#dateTime&gt; .</pre>
5791-
<div class="queryGroup">
5792-
<pre class="query nohighlight">
5793-
PREFIX a: &lt;http://www.w3.org/2000/10/annotation-ns#&gt;
5794-
PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
5795-
PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
5730+
<p class="ednote" style="background-color: #EEE">
5731+
Remove query examples in `sameTerm` and instead have a table of "sameterm"/"result".
5732+
</p>
57965733

5797-
SELECT ?annotates
5798-
WHERE {
5799-
?annot a:annotates ?annotates .
5800-
?annot dc:date ?date .
5801-
FILTER ( ?date = xsd:dateTime("2005-01-01T00:00:00Z") )
5802-
}
5803-
</pre>
5804-
<div class="result">
5805-
<table class="resultTable">
5806-
<tbody>
5807-
<tr>
5808-
<th>annotates</th>
5809-
</tr>
5810-
<tr>
5811-
<td>&lt;http://www.w3.org/TR/rdf-sparql-query/&gt;</td>
5812-
</tr>
5813-
</tbody>
5814-
</table>
5815-
</div>
5816-
</div>
5817-
</div>
5818-
</section>
5819-
<section id="func-sameTerm">
5820-
<h5>sameTerm</h5>
5821-
<pre class="prototype nohighlight"> <span class="return">xsd:boolean</span> <span class="operator">sameTerm</span> (<span class="type"><span class="type RDFterm">RDF term</span></span> <span class="name">term1</span>, <span class="type"><span class="type RDFterm">RDF term</span></span> <span class="name">term2</span>)</pre>
5822-
<p>Returns TRUE if <code>term1</code> and <code>term2</code> are the same RDF term as
5823-
defined in [[[RDF12-CONCEPTS]]] [[RDF12-CONCEPTS]]; returns FALSE otherwise.</p>
58245734
<div class="exampleGroup">
58255735
<pre class="data nohighlight">
58265736
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
@@ -5926,6 +5836,113 @@ <h5>sameTerm</h5>
59265836
<code>"100"^^t:kilos = "85"^^t:kilos</code> will result in an error, eliminating that
59275837
potential solution.</p>
59285838
</section>
5839+
<section id="func-RDFterm-equal">
5840+
<h5>RDFterm-equal</h5>
5841+
<pre class="prototype nohighlight">
5842+
<span class="return">xsd:boolean</span> <span class="operator" style="text-transform: none;">RDFterm-equal</span> (<span class="type"><span class="type RDFterm">RDF term</span></span> <span class="name">term1</span>, <span class="type"><span class="type RDFterm">RDF term</span></span> <span class="name">term2</span>)
5843+
</pre>
5844+
5845+
<p>This function cannot be used directly in expressions. The purpose
5846+
of this function is to define the semantics of the "=" operator when applied to
5847+
two RDF terms that do not fall into any of the other, more concrete cases
5848+
covered in the operator mapping table in Section
5849+
<a href="#OperatorMapping" class="sectionRef"></a>.
5850+
</p>
5851+
5852+
<p class="ednote" style="background-color: #EEE">
5853+
This will be renamed <code>sameValue</code></p>
5854+
5855+
<ol>
5856+
<li>If one or both arguments are known to be ill-typed,
5857+
then produce a type error.
5858+
</li>
5859+
<li>Returns TRUE if <code>term1</code> and <code>term2</code>
5860+
are <em>equal</em> RDF terms, as defined below.
5861+
</li>
5862+
<li>If the SPARQL processor can determine the values of both terms
5863+
and it can determine the values are equal, then return TRUE.
5864+
</li>
5865+
<li>If the SPARQL processor can determine that the values of the terms
5866+
can not be equal, the return FALSE.</li>
5867+
</ol>
5868+
5869+
<div class="ednote" style="background-color: #EEE" >
5870+
<p>If the function is to become callable as
5871+
<em>`sameValue(term1, term2)`</em>, add a rule
5872+
that if there is an
5873+
<a href="#OperatorMapping">operation mapping</a> for "="
5874+
for the arguments, an implementation MUST return the same boolean value
5875+
from <em>`sameValue(term1, term2)`</em>.
5876+
</p>
5877+
</p>What about IRIs and blank nodes which are "same term"</p>
5878+
</div>
5879+
5880+
<div class="note">
5881+
<p>A literal is
5882+
<a data-cite="RDF12-CONCEPTS#dfn-ill-typed">ill-typed</a>
5883+
if the datatype is one handled by the SPARQL processor and
5884+
the lexical form is not in
5885+
<a data-cite="RDF12-CONCEPTS#dfn-lexical-space">the lexical space</a>
5886+
of the datatype.
5887+
</p>
5888+
<p>
5889+
The function `RDFterm-equal` returns true or false in cases where
5890+
the SPARQL processor can determine that the values of the
5891+
arguments are equal or are not equal. If the SPARQL processor
5892+
can not be sure, it returns `error`.
5893+
</p>
5894+
</div>
5895+
<div class="ednote" style="background-color: #EEE">
5896+
<p>
5897+
@@ Describe error as extension
5898+
</p>
5899+
<p>
5900+
Possible examples:
5901+
`sameValue("abc"^^xsd:string, "IV"^^ex:romanNumeral)`
5902+
<br/>
5903+
A processor providing only the datatypes required by this spec
5904+
returns `error` because it can not know that `ex:romanNumeral`
5905+
is a number.
5906+
</p>
5907+
<p>
5908+
sameValue("32"^^x:meters, "3200"^^x:centimeters)
5909+
</p>
5910+
<p>
5911+
sameValue("abc"^^xsd:integer, "123"^^xsd:integer) -- `error` by (1)
5912+
argument 1 is
5913+
<a data-cite="RDF12-CONCEPTS#dfn-ill-typed">ill-typed</a>.
5914+
</p>
5915+
</div>
5916+
5917+
<p id="func-RDFterm-equal-note1" class="note">
5918+
An extended implementation may support additional datatypes for literals. An
5919+
implementation processing a query that tests for equivalence of literals with non-recognized datatypes
5920+
(and non-identical lexical form and datatype IRI) returns an error, indicating that it
5921+
is unable to determine whether or not the values of the compared literals are equivalent. For example, an
5922+
unextended implementation will produce an error when testing either <span class="queryExcerpt"><code>"iiii"^^my:romanNumeral =
5923+
"iv"^^my:romanNumeral</code></span> or <span class="queryExcerpt"><code>"iiii"^^my:romanNumeral !=
5924+
"iv"^^my:romanNumeral</code></span>.
5925+
</p>
5926+
5927+
<p>Examples:</p>
5928+
<div class="result">
5929+
<table>
5930+
<tbody>
5931+
<tr>
5932+
<th>RDFterm-equal</th>
5933+
<th>Results</th>
5934+
</tr>
5935+
<tr>
5936+
<td><code></code></td>
5937+
<td>true</td>
5938+
</tr>
5939+
</tbody>
5940+
</table>
5941+
</div>
5942+
5943+
5944+
</section>
5945+
59295946
<section id="func-isIRI">
59305947
<h5>isIRI</h5>
59315948
<pre class="prototype nohighlight">
@@ -5978,6 +5995,7 @@ <h5>isIRI</h5>
59785995
</div>
59795996
</div>
59805997
</section>
5998+
59815999
<section id="func-isBlank">
59826000
<h5>isBLANK</h5>
59836001
<pre class="prototype nohighlight"> <span class="return">xsd:boolean</span> <span class="operator">isBLANK</span> (<span class="type"><span class="type">RDF term</span></span> <span class="name">term</span>)</pre>
@@ -7227,12 +7245,12 @@ <h5>CONCAT</h5>
72277245
<a data-cite="XPATH-FUNCTIONS-31#func-concat">fn:concat</a> function.
72287246
If all input literals are literals with the same
72297247
<a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a>
7230-
and same <a>base direction</a>
7248+
and same <a class="lint-ignore">base direction</a>
72317249
then the returned string literal is a literal with that language
72327250
tag and base direction.
72337251
If all input literals are literals with the same
72347252
<a data-cite="RDF12-CONCEPTS#dfn-language-tag">language tag</a>,
7235-
but not all the same <a>base direction</a>,
7253+
but not all the same <a class="lint-ignore">base direction</a>,
72367254
the returned literal is a literal with that language tag and no
72377255
base direction.
72387256
</p>
@@ -12255,7 +12273,7 @@ <h2>Changes between SPARQL 1.1 Query Language and SPARQL 1.2 Query Language</h2>
1225512273
<a data-cite="RDF12-CONCEPTS#dfn-base-direction">base direction</a>:
1225612274
`LANGDIR`, `hasLANG`, hasLANGDIR, and `STRLANGDIR`</li>
1225712275
<li>Define parser input as being an
12258-
<a data-cite="RDF12-CONCEPTS#dfn-rdf-term">RDF string</a>.
12276+
<a data-cite="RDF12-CONCEPTS#dfn-rdf-string">RDF string</a>.
1225912277
Exclude Unicode surrogates from Unicode escape sequences.</li>
1226012278
<li>Remove concepts of plain and simple literals, in favor of explicit mentions of `xsd:string`</li>
1226112279
<li>Migrate XML Schema references to 1.1</li>

0 commit comments

Comments
 (0)