Skip to content

Commit a628cdf

Browse files
committed
GH-187: Revise sameValue; produce error for 'don't know'
1 parent 160ba3f commit a628cdf

File tree

1 file changed

+66
-52
lines changed

1 file changed

+66
-52
lines changed

spec/index.html

Lines changed: 66 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5978,6 +5978,9 @@ <h5>sameTerm</h5>
59785978
<section id="func-sameValue">
59795979
<span id="func-RDFterm-equal"><!-- obsolete id --></span>
59805980
<h5>sameValue</h5>
5981+
<p style="text-indent: 50px; margin-top: -5px">
5982+
<i>This function replaces</i> <code>RDFterm-equal</code> <i> from SPARQL 1.1.</i>
5983+
</p>
59815984
<pre class="prototype nohighlight">
59825985
<span class="return">xsd:boolean</span> <span class="operator" style="text-transform: none;">sameValue</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>)
59835986
</pre>
@@ -5992,21 +5995,32 @@ <h5>sameValue</h5>
59925995
<p>The result of this function is determined by going through the following steps.</p>
59935996

59945997
<ol>
5995-
<li>If <code>term1</code> and <code>term2</code> are
5998+
<li>
5999+
If <code>term1</code> and <code>term2</code> are
59966000
<a data-cite="RDF12-CONCEPTS#dfn-rdf-term-equality">equal RDF terms</a>,
59976001
then return TRUE.
59986002
</li>
5999-
<li>If <code>term1</code> or <code>term2</code> is an
6003+
<li>
6004+
If <code>term1</code> or <code>term2</code> is an
60006005
<a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a> or a
60016006
<a data-cite="RDF12-CONCEPTS#dfn-blank-node">blank node</a>
60026007
then return FALSE.
6003-
<li>If <code>term1</code> and <code>term2</code> are both
6004-
<a data-cite="RDF12-CONCEPTS#dfn-literal">literals</a>
6005-
and one or both of these literals has a datatype that is
6006-
not handled by the SPARQL processor,
6007-
then produce an [=error=].
60086008
</li>
6009-
<li>If <code>term1</code> and <code>term2</code> are both
6009+
<li>
6010+
If exactly one of <code>term1</code> and <code>term2</code> is a
6011+
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple term</a>,
6012+
then return FALSE.
6013+
</li>
6014+
<li>
6015+
If <code>term1</code> and <code>term2</code> are both
6016+
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple terms</a>,
6017+
apply the function `sameValue` pair-wise to each of the components.
6018+
Return TRUE if each component pair returns TRUE;
6019+
produce an [=error=] if any component pair produces an [=error=];
6020+
otherwise return FALSE.
6021+
</li>
6022+
<li>
6023+
If <code>term1</code> and <code>term2</code> are both
60106024
<a data-cite="RDF12-CONCEPTS#dfn-literal">literals</a>
60116025
and one or both of these literals are known to be
60126026
<a data-cite="RDF12-CONCEPTS#dfn-ill-typed">ill-typed</a>,
@@ -6019,41 +6033,39 @@ <h5>sameValue</h5>
60196033
both "NaN" for either xsd:double or xsd:float, then
60206034
return TRUE.
60216035
</li>
6022-
<li>If <code>term1</code> and <code>term2</code> are both
6036+
<li>
6037+
If <code>term1</code> and <code>term2</code> are both
60236038
<a data-cite="RDF12-CONCEPTS#dfn-literal">literals</a>
6024-
and the SPARQL processor can determine that their the values are equal,
6039+
and the SPARQL processor can determine that their values are equal,
60256040
then return TRUE.
60266041
</li>
6027-
<li>If <code>term1</code> and <code>term2</code> are both
6042+
<li>
6043+
If <code>term1</code> and <code>term2</code> are both
60286044
<a data-cite="RDF12-CONCEPTS#dfn-literal">literals</a>
6029-
and the SPARQL processor can determine the values can not be equal,
6030-
then return FALSE.
6045+
and the SPARQL processor can determine that their values
6046+
are not equal, then return FALSE.
60316047
</li>
60326048
<li>
6033-
If <code>term1</code> and <code>term2</code> are both
6034-
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple terms</a>,
6035-
apply the function `sameValue` pair-wise to each of the components.
6036-
Return TRUE if each component pair returns TRUE;
6037-
produce an [=error=] if any component pair produces an [=error=];
6038-
otherwise return FALSE.
6049+
Otherwise, produce an [=error=].
60396050
</li>
6040-
<li>Otherwise, return FALSE.</li>
60416051
</ol>
6042-
<div id="sameValue-ill-typed" class="note">
6043-
<p>A literal is
6044-
<a data-cite="RDF12-CONCEPTS#dfn-ill-typed">ill-typed</a>
6045-
if its datatype is handled by the SPARQL processor and
6046-
its lexical form is not in the
6047-
<a data-cite="RDF12-CONCEPTS#dfn-lexical-space">lexical space</a>
6048-
of the datatype.
6049-
</p>
6050-
<p>
6051-
If the two arguments are literals, the function `sameValue`
6052-
returns `true` or `false` in cases where the SPARQL processor
6053-
can determine that the values of these literals are equal or are not equal.
6054-
If the SPARQL processor can not be sure, it returns `error`.
6055-
</p>
6056-
</div>
6052+
<p id="sameValue-note" class="note">
6053+
If the two arguments are literals, the function `sameValue`
6054+
returns `true` or `false` in cases where the SPARQL processor
6055+
can determine that the values of these literals are equal or are not equal.
6056+
If the SPARQL processor cannot be sure, it returns `error`.
6057+
</p>
6058+
<p id="sameValue-ill-typed" class="note">
6059+
A literal is
6060+
<a data-cite="RDF12-CONCEPTS#dfn-ill-typed">ill-typed</a>
6061+
if its datatype is handled by the SPARQL processor and
6062+
its lexical form is not in the
6063+
<a data-cite="RDF12-CONCEPTS#dfn-lexical-space">lexical space</a>
6064+
of the datatype.
6065+
</p>
6066+
<p id="sameValue-zeros" class="note">
6067+
For xsd:double and xsd:float, `+0`, `-0` and `0` are same value.
6068+
</p>
60576069
<div id="sameValue-NaN" class="note">
60586070
<p>
60596071
The <a href="#OperatorMapping">Operator Mapping</a> for "`=`"
@@ -6063,24 +6075,17 @@ <h5>sameValue</h5>
60636075
However, `sameTerm("NaN"^^xsd:double, "NaN"^^xsd:double)` is true.
60646076
The function `sameValue` defines `sameValue("NaN"^^xsd:double, "NaN"^^xsd:double)`
60656077
to be true because the arguments are the same element of the value space.
6078+
Similarly, the function `sameValue` defines `sameValue("NaN"^^xsd:float, "NaN"^^xsd:float)`
6079+
to be true.
6080+
60666081
</p>
60676082
<p>
6068-
`sameValue` treats the values of `"NaN"^^xsd:double` and `"NaN"^^xsd:float` as being
6069-
the same. `sameValue("NaN"^^xsd:double, "NaN"^^xsd:float)` is `true`.
6083+
`sameValue` treats the values of `"NaN"^^xsd:double` and `"NaN"^^xsd:float`
6084+
as being the same value.
6085+
`sameValue("NaN"^^xsd:double, "NaN"^^xsd:float)` and
6086+
`sameValue("NaN"^^xsd:float, "NaN"^^xsd:double)` are both `true`.
60706087
</p>
60716088
</div>
6072-
<p id="sameValue-zeros" class="note">
6073-
For xsd:double and xsd:float, `+0`, `-0` and `0` are same value.
6074-
</p>
6075-
<p id="func-sameValue-note1" class="note">
6076-
An extended implementation may support additional datatypes for literals. An
6077-
implementation processing a query that tests for equivalence of literals with non-recognized datatypes
6078-
(and non-identical lexical form and datatype IRI) returns an error, indicating that it
6079-
is unable to determine whether or not the values of the compared literals are equivalent. For example, an
6080-
unextended implementation will produce an error when testing either <span class="queryExcerpt"><code>"iiii"^^my:romanNumeral =
6081-
"iv"^^my:romanNumeral</code></span> or <span class="queryExcerpt"><code>"iiii"^^my:romanNumeral !=
6082-
"iv"^^my:romanNumeral</code></span>.
6083-
</p>
60846089

60856090
<p>Examples:</p>
60866091
<div class="result">
@@ -6109,8 +6114,13 @@ <h5>sameValue</h5>
61096114
</tbody>
61106115
</table>
61116116
</div>
6112-
<p id="sameValue-old-name" class="note">
6113-
This function was called `RDFterm-equal` up until SPARQL 1.1.
6117+
<p id="func-sameValue-note1" class="note">
6118+
An extended implementation may support additional datatypes for literals. An
6119+
implementation processing a query that tests for equivalence of literals with non-recognized datatypes
6120+
(and non-identical lexical form and datatype IRI) returns an error, indicating that it
6121+
is unable to determine whether or not the values of the compared literals are equivalent. For example, an
6122+
unextended implementation will produce an error when testing <span class="queryExcerpt"><code>"iiii"^^my:romanNumeral =
6123+
"iv"^^my:romanNumeral</code></span>.
61146124
</p>
61156125
</section>
61166126

@@ -12796,6 +12806,9 @@ <h2>Changes between SPARQL 1.1 Query Language and SPARQL 1.2 Query Language</h2>
1279612806
<li>Forbid duplicated variables in `VALUES`.</li>
1279712807
<li>Add in-between term type ORDER BY support for triple terms in <a href="#modOrderBy" class="sectionRef"></a>.</li>
1279812808
<li>Fixes the previously informal definition of `EXISTS` by adding a formal definition in <a href="#func-filter-exists" class="sectionRef"></a>, which includes extending the <a href="#defn_eval" class="evalFct">eval</a> function with a solution mapping <var>μ<sub>ctx</sub></var> as third argument.</li>
12809+
<li>Rename function `RDFterm-equal` as <a href="#func-sameValue"></a> and
12810+
expand the definition to cover literal arguments of differing datatypes where the
12811+
values are known to be equal or to be not equal.</li>
1279912812
</ul>
1280012813
</li>
1280112814
<li>
@@ -12847,7 +12860,8 @@ <h2>Changes between SPARQL 1.1 Query Language and SPARQL 1.2 Query Language</h2>
1284712860
<li><a href="https://www.w3.org/2013/sparql-errata#editorial-query-2">editorial-query-2</a>: Missing space in <a href="#defn_algJoin">Join definition</a></li>
1284812861
<li><a href="https://www.w3.org/2013/sparql-errata#editorial-query-3">editorial-query-3</a>: Incorrect link for DELETE DATA in <a href="#grammarBNodes" class="sectionRef"></a></li>
1284912862
<li><a href="https://www.w3.org/2013/sparql-errata#clarification-query-1">clarification-query-1</a>: Fix explanation of IN and NOT IN in <a href="#func-in" class="sectionRef"></a> and <a href="#func-not-in" class="sectionRef"></a></li>
12850-
<li><a href="https://www.w3.org/2013/sparql-errata#clarification-query-2">clarification-query-2</a>: Remove unneeded reference to the semantics above in <a href="#operatorExtensibility" class="sectionRef"></a></li>
12863+
<li><a href="https://www.w3.org/2013/sparql-errata#clarification-query-2">clarification-query-2</a>: Remove unneeded reference to the semantics above in <a href="#operatorExtensibility"
12864+
class="sectionRef"></a></li>
1285112865
<li><a href="https://www.w3.org/2013/sparql-errata#clarification-query-3">clarification-query-3</a>: Rephrase equality definition in <a href="#func-sameValue" class="sectionRef"></a></li>
1285212866
<li><a href="https://www.w3.org/2013/sparql-errata#errata-query-1">errata-query-1</a>: Let V be an empty set instead of empty multiset in <a href="#defn_evalALP">Function ALP definition</a></li>
1285312867
<li><a href="https://www.w3.org/2013/sparql-errata#errata-query-2">errata-query-2</a>: Fix grammar of PropertyListPathNotEmpty in <a href="#grammar" class="sectionRef"></a></li>

0 commit comments

Comments
 (0)