Fwd: Question about inequality semantics

http://www.w3.org/TR/sparql11-query/#OperatorMapping

The last block in the table should be removed:

---------------
SPARQL Tests
A = B	RDF term	RDF term	RDFterm-equal(A, B)
A != B	RDF term	RDF term	fn:not(RDFterm-equal(A, B))	
---------------

It is not right to map unknown datatype comparison by value to sameTerm.

The example Evrin gives below is ('1' != 2) which should either be an 
error (no operator mapping) or false.

An engine can know that the value spaces of xsd:string and xsd:integer 
are disjoint so evaluate the expression to false.

As currently defined, here !=

    fn:not(sameTerm('1',2))

which evaluates to true and is wrong.

	Andy


-------- Original Message --------
Subject: Question about inequality semantics
Date: Mon, 22 Jul 2013 14:55:03 -0400
From: Evren Sirin <evren@clarkparsia.com>
Reply-To: users@jena.apache.org
To: users@jena.apache.org

I'm getting the following result with Jena 2.10.1 against an empty ttl file
(0 bytes):

$ bin/sparql --data empty.ttl "ASK { FILTER ('1' != 2) }"
Ask => Yes

This result seems correct intuitively but if I'm reading the SPARQL spec
right the answer should be false.

According to Section 17.4 operator mapping [1], when we have a simple
literal and a numeric literal the != will be mapped to
fn:not(RDFterm-equal(A, B)). The definition of RDFterm-equal [2] says it
"produces a type error if the arguments are both literal but are not the
same RDF term" which is the case here. Section 17.4 also says "Note that
per the XPath definitions, fn:not and op:numeric-equal produce an error if
their argument is an error." Then fn:not(RDFterm-equal('1', 2)) would
produce a type error. If there is a type error, the filter would return
false and the above query should return false too.

I was looking at the DAWG test suite to check if my understanding is
correct but the only relevant test I found (:eq-2-2 in expr-equals manifest
[3]) had a typo and was pointing to the wrong query file (eq-2-1 instead of
eq-2-2).

Is this a bug in ARQ? Or am I misinterpreting the spec?

Thanks,
Evren

[1] http://www.w3.org/TR/2012/PR-sparql11-query-20121108/#OperatorMapping
[2] http://www.w3.org/TR/2012/PR-sparql11-query-20121108/#func-RDFterm-equal
[3]
http://www.w3.org/2001/sw/DataAccess/tests/data-r2/expr-equals/manifest.ttl

Received on Tuesday, 23 July 2013 10:39:35 UTC