gjhiggins/rdflib — Issue #91: OPTIONAL doesn't work in SPARQL queries
Author: gjhiggins
Created: 2011-10-19 01:18:22+00:00
State: open

Originally filed by cuu...@gmail.com on 2009-11-13T12:27:08

What steps will reproduce the problem?

>>> from rdflib.graph import ConjunctiveGraph
>>> from rdflib.term import URIRef
>>> x = ConjunctiveGraph()
>>> x.add((URIRef("http://a"), URIRef("http://b"), URIRef("http://c")))
>>> list(x.query("SELECT ?s WHERE { ?s ?p ?o } "))
[rdflib.term.URIRef('http://a')]
>>> # Expect to get the same result with OPTIONAL:
>>> list(x.query("SELECT ?s WHERE { OPTIONAL { ?s ?p ?o } } "))
[]

What version of the product are you using? On what operating system?

rdflib 2.4.2 and rdflib 2.5.0 (r1722)