Hi !

It seems that there is a bug with the rdflib 2.4.0 sparql query, here an
code example inspired from
http://www.w3.org/TR/rdf-sparql-query/#func-bound :

from rdflib import Literal, ConjunctiveGraph, Namespace, BNode, URIRef

DC = Namespace(u"http://purl.org/dc/elements/1.1/";)
FOAF = Namespace(u"http://xmlns.com/foaf/0.1/";)

graph = ConjunctiveGraph()
s = BNode()
graph.add((s, FOAF['givenName'], Literal('Alice')))
b = BNode()
graph.add((b, FOAF['givenName'], Literal('Bob')))
graph.add((b, DC['date'], Literal("2005-04-04T04:04:04Z")))
 
print graph.query("""PREFIX foaf: <http://xmlns.com/foaf/0.1/>
  PREFIX dc:  <http://purl.org/dc/elements/1.1/>
  PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
  SELECT ?name
  WHERE { ?x foaf:givenName  ?name .
                  OPTIONAL { ?x dc:date ?date } .
                  FILTER ( bound(?date) ) }""").serialize('python')

I think the expected result is [Literal('Bob')], but the result I have
is [].

Thanks for your really great job,
-- 
Romain Chantereau <[EMAIL PROTECTED]>

_______________________________________________
Dev mailing list
Dev@rdflib.net
http://rdflib.net/mailman/listinfo/dev

Reply via email to