1 file changed
+126
-102
lines changedLines changed: 126 additions & 102 deletions
Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
243 | 243 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
244 | 244 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
245 | 245 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
246 |
| - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
247 |
| - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
248 | 247 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
249 | 248 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
250 | 249 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4665 | 4664 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4666 | 4665 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4667 | 4666 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4667 | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4668 | 4668 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4669 | 4669 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4670 | 4670 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4826 | 4826 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4827 | 4827 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4828 | 4828 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4829 | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4829 | 4830 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4830 | 4831 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4831 | 4832 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4925 | 4926 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4926 | 4927 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4927 | 4928 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5277 | 5278 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5287 | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5296 | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5307 | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5314 | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5323 | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5334 | + | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5288 | 5343 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5299 | 5352 |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5300 | 5353 |
|
5301
- xsd:boolean function arguments marked with "(EBV)" are
5354
+
5355
+ xsd:boolean function arguments marked with "(EBV)" are
5302
5356
coerced to xsd:boolean by evaluating the effective boolean value of that
5303
5357
argument.
5358
+
5359
+
5360
+ Operators = and != applied to
5361
+
5362
+ apply the operator to each of the components.
5363
+
5304
5364
5305
5365
Operator Extensibility
5306
5366
SPARQL language extensions may provide additional associations between operators and
@@ -5314,6 +5374,7 @@ Operator Extensibility
5314
5374
BY clause.
5315
5375
5316
5376
5377
+
5317
5378
5318
5379
Function Definitions
5319
5380
This section defines the operators and functions introduced by the SPARQL query language.
@@ -5678,7 +5739,7 @@ sameTerm
5678
5739
defined in [[[RDF12-CONCEPTS]]] [[RDF12-CONCEPTS]]; returns FALSE otherwise.
5679
5740
5680
5741
|term1| and |term2| are the
5681
-
5742
+
5682
5743
if one of the following is true:
5683
5744
5684
5745
@@ -5756,77 +5817,61 @@ sameValue
5756
5817
5757
5818
This function cannot be used directly in expressions. The purpose
5758
5819
of this function is to define the semantics of the "=" operator when applied to
5759
- two RDF terms that do not fall into any of the other, more concrete cases
5820
+ two RDF terms that do not fall into the concrete cases
5760
5821
covered in the operator mapping table in Section
5761
5822
5762
5823
5763
5824
5764
-
5765
- Revise for triple terms.
5766
-
5767
- Consider adding non-literal `=` to operator mapping table.
5768
-
5769
-
5770
5825
The result of this function is determined by going through the following steps.
5826
+
5771
5827
5772
5828
If term1
and term2
are
5773
5829
5774
- the return TRUE.
5830
+ then return TRUE.
5775
5831
5776
- If both arguments are literals,
5832
+ If term1
or term2
is an
5833
+ IRI or a
5834
+
5835
+ then return FALSE.
5836
+ If term1
and term2
are both
5777
5837
5778
- and one or both arguments are known to be ill-typed,
5838
+ and one or both of these literals has a datatype that is
5839
+ not handled by the SPARQL processor,
5779
5840
then produce a type error.
5780
5841
5781
- If term1
and term2
both
5842
+ If term1
and term2
are both
5843
+
5844
+ and one or both of these literals are known to be
5845
+
5846
+ then produce a type error.
5847
+
5848
+
5849
+ `"NaN"^^xsd:double` and `"NaN"^^xsd:float` are considered to
5850
+ represent the same value.
5851
+ If term1
and term2
are
5852
+ both "NaN" for either xsd:double or xsd:float, then
5853
+ return TRUE.
5854
+
5855
+ If term1
and term2
are both
5782
5856
5783
- and the SPARQL processor can determine the values are equal,
5857
+ and the SPARQL processor can determine that their the values are equal,
5784
5858
then return TRUE.
5785
5859
5786
- If term1
and term2
both
5860
+ If term1
and term2
are both
5787
5861
5788
5862
and the SPARQL processor can determine the values can not be equal,
5789
5863
then return FALSE.
5790
5864
5791
- Otherwise, return FALSE.
5865
+
5866
+ If term1
and term2
are both
5867
+
5868
+ apply the function `sameValue` pair-wise to each of the components.
5869
+ Return TRUE if each component pair returns TRUE;
5870
+ produce a type error if any component pair produces an error;
5871
+ otherwise return FALSE.
5792
5872
5873
+ Otherwise, return FALSE.
5793
5874
5794
-
5795
-
5796
- The treatment of `NaN` can not be consistent with both "same term means same value"
5797
- and "`fn:numeric-equal(NaN, NaN)` is false". So it is an arbitrary choice with
5798
- arguments for all three possible choices.
5799
- For pattern matching, `"NaN"^^xsd:double` must match itself and
5800
- `"NaN"^^xsd:double` does not pattern match `"NaN"^^xsd:float`.
5801
-
5802
-
5803
- The operator mapping for `=` goes to `fn:numeric-compare` which is false.
5804
- The `sameValue` result could be made an error (or false) as a special case.
5805
-
5806
-
5807
- `"NaN"^^xsd:double = "NaN"^^xsd:float` is also handled by the
5808
- operator mapping and is false – `xsd:float` is promoted to `xsd:double`.
5809
- A reading of IEEE 754 is that `"NaN"^^xsd:double` and `"NaN"^^xsd:float`
5810
- are the same term also suggests that `sameValue` is true.
5811
-
5812
-
5813
- Proposal 1: follow "sameTerm means sameValue" and `sameValue("NaN"^^xsd:double, "NaN"^^xsd:double)`
5814
- and `sameValue("NaN"^^xsd:float, "NaN"^^xsd:float)` are trues.
5815
-
5816
- Proposal 2:
5817
- follow "there is one NaN" so `sameValue("NaN"^^xsd:double, "NaN"^^xsd:float)` is true.
5818
-
5819
-
5820
-
5821
- "are members of the datatype's ·value space·. ". It is not clear whether "special value" literals
5822
- added to the value spaces of `xsd:double` and `xsd:float` are "the same" literals.
5823
-
5824
-
5825
- IEEE 754 specifies a special value called "Not a Number" (NaN).
5826
- suggests they are the same.
5827
-
5828
-
5829
-
5830
5875
5831
5876
A literal is
5832
5877
@@ -5847,31 +5892,19 @@ sameValue
5847
5892
The Operator Mapping for "`=`"
5848
5893
is the function
5849
5894
5850
- which returns `false` when comparing arguments involving `NaN`.
5851
- However, `sameTerm("NaN"^^xsd:double, "NaN"^^xsd:double)` is true;
5852
- `sameValue` treats "NaN" as the "same value".
5853
- `sameTerm("NaN"^^xsd:double, "NaN"^^xsd:float)` is `true`.
5895
+ which is defined to return `false` when comparing arguments involving `NaN`.
5896
+ However, `sameTerm("NaN"^^xsd:double, "NaN"^^xsd:double)` is true.
5897
+ The function `sameValue` defines `sameValue("NaN"^^xsd:double, "NaN"^^xsd:double)`
5898
+ to be true because the arguments are the same element of the value space.
5854
5899
5855
-
5856
-
5857
- This function was previously called `RDFterm-equal`.
5858
-
5859
-
5860
-
5861
5900
5862
- A SPARQL processor may support datatypes beyond those required.
5863
- Suppose `ex:romanNumeral` is the datatype IRI
5864
-
5865
- which are integer numbers. The SPARQL processor may then be able
5866
- to detemine if two literals have the same value, for example,
5867
- `sameValue(4, "IV"^^ex:romanNumeral)` can then return `true`
5868
- because argument bot represent the value 4.
5869
- For `sameValue("abc"^^xsd:string, "IV"^^ex:romanNumeral)`
5870
- can return `false` because `xsd:string` and `ex:romanNumeral`
5871
- have different value spaces so the arguments can not be the same value.
5901
+ `sameValue` treats the values of `"NaN"^^xsd:double` and `"NaN"^^xsd:float` as being
5902
+ the same. `sameValue("NaN"^^xsd:double, "NaN"^^xsd:float)` is `true`.
5872
5903
5873
5904
5874
-
5905
+
5906
+ For xsd:double and xsd:float, `+0`, `-0` and `0` are same value.
5907
+
5875
5908
5876
5909
An extended implementation may support additional datatypes for literals. An
5877
5910
implementation processing a query that tests for equivalence of literals with non-recognized datatypes
@@ -5890,22 +5923,6 @@ sameValue
5890
5923
sameValue
5891
5924
Results
5892
5925
5893
- 5894
- sameValue(2, +2)
5895
- true
5896
-
5897
- 5898
- sameValue(2.0, 2)
5899
- true
5900
-
5901
- 5902
- sameValue(2, "2")
5903
- false
5904
-
5905
- 5906
- sameValue(4, "iv"^^my:romanNumeral)
5907
- error, or true by extension
5908
-
5909
5926
5910
5927
sameValue(1e10, "NaN"^^xsd:double)
5911
5928
false
@@ -5918,9 +5935,16 @@ sameValue
5918
5935
sameValue("NaN"^^xsd:double, "NaN"^^xsd:float)
5919
5936
true
5920
5937
5938
+
5939
+ sameValue( <<(:s :p 123)>> , <<(:s :p 123.0)>> )
5940
+ true
5941
+
5921
5942
5922
5943
5923
5944
5945
+
5946
+ This function was called `RDFterm-equal` up until SPARQL 1.1.
5947
+
5924
5948
5925
5949
5926
5950
0 commit comments