Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with bind and initBindings #586

Closed
gromgull opened this issue Jan 26, 2016 · 1 comment
Closed

Bug with bind and initBindings #586

gromgull opened this issue Jan 26, 2016 · 1 comment
Labels
bug Something isn't working SPARQL
Milestone

Comments

@gromgull
Copy link
Member

My fix to #294 wasn't perfect:

from rdflib import Graph
from rdflib.namespace import Namespace

n=Namespace('urn:')
g=Graph()

g.add((n.x, n.p, n.o))
g.add((n.y, n.p, n.o))

list(g.query('select ?v1 ?v2 where { ?v1 <urn:p> <urn:o> . BIND (STR(?v1) as ?v2)} '))
# [(rdflib.term.URIRef(u'urn:y'), rdflib.term.Literal(u'urn:y')),
# (rdflib.term.URIRef(u'urn:x'), rdflib.term.Literal(u'urn:x'))]

list(g.query('select ?v1 ?v2 where { ?v1 <urn:p> <urn:o> . BIND (STR(?v1) as ?v2)} ', initBindings={'v1':n.x}))
# [(rdflib.term.URIRef(u'urn:x'), None)]

If the initBound term is used in a bind, it doesn't work ... this worked before the fix to #294

@gromgull
Copy link
Member Author

I am a moron. I tested the version before my fix. Nevermind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SPARQL
Projects
None yet
Development

No branches or pull requests

2 participants