Skip to content

Commit 6cf13ac

Browse files
committed
Revisions based on PR review
1 parent 8c76436 commit 6cf13ac

File tree

1 file changed

+37
-83
lines changed

1 file changed

+37
-83
lines changed

spec/index.html

+37-83
Original file line numberDiff line numberDiff line change
@@ -5739,7 +5739,7 @@ <h5>sameTerm</h5>
57395739
defined in [[[RDF12-CONCEPTS]]] [[RDF12-CONCEPTS]]; returns FALSE otherwise.</p>
57405740
<p>
57415741
|term1| and |term2| are the
5742-
<a data-cite="RDF12-CONCEPTS#dfn-rdf-term-equality">same RDF terms</a>
5742+
<a data-cite="RDF12-CONCEPTS#dfn-rdf-term-equality">same RDF term</a>
57435743
if one of the following is true:
57445744
</p>
57455745
<ul>
@@ -5822,72 +5822,50 @@ <h5>sameValue</h5>
58225822
<a href="#OperatorMapping" class="sectionRef"></a>.
58235823
</p>
58245824

5825-
<p class="ednote" style="background-color: #EEE">
5826-
Revise for triple terms.
5827-
<br/>
5828-
Consider adding non-literal `=` to operator mapping table.
5829-
</p>
5830-
58315825
<p>The result of this function is determined by going through the following steps.</p>
5826+
58325827
<ol>
58335828
<li>If <code>term1</code> and <code>term2</code> are
58345829
<a data-cite="RDF12-CONCEPTS#dfn-rdf-term-equality">equal RDF terms</a>,
5835-
the return TRUE.
5830+
then return TRUE.
58365831
</li>
5837-
<li>If both arguments are literals,
5832+
<li>If <code>term1</code> and <code>term2</code> are both
58385833
<a data-cite="RDF12-CONCEPTS#dfn-literal">literals</a>
5839-
and one or both arguments are known to be ill-typed,
5834+
and one or both of these literals are known to be
5835+
<a data-cite="RDF12-CONCEPTS#dfn-ill-typed">ill-typed</a>,
58405836
then produce a type error.
58415837
</li>
5842-
<li>If <code>term1</code> and <code>term2</code> both
5838+
<li>
5839+
"NaN"^^xsd:double and "NaN"^^xsd:float are considered to
5840+
represent the same value.
5841+
If <code>term1</code> and <code>term2</code> are
5842+
both "NaN" for either xsd:double or xsd:float then
5843+
return TRUE.
5844+
</li>
5845+
<li>
5846+
For xsd:double and xsd:float, `+0`, `-0` and `0` are same value.
5847+
If <code>term1</code> and <code>term2</code> each
5848+
have datatype IRI xsd:double or xsd:float and
5849+
a lexical form of one of these zeros, then return TRUE.
5850+
</li>
5851+
<li>If <code>term1</code> and <code>term2</code> are both
58435852
<a data-cite="RDF12-CONCEPTS#dfn-literal">literals</a>
5844-
and the SPARQL processor can determine the values are equal,
5853+
and the SPARQL processor can determine that their the values are equal,
58455854
then return TRUE.
58465855
</li>
5847-
<li>If <code>term1</code> and <code>term2</code> both
5856+
<li>If <code>term1</code> and <code>term2</code> are both
58485857
<a data-cite="RDF12-CONCEPTS#dfn-literal">literals</a>
58495858
and the SPARQL processor can determine the values can not be equal,
58505859
then return FALSE.
58515860
</li>
5852-
<li>Otherwise, return FALSE.
5861+
<li>
5862+
If <code>term1</code> and <code>term2</code> are both
5863+
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple terms</a>,
5864+
apply the function `sameValue` pair-wise to each of the components.
5865+
Return TRUE if each component pair returns TRUE, otherise return FALSE.
58535866
</li>
5867+
<li>Otherwise, return FALSE.</li>
58545868
</ol>
5855-
<div class="ednote" style="background-color: #EEE">
5856-
<p>
5857-
The treatment of `NaN` can not be consistent with both "same term means same value"
5858-
and "`fn:numeric-equal(NaN, NaN)` is false". So it is an arbitrary choice with
5859-
arguments for all three possible choices.
5860-
For pattern matching, `"NaN"^^xsd:double` must match itself and
5861-
`"NaN"^^xsd:double` does not pattern match `"NaN"^^xsd:float`.
5862-
</p>
5863-
<p>
5864-
The operator mapping for `=` goes to `fn:numeric-compare` which is false.
5865-
The `sameValue` result could be made an error (or false) as a special case.
5866-
</p>
5867-
<p>
5868-
`"NaN"^^xsd:double = "NaN"^^xsd:float` is also handled by the
5869-
operator mapping and is false &ndash; `xsd:float` is promoted to `xsd:double`.
5870-
A reading of IEEE 754 is that `"NaN"^^xsd:double` and `"NaN"^^xsd:float`
5871-
are the same term also suggests that `sameValue` is true.
5872-
</p>
5873-
<p>
5874-
<b>Proposal 1</b>: follow "sameTerm means sameValue" and `sameValue("NaN"^^xsd:double, "NaN"^^xsd:double)`
5875-
and `sameValue("NaN"^^xsd:float, "NaN"^^xsd:float)` are <i>true</i>s.
5876-
<br/>
5877-
<b>Proposal 2</b>:
5878-
follow "there is one NaN" so `sameValue("NaN"^^xsd:double, "NaN"^^xsd:float)` is <i>true</i>.
5879-
</p>
5880-
<p>
5881-
Ref</i>: <a href="https://www.w3.org/TR/xmlschema11-2/#dt-specialvalue">XSD schema 1.1 special values</a>
5882-
"are members of the datatype's ·value space·. ". It is not clear whether "special value" literals
5883-
added to the value spaces of `xsd:double` and `xsd:float` are "the same" literals.
5884-
<p>
5885-
<i>Ref</i>: <a href="https://en.wikipedia.org/wiki/IEEE_754#Special_values">(wikipedia) IEEE_754 Special Values</a>
5886-
<i>IEEE 754 specifies a special value called "Not a Number" (NaN)</i>.
5887-
suggests they are the same.
5888-
</p>
5889-
</div>
5890-
58915869
<div id="sameValue-ill-typed" class="note">
58925870
<p>A literal is
58935871
<a data-cite="RDF12-CONCEPTS#dfn-ill-typed">ill-typed</a>
@@ -5910,29 +5888,17 @@ <h5>sameValue</h5>
59105888
<a data-cite="XPATH-FUNCTIONS-31#func-numeric-equal">`fn:numeric-equal`</a>
59115889
which returns `false` when comparing arguments involving `NaN`.
59125890
However, `sameTerm("NaN"^^xsd:double, "NaN"^^xsd:double)` is true;
5913-
`sameValue` treats "NaN" as the "same value".
5891+
`sameValue` treats "NaN"^^xsd:double as the "same value".
5892+
</p>
5893+
<p>
5894+
5895+
`sameValue` treats "NaN"^^xsd:double and "NaN"^^xsd:float as the same value.
59145896
`sameTerm("NaN"^^xsd:double, "NaN"^^xsd:float)` is `true`.
59155897
</p>
59165898
</div>
59175899
<div id="sameValue-old-name" class="note">
59185900
<p>This function was previously called `RDFterm-equal`.</p>
59195901
</div>
5920-
5921-
<div class="ednote" style="background-color: #EEE">
5922-
<p>
5923-
A SPARQL processor may support datatypes beyond those required.
5924-
Suppose `ex:romanNumeral` is the datatype IRI
5925-
<a href="https://en.wikipedia.org/wiki/Roman_numerals">roman numerals</a>
5926-
which are integer numbers. The SPARQL processor may then be able
5927-
to detemine if two literals have the same value, for example,
5928-
`sameValue(4, "IV"^^ex:romanNumeral)` can then return `true`
5929-
because argument bot represent the value 4.
5930-
For `sameValue("abc"^^xsd:string, "IV"^^ex:romanNumeral)`
5931-
can return `false` because `xsd:string` and `ex:romanNumeral`
5932-
have different value spaces so the arguments can not be the same value.
5933-
</p>
5934-
</div>
5935-
59365902
<p id="func-sameValue-note1" class="note">
59375903
An extended implementation may support additional datatypes for literals. An
59385904
implementation processing a query that tests for equivalence of literals with non-recognized datatypes
@@ -5951,22 +5917,6 @@ <h5>sameValue</h5>
59515917
<th>sameValue</th>
59525918
<th>Results</th>
59535919
</tr>
5954-
<tr>
5955-
<td><code>sameValue(2, +2)</code></td>
5956-
<td>true</td>
5957-
</tr>
5958-
<tr>
5959-
<td><code>sameValue(2.0, 2)</code></td>
5960-
<td>true</td>
5961-
</tr>
5962-
<tr>
5963-
<td><code>sameValue(2, "2")</code></td>
5964-
<td>false</td>
5965-
</tr>
5966-
<tr>
5967-
<td><code>sameValue(4, "iv"^^my:romanNumeral)</code></td>
5968-
<td>error, or true by extension</td>
5969-
</tr>
59705920
<tr>
59715921
<td><code>sameValue(1e10, "NaN"^^xsd:double)</code></td>
59725922
<td>false</td>
@@ -5979,6 +5929,10 @@ <h5>sameValue</h5>
59795929
<td><code>sameValue("NaN"^^xsd:double, "NaN"^^xsd:float)</code></td>
59805930
<td>true</td>
59815931
</tr>
5932+
<tr>
5933+
<td><code>sameValue( &lt;&lt(:s :p 123)&gt;&gt , &lt;&lt(:s :p 123.0)&gt;&gt )</td>
5934+
<td>true</td>
5935+
</tr>
59825936
</tbody>
59835937
</table>
59845938
</div>

0 commit comments

Comments
 (0)