W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2006

Re: operator mapping

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Mon, 11 Dec 2006 11:24:02 +0000
Message-ID: <457D3FD2.3050701@hp.com>
To: Eric Prud'hommeaux <eric@w3.org>
CC: public-rdf-dawg@w3.org



Eric Prud'hommeaux wrote:
> 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))

RDFterm-equals (11.4.10) is defined as:

"""
Returns TRUE if term1 and term2 are the same RDF term as defined in Resource 
Description Framework (RDF): Concepts and Abstract Syntax [CONCEPTS]; produces 
a type error if the arguments are both literal but are not the same RDF term 
*; returns FALSE otherwise. term1 and term2 are the same if any of the 
following is true:
"""

which is the rules, in order:
1/ True if term1 and term2 are the same RDF term
2/ type error if the arguments are both literal but are not the same RDF term
3/ False otherwise.

Read strictly (2) covers the literal cases that (1) does not do (3) is never 
reached for a pair of literals.

(1) applies to same term
(2) applies to two literals, not the same term

As stated:

"abc" = "def" is a type error by rule 2.

Shouldn't (2) apply when one or the other datatypes are not in the known 
datatype list earlier (11.1)?  Alternative move up rule 3 and make it apply 
only when both types are in the 11.1 list.


> 
> 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 ) }

Undefined "my:" - should my: be clr:?

ARQ gets a result of:

--------------------------------------------
| annotates                                |
============================================
| <http://www.w3.org/TR/rdf-sparql-query/> |
--------------------------------------------

Could we have an example has both a +ve and -ve aspects?

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

   _:x   a:annotates   <http://www.w3.org/TR/rdf-sparql-protocol/> .
   _:x   my:color      "dark red"^^my:colorName .

Same results.

	Andy
Received on Monday, 11 December 2006 11:24:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:27 GMT