Re: Semantic Web Phase 2 Activity - Protocol - Query Language

[Cc also sent to sesame-devel, since we discussed this problem there
  today]

Seaborne, Andy wrote:

> Hi there - I have an example query with optional triples and I wondered what
> the various systems do with it:
> 
> Thanks to Jeremy Carroll for this example.
> 
> Consider the data:
> 
> <x> <p> <y> .
> <x> <q> <z> .
> 
> and the query:
> 
> [ <x> <p> ?a ]
> [ <x> <q> ?a ]
> 
> where [] is an optional match.
> 
> ?? Does the query match the data?

I have earlier sent a reply on this to Andy alone, on how SeRQL 
currently handles it, but I've spent some time thinking about this 
and discussed it on the sesame-devel list a bit further.

I think the example query is ill-defined: regardless of the actual 
dataset being queried it is not possible to assign an unambiguous 
semantics to it. The problem is that a variable is shared across 
several optional path matches, neither of which definitely assign 
the variable a value.

> ?? What does it return?

I'm heavily leaning towards saying that the query engine should 
return a "malformed query" error.

In the discussion on sesame-devel, Jacco van Ossenbruggen came up 
with a constraint on optional path expressions: reuse of a variable 
across optional paths is allowed if and only if the variable is also 
used in a non-optional path in the same query. This disambiguates 
the use of the shared variable in optionals, since optional paths 
will no longer have to instantiate the shared variable, they will 
only have to validate the current instantiation.

In the example case, the query could be reformulated in several 
ways, but the most obvious one would be:

[<x> <p> ?y]
[<x> <q> ?z]
?y = ?z

(which would unambiguously return no results)

As far as I can tell, this constraint does not limit expressivity of 
the language, but then again, I can't really tell for sure since I 
am not quite certain what the original query was supposed to express 
in the first place :)

Jeen
-- 
jeen@aduna.biz
Aduna (formerly Aidministrator b.v.) - http://www.aduna.biz
Julianaplein 14b, 3817 CS Amersfoort, The Netherlands
tel. +31-(0)33-4659987, fax. +31-(0)33-4659987

Received on Wednesday, 12 November 2003 10:40:13 UTC