[redland-dev] Querying using SPARQL - misc questions

Dave Beckett dave at dajobe.org
Thu Feb 9 04:22:11 GMT 2006


Anahide Tchertchian wrote:

...

> The first one does not give me the 'subob2' node although I'm using
> OPTIONAL:
> 
> PREFIX dcterms: <http://purl.org/dc/terms/>
> SELECT ?node1, ?node2
> WHERE {
>   ?node1 dcterms:isPartOf <root> .
>   OPTIONAL { ?node2 dcterms:isPartOf ?node1 }
> }
> 
> The second one, that I thought would be equivalent, gives inconsistant
> results:
> 
> PREFIX dcterms: <http://purl.org/dc/terms/>
> SELECT ?node1, ?node2
> WHERE {
>   OPTIONAL { ?node2 dcterms:isPartOf ?node1 }
>   ?node1 dcterms:isPartOf <root>
> }
> 
> 'root' is returned as 'node1' values although I did not state it is a
> part of itself, and I still dont get the 'subob2' result.
> 
> Attached is a python script reproducing what I'm saying (sorry for the
> raw output).
> 
> Am I doing something wrong? Is this a know bug? Is there another way to
> achieve that?

The query engine's implementation of OPTIONALs are known to be buggy and
I haven't had the time to delve into why in between moving jobs &
continents.  I was toying with disabling them entirely but they *do*
work for simpler cases.  It's something to do with not being able to
distinguish the end of results from the end of multiple OPTIONAL
results, although if I knew more, I'd be on the track to fixing it.

Dave


More information about the redland-dev mailing list