Re: Q: ISSUE-41 bNode semantics

On 18 May 2011, at 22:53, Enrico Franconi wrote:

> 1) The following two RDBs, have the same direct mapping, but they do mean completely different things:
> 
> DB1:
> 
> R +----+------+
>   | ID |   A  |
>   +----+------+
>   |  1 | null |
>   |  2 | null |
>   +----+------+
> 
> DB2:
> 
> R +----+
>   | ID |
>   +----+
>   |  1 |
>   |  2 |
>   +----+
> 
> 2) The query [let me be sloppy in the syntax here] 
>    (:bn type R).(:bn A ?X)
>    returns in both DB1 and DB2 no assignment for ?X, 
>      while in DB1 it should return the NULL value(s).
> 
> 3) The query
>    (?X type R).(?Y type R).(?X A ?Z).(?Y A ?Z)
>    correctly returns the empty assignments.
> 
> 4) With the direct mapping translating the NULL value as a special constant,
>    the query (3) returns the empty assignments in DB2 but not in DB1,
>    where the given incorrect answer is:
>    {{?X=1,?Y=1,?Z=null},
>     {?X=1,?Y=2,?Z=null},
>     {?X=2,?Y=1,?Z=null},
>     {?X=2,?Y=2,?Z=null}}
>     
> (2) and (4) show that the naive approaches based on not translating NULL values or on translating the NULL value as a special constant are wrong.

This is how I propose to fix query (3) with the direct mapping translating the NULL value as a special constant (and forgive again my sloppy syntax):
(?X type R).(?Y type R).(?X A ?Z).(?Y A ?Z).
(?X ≠ 'null').(?Y ≠ 'null').(?Z ≠ 'null')

So, for every repeated (aka joined) query variable in the BGP we add a not-null atom.

cheers
--e.

Received on Wednesday, 18 May 2011 21:00:32 UTC