Here is a test for current svn:
from rdflib import StringInputSource, ConjunctiveGraph, Variable,
Namespace, Literal
NS = Namespace("http://example.org/")
def test():
graph = ConjunctiveGraph()
graph.parse(StringInputSource("""
@prefix : <http://example.org/> .
:unrelated :startTime "t1";
:endTime "t2".
:foo :member [ :user :x;
:startTime "t3" ] .
"""), format="n3")
for row in graph.query("""SELECT ?member ?startTime ?endTime WHERE
{
ns:foo ns:member ?member .
?member ns:user ns:x .
?member ns:startTime ?startTime .
OPTIONAL {
?member ns:endTime ?endTime .
}
}""",
initNs=dict(ns=NS),
DEBUG=False):
# the member I searched for has no endTime
assert row[1:] == (Literal('t3'), None)
if __name__ == '__main__':
test()
It fails by returning (Literal('t3'), Literal('t2')), but t2 is not
related to the ?member that was matched-- it's from some other triple!
_______________________________________________
Dev mailing list
[email protected]
http://rdflib.net/mailman/listinfo/dev