Re: Comparing with <=

Lee Feigenbaum wrote:
...
> + <= on equivalent RDF terms with unknown datatypes in 
> open-world/open-cmp-02 (issue for EricP / AndyS ?)

A datatype includes a function from lexical space to value space.  Because 
it's a function, for two literals, if sameTerm(x,y), then the lexical forms 
are the same so if they are legal for the datatype, then x has the same value 
as y.  This is regardless of whether a datatype is know to the SPARQL 
processor or not.

Intuitively, "x = y" implies "x <= y"

open-cmp-02.rq is the query
--------
PREFIX      :    <http://example/>
PREFIX  xsd:    <http://www.w3.org/2001/XMLSchema#>

SELECT ?x ?v1 ?v2
{
     ?x :p [ :v1 ?v1 ; :v2 ?v2 ] .
     FILTER ( ?v1 <= ?v2 || ?v1 > ?v2 )
}
--------

In the operators table, <= is defined for various pairs of types but only for 
known types.

XPath/XQuery defines <= (called "le") as fn:not( the > operator ) for each type.

But in SPARQL things are open : can have partial extended types implemented 
(e.g. value based "=", not all of "<").

Possibilities:

1/ Test change

Change the test from:
     FILTER ( ?v1 <= ?v2 || ?v1 > ?v2 )
to:
     FILTER ( ?v1 = ?v2 || ?v1 < ?v2 || ?v1 > ?v2 )

This is splits up the <= which is a bit ugly IMHO.

2/ Spec change

Define "A <= B" to be  "A = B || A < B" (this needs only doing once).
Define "A => B" to be  "A = B || A > B" (this needs only doing once).

Then define A < B and A > B as before.

A type error situation becomes legal in an unextended implementation 
("x"^^:unknown <= "x"^^:unknown ) which is what the test says.

Another point: people have been reporting not failing the test so either they 
pass it, or don't run because xsd:date is not supported.  So the test change 
is potentially more work.

 Andy

-- 
Hewlett-Packard Limited
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
Registered No: 690597 England

Received on Friday, 31 August 2007 14:48:43 UTC