Re: Blank node identifiers in FILTER clauses (ooooops 3)

On 17 Jul 2006, at 22:59, Enrico Franconi wrote:

>>> SELECT ?X
>>> WHERE { ?X rdf:type Worker .
>>>         ?X :hasFriend ?Y .
>>>         ?Y rdf:type Employee .
>>>         ?Y :hasFriend ?Z .
>>>         ?Z rdf:type Manager } # note ?vars
>
> My above answer makes sense only if all the variables in the query  
> are distinguished (SELECT *). However, in your example only ?X is a  
> disinguished variable (SELECT ?X), and therefore YES, the correct  
> answer should be, and is, {?X/Paul}, since the non-distinguished  
> variables ?Y and ?Z are interpreted existentially.

Given my later statement:

On 17 Jul 2006, at 23:07, Enrico Franconi wrote:
> Also note that in SPARQL the variables in a basic graph pattern are  
> all distinguished; the role of non-distinguished variables is  
> played by the bnodes.

the only way to write in SPARQL the above query when you intend ?X to  
be the only distinguished variable is:

SELECT ?X
WHERE { ?X rdf:type Worker .
         ?X :hasFriend _:Y .
         _:Y rdf:type Employee .
         _:Y :hasFriend _:Z .
         _:Z rdf:type Manager }

cheers
--e.

Received on Monday, 17 July 2006 21:11:52 UTC