From 5603a21657cb589cea0cc7c1c7ec377ee338d59a Mon Sep 17 00:00:00 2001
From: Ruben Taelman
@@ -6084,6 +6116,66 @@ Operator Mapping
Triple Term
Triple Term
- ( A.subject = B.subject ) &&
- ( A.predicate = B.predicate ) &&
- ( A.object = B.object )
+ op:numeric-equal(compareTripleTerm(A, B), 0)
xsd:boolean
@@ -5445,9 +5443,7 @@ Operator Mapping
Triple Term
Triple Term
- ( A.subject != B.subject ) ||
- ( A.predicate != B.predicate ) ||
- ( A.object != B.object )
+ fn:not(op:numeric-equal(compareTripleTerm(A, B), 0))
xsd:boolean
@@ -5469,6 +5465,42 @@ Operator Mapping
xsd:boolean
+
+
+ A < B
+ Triple Term
+ Triple Term
+
+ op:numeric-equal(compareTripleTerm(A, B), -1)
+
+ xsd:boolean
+
+
+ A <= B
+ Triple Term
+ Triple Term
+
+ fn:not(op:numeric-equal(compareTripleTerm(A, B), 1))
+
+ xsd:boolean
+
+
+ A > B
+ Triple Term
+ Triple Term
+
+ op:numeric-equal(compareTripleTerm(A, B), 1)
+
+ xsd:boolean
+
+
A >= B
+ Triple Term
+ Triple Term
+
+ fn:not(op:numeric-equal(compareTripleTerm(A, B), -1))
+
+ xsd:boolean
+ sameValue
+ xsd:integer compareTripleTerm (Triple term term1, Triple term term2) ++ +
This function cannot be used directly in expressions. The purpose + of this function is to define the semantics of value-comparison operators on Triple Terms such as "=" and "<" operator + in Section . +
+ +This function returns -1, 0, 1, or throws an error. + Comparison is performed pairwise on the components of the triple terms in the order subject, predicate, object until the result is determined. + An error is thrown if comparing two components results in an error.
+ +The result of this function is determined by going through the following steps.
+ +SUBJECT(A) = SUBJECT(B)
evaluates to true, go to the next step.
+ If SUBJECT(A) < SUBJECT(B)
evaluates to true, return -1.
+ If SUBJECT(A) > SUBJECT(B)
evaluates to true, return 1.
+ If any of the evalutions cause an error, raise an error.
+ PREDICATE(A) = PREDICATE(B)
evaluates to true, go to the next step.
+ If PREDICATE(A) < PREDICATE(B)
evaluates to true, return -1.
+ If PREDICATE(A) > PREDICATE(B)
evaluates to true, return 1.
+ If any of the evalutions cause an error, raise an error.
+ OBJECT(A) = OBJECT(B)
evaluates to true, return 0.
+ If OBJECT(A) < OBJECT(B)
evaluates to true, return -1.
+ If OBJECT(A) > OBJECT(B)
evaluates to true, return 1.
+ If any of the evalutions cause an error, raise an error.
+ Examples:
+compareTripleTerm | +Results | +
---|---|
compareTripleTerm(<<(:s :p :o)>>, <<(:s :p :o)>>) |
+ 0 | +
compareTripleTerm(<<(:s :p 123)>>, <<(:s :p 124)>>) |
+ -1 | +
compareTripleTerm(<<(:s :p 123)>>, <<(:s :p 122)>>) |
+ 1 | +
The "<" operator (see the Operator
Mapping and 17.3.1 Operator Extensibility) defines
the relative order of pairs of numerics
,
- xsd:strings
, xsd:booleans
and xsd:dateTimes
. Pairs of
+ xsd:strings
, xsd:booleans
, xsd:dateTimes
, and Triple Terms. Pairs of
IRIs are ordered by comparing them as literals with datatype xsd:string
.
SPARQL also fixes an order between some kinds of RDF terms that would not otherwise be ordered:
@@ -3683,6 +3683,7 @@SPARQL does not define a total ordering of all possible RDF terms. Here are a few examples of pairs of terms for which the relative order is undefined:
From 7213f877799df4eeb5efda5445e59ca93d7f7af6 Mon Sep 17 00:00:00 2001 From: Ruben TaelmanThis function cannot be used directly in expressions. The purpose - of this function is to define the semantics of value-comparison operators on Triple Terms such as "=" and "<" operator - in Section . + of this function is to define the semantics of comparison operators, + such as "=" and "<", + for the case of comparing Triple Terms. + The function is used in Section .
This function returns -1, 0, 1, or throws an error. @@ -6138,17 +6140,17 @@
SUBJECT(A) = SUBJECT(B)
evaluates to true, go to the next step.
If SUBJECT(A) < SUBJECT(B)
evaluates to true, return -1.
If SUBJECT(A) > SUBJECT(B)
evaluates to true, return 1.
- If any of the evalutions cause an error, raise an error.
+ If any of the evaluations causes an error, raise an error.
PREDICATE(A) = PREDICATE(B)
evaluates to true, go to the next step.
If PREDICATE(A) < PREDICATE(B)
evaluates to true, return -1.
If PREDICATE(A) > PREDICATE(B)
evaluates to true, return 1.
- If any of the evalutions cause an error, raise an error.
+ If any of the evaluations causes an error, raise an error.
OBJECT(A) = OBJECT(B)
evaluates to true, return 0.
If OBJECT(A) < OBJECT(B)
evaluates to true, return -1.
If OBJECT(A) > OBJECT(B)
evaluates to true, return 1.
- If any of the evalutions cause an error, raise an error.
+ If any of the evaluations causes an error, raise an error.
The result of this function is determined by going through the following steps.
SUBJECT(A) = SUBJECT(B)
evaluates to true, go to the next step.
- If SUBJECT(A) < SUBJECT(B)
evaluates to true, return -1.
- If SUBJECT(A) > SUBJECT(B)
evaluates to true, return 1.
+ SUBJECT(A) = SUBJECT(B)
evaluates to true, go to the next step.
+ If SUBJECT(A) < SUBJECT(B)
evaluates to true, return -1.
+ If SUBJECT(A) > SUBJECT(B)
evaluates to true, return 1.
If any of the evaluations causes an error, raise an error.
PREDICATE(A) = PREDICATE(B)
evaluates to true, go to the next step.
- If PREDICATE(A) < PREDICATE(B)
evaluates to true, return -1.
- If PREDICATE(A) > PREDICATE(B)
evaluates to true, return 1.
+ PREDICATE(A) = PREDICATE(B)
evaluates to true, go to the next step.
+ If PREDICATE(A) < PREDICATE(B)
evaluates to true, return -1.
+ If PREDICATE(A) > PREDICATE(B)
evaluates to true, return 1.
If any of the evaluations causes an error, raise an error.
OBJECT(A) = OBJECT(B)
evaluates to true, return 0.
- If OBJECT(A) < OBJECT(B)
evaluates to true, return -1.
- If OBJECT(A) > OBJECT(B)
evaluates to true, return 1.
+ OBJECT(A) = OBJECT(B)
evaluates to true, return 0.
+ If OBJECT(A) < OBJECT(B)
evaluates to true, return -1.
+ If OBJECT(A) > OBJECT(B)
evaluates to true, return 1.
If any of the evaluations causes an error, raise an error.
- Operators = and != applied to - triple terms - apply the operator to each of the components. -
SPARQL language extensions may provide additional associations between operators and
From def10d9a0f8db2497e3b0972fb4945116e2e4c66 Mon Sep 17 00:00:00 2001
From: Ruben Taelman The result of this function is determined by going through the following steps. The result of this function is determined by going through the following steps.compareTripleTerm
-
From bf53dac9b0cf6d623fad068b9b926f3de1865ff0 Mon Sep 17 00:00:00 2001
From: Ruben Taelman SUBJECT(A) = SUBJECT(B)
evaluates to true, go to the next step.
- If SUBJECT(A) < SUBJECT(B)
evaluates to true, return -1.
- If SUBJECT(A) > SUBJECT(B)
evaluates to true, return 1.
+ SUBJECT(term1) = SUBJECT(term2)
evaluates to true, go to the next step.
+ If SUBJECT(term1) < SUBJECT(term2)
evaluates to true, return -1.
+ If SUBJECT(term1) > SUBJECT(term2)
evaluates to true, return 1.
If any of the evaluations causes an error, raise an error.
PREDICATE(A) = PREDICATE(B)
evaluates to true, go to the next step.
- If PREDICATE(A) < PREDICATE(B)
evaluates to true, return -1.
- If PREDICATE(A) > PREDICATE(B)
evaluates to true, return 1.
+ PREDICATE(term1) = PREDICATE(term2)
evaluates to true, go to the next step.
+ If PREDICATE(term1) < PREDICATE(term2)
evaluates to true, return -1.
+ If PREDICATE(term1) > PREDICATE(term2)
evaluates to true, return 1.
If any of the evaluations causes an error, raise an error.
OBJECT(A) = OBJECT(B)
evaluates to true, return 0.
- If OBJECT(A) < OBJECT(B)
evaluates to true, return -1.
- If OBJECT(A) > OBJECT(B)
evaluates to true, return 1.
+ OBJECT(term1) = OBJECT(term2)
evaluates to true, return 0.
+ If OBJECT(term1) < OBJECT(term2)
evaluates to true, return -1.
+ If OBJECT(term1) > OBJECT(term2)
evaluates to true, return 1.
If any of the evaluations causes an error, raise an error.
compareTripleTerm
-
SUBJECT(term1) = SUBJECT(term2)
evaluates to true, go to the next step.
+ SUBJECT(term1) = SUBJECT(term2)
evaluates to true, go to step 2.
If SUBJECT(term1) < SUBJECT(term2)
evaluates to true, return -1.
If SUBJECT(term1) > SUBJECT(term2)
evaluates to true, return 1.
If any of the evaluations causes an error, raise an error.
PREDICATE(term1) = PREDICATE(term2)
evaluates to true, go to the next step.
+ PREDICATE(term1) = PREDICATE(term2)
evaluates to true, go to step 3.
If PREDICATE(term1) < PREDICATE(term2)
evaluates to true, return -1.
If PREDICATE(term1) > PREDICATE(term2)
evaluates to true, return 1.
If any of the evaluations causes an error, raise an error.