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

another filter problem #619

Closed
pfps opened this issue Apr 13, 2016 · 2 comments
Closed

another filter problem #619

pfps opened this issue Apr 13, 2016 · 2 comments
Labels
bug Something isn't working SPARQL
Milestone

Comments

@pfps
Copy link

pfps commented Apr 13, 2016

Filters in subqueries only appear to work correctly if they in the first subquery.
I put together a several small examples to show the problem.

[Again, uploading problems - I'll put the example in a separate comment.]

@pfps
Copy link
Author

pfps commented Apr 13, 2016

import rdflib

dataGraph = rdflib.Graph()

print "SINGLE QUERY"
query = """SELECT  ?this  WHERE {  
    VALUES ?this { <http://ex.com/a> "HI" }
    FILTER ( ! isBlank(?this) ) 
}"""
result = dataGraph.query(query)
for row in result : print row
assert len(result) > 0

print "NO FILTER"
query = """
SELECT  ?this
WHERE { 
    { SELECT ?this WHERE {  
        VALUES ?this { <http://ex.com/a>  "HI"  }
      } } 
    { SELECT ?this WHERE {  
        VALUES ?this { <http://ex.com/a> "HI" }
      } } 
}"""
result = dataGraph.query(query)
for row in result : print row
assert len(result) > 0

print "FILTER in first subquery"
query = """
SELECT  ?this
WHERE { 
    { SELECT ?this WHERE {  
        VALUES ?this { <http://ex.com/a>  "HI"  }
        FILTER ( isIRI(?this) )
      } } 
    { SELECT ?this WHERE {  
        VALUES ?this { <http://ex.com/a> "HI" }
      } } 
}"""
result = dataGraph.query(query)
for row in result : print row
assert len(result) > 0

print "FILTER in second subquery"
query = """
SELECT  ?this
WHERE { 
    { SELECT ?this WHERE {  
        VALUES ?this { <http://ex.com/a> "HI" }
      } } 
    { SELECT ?this WHERE {  
        VALUES ?this { <http://ex.com/a>  "HI"  }
        FILTER ( isIRI(?this) )
      } } 
}"""
result = dataGraph.query(query)
for row in result : print row
assert len(result) > 0

@joernhees joernhees added bug Something isn't working SPARQL labels May 10, 2016
@joernhees joernhees added this to the rdflib 4.2.2 milestone May 10, 2016
@gromgull
Copy link
Member

Thanks a lot for a very clearly diagnosed problem @pfps !

Fixed in acc6ed3

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

3 participants