Issue with sparql-compare semantics and ORDER BY
Closed this issue · 0 comments
SPARQL 15.1 says:
The "<" operator (see the Operator Mapping and 17.3.1 Operator Extensibility) defines the relative order of pairs of numerics, simple literals, xsd:strings, xsd:booleans and xsd:dateTimes. Pairs of IRIs are ordered by comparing them as simple literals.
This suggests that the <
operator does not handle IRIs, even within ORDER BY handling. The ordering of IRIs is handled as a special case in evaluating OrderBy
.
But RDF-star 4.4.11 Triple terms with ORDER BY says:
RDF-star triple terms are compared using the
<
operator.
RDF-star 4.4.10 adds an entry to the operator mappings for RDF triple terms:
A < B
RDF triple term
RDF triple term
op:numeric-equal(sparql-compare(A, B), -1)
xsd:boolean
and RDF-star 4.4.8 sparql-compare is defined recursively with:
- non-triple terms are compared "by SPARQL 1.1 operators
<
,=
,>
" - "If
sparql-compare(SUBJECT(A), SUBJECT(B)) != 0
, then return this value" (and similarly for predicate and object)
I think these things combined suggest that when evaluating an ORDER BY
, IRIs that are contained within RDF-star triple terms are not comparable (but that they are intended to be).
I believe the sparql-star-order-2 test relies on the intended semantics here, but fails as written.
I think the definitions need to be updated to allow the special IRI comparability introduced in SPARQL 15.1 to apply to the non-triple term rule in sparql-compare when evaluating within the context of an OrderBy operator.