diff --git a/spec/index.html b/spec/index.html index 3eabcac0..02de2ab4 100644 --- a/spec/index.html +++ b/spec/index.html @@ -3674,7 +3674,7 @@

ORDER BY

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 @@

ORDER BY

  • Blank nodes
  • IRIs
  • RDF literals
  • +
  • Triple terms
  • 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:

    @@ -5418,9 +5419,7 @@

    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 +5444,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 +5466,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 +

    @@ -5476,11 +5509,6 @@

    Operator Mapping

    coerced to xsd:boolean by evaluating the effective boolean value of that argument.

    -

    - Operators = and != applied to - triple terms - apply the operator to each of the components. -

    Operator Extensibility

    SPARQL language extensions may provide additional associations between operators and @@ -6084,6 +6112,68 @@

    sameValue

    +
    +
    compareTripleTerm
    +
    +              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 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. + 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.

    + +
      +
    1. If 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. +
    2. +
    3. If 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. +
    4. +
    5. If 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. +
    6. +
    + +

    Examples:

    +
    + + + + + + + + + + + + + + + + + + + +
    compareTripleTermResults
    compareTripleTerm(<<(:s :p :o)>>, <<(:s :p :o)>>)0
    compareTripleTerm(<<(:s :p 123)>>, <<(:s :p 124)>>)-1
    compareTripleTerm(<<(:s :p 123)>>, <<(:s :p 122)>>)1
    +
    +
    +
    isIRI