- From: Eric Prud'hommeaux <eric@w3.org>
- Date: Thu, 7 Dec 2006 08:19:50 -0500
- To: public-rdf-dawg@w3.org
- Message-ID: <20061207131949.GE29063@w3.org>
On Tue, Dec 05, 2006 at 05:06:36PM +0100, Olivier.Corby@sophia.inria.fr wrote:
>
> A question concerning the mapping between the = operator and the
> appropriate operator function according to the operands.
>
> The table "11.3 Operator Mapping" lists numeric, boolean and dateTime as
> possible operands for which there is an appropriate function for the =
> operator (e.g. op:numeric-equal, etc.). Otherwise, the RDFterm-equal
> function applies. So, according to this formulation, string and plain
> literal operands are processed by the RDFterm-equal function.
>
> But the RDFterm-equal function "produces a type error if the arguments
> are both literal but are not the same RDF term". So comparing non equal
> strings or plain literals would produce a type error, and so would !=
> produce a type error which is in contradiction with "11.4.10
> RDFterm-equal" example.
True, and I believe this happened because we originally had different
semantics for RDFterm-equal, where it would give a FALSE where it now
gives a type error. At that time, the selection of = overloads was
limited to those functions that could not be considered != simnply
because the lexical form differed. (1.0=1.00, 1=TRUE,
20061207T07:53+600=20061207T13:53) With our new-fangled closed-world
semantics, we need to have a complete set of the supported literal
types that we can know to be != by differing lexical value.
PROPOSED: add:
A = B simple literal simple literal
op:numeric-equal(fn:compare(A, B), 0)
A = B xsd:string xsd:string
op:numeric-equal(fn:compare(STR(A), STR(B)), 0)
A != B simple literal simple literal
fn:not(op:numeric-equal(fn:compare(A, B), 0))
A != B xsd:string xsd:string
fn:not(op:numeric-equal(fn:compare(STR(A), STR(B)), 0))
Note, the mappings for = and != will then reflect those for <= and >=.
PROPOSED: change the example to use an unknown datatype:
DATA:
@prefix a: <http://www.w3.org/2000/10/annotation-ns#> .
@prefix my: <http://example.org/colorStuff#> .
_:b a:annotates <http://www.w3.org/TR/rdf-sparql-query/> .
_:b my:color "red"^^my:colorName .
QUERY:
PREFIX a: <http://www.w3.org/2000/10/annotation-ns#>
PREFIX clr: <http://example.org/colorStuff#>
SELECT ?annotates
WHERE { ?annot a:annotates ?annotates .
?annot my:color ?color .
FILTER ( ?color = "red"^^my:colorName ) }
--
-eric
home-office: +1.617.395.1213 (usually 900-2300 CET)
cell: +81.90.6533.3882
(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.
Received on Thursday, 7 December 2006 13:20:01 UTC