W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2005

Re: boolean operators and type errors

From: Jeen Broekstra <jeen@aduna.biz>
Date: Wed, 07 Sep 2005 17:29:06 +0200
Message-ID: <431F0742.8040906@aduna.biz>
To: DAWG Mailing List <public-rdf-dawg@w3.org>

Jeen Broekstra wrote:
> So how does this affect querying?
> 
> Let's look again at Tim's example scenario. There was no smoke, and the 
> temparature is uncomparable to 40. The question he wants to ask is if 
> there is any smoke or if the temperature is above 40.
> 
> In RDF:
> 
> data:
>   :detector :temperature "garbled"^^my:UnknownDT .
>   :detector :smoke 0.
> 
> query:
>    SELECT ?smoke ?temp
>    WHERE { :foo :smoke ?smoke ;
>                 :temperature ?temp
>        FILTER (?smoke = 1 || ?temp > 40).
>       }
> 
> result using LC truth table: ( F || E -> F ):
>   no results.
> 
> result using SQL truth table: ( F || E -> E):
>   no results.
> 
> At first, no difference. (arguably in the SQL scenario one should give 
> back an error of some kind, I'll get back to that later).
> 
> However, the difference becomes apparent if we slightly alter the query 
> by using a NOT:
> 
>    SELECT ?smoke ?temp
>    WHERE { :foo :smoke ?smoke ;
>                 :temperature ?temp
>        FILTER (not(?smoke = 1 || ?temp <= 40)).
>       }
> 
> result using LC truth table:  (not(F || E) -> not(F) -> T )
>  ?smoke ?temp
>  0      "garbled"^^my:UnknownDT
> 
> result using SQL truth table: (not(F || E) -> not(E) -> E )
>   no results.

Crud, there is a stupid error in this example: of course the filter 
condition in the second query is not logically equivalent to the one in 
the first: it should be ?smoke = 0 but then the conclusion does not hold 
(because that query gives no results). Disregard please.

Nevertheless the conclusion that the behavior in combination with 
negation is counterintuitive in the LC scenario still holds IMHO. Will 
try and come up with a better example.

(and I thought I checked it thoroughly, sorry about that)

Jeen
Received on Wednesday, 7 September 2005 15:29:46 GMT

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