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

fix sparql count & sample for unbound #567

Merged
merged 5 commits into from
Jan 30, 2016

Conversation

joernhees
Copy link
Member

fixes #563 and builds on top of #564, changing it to return None in case SAMPLE(?var) can't find a binding for ?var.

@joernhees joernhees added bug Something isn't working enhancement New feature or request in-resolution SPARQL labels Dec 29, 2015
@joernhees joernhees self-assigned this Dec 29, 2015
@joernhees joernhees added this to the rdflib 4.2.2 milestone Dec 29, 2015
@joernhees
Copy link
Member Author

@gromgull hehe, well just out of curiosity i asked jena:

$ touch empty.n3
$ sparql --data empty.n3 --query <(echo 'SELECT ?x (SAMPLE(?y) as ?ys) (SAMPLE(?z) as ?zs) WHERE {
  VALUES (?x ?y ?z) {
    (2 6 UNDEF)
    (2 UNDEF 10)
    (3 UNDEF 15)
    (3 9 UNDEF)
    (5 UNDEF 25)
  }
}
GROUP BY ?x
')
---------------
| x | ys | zs |
===============
| 5 |    | 25 |
| 3 |    |    |
| 2 |    |    |
---------------

@joernhees
Copy link
Member Author

@joernhees
Copy link
Member Author

sooo... according to @afs in https://lists.w3.org/Archives/Public/public-sparql-dev/2016JanMar/0006.html both our sample behaviors are correct, but the new one is a bit more useful. the old behavior wrt. count definitely was a bug.

joernhees added a commit that referenced this pull request Jan 30, 2016
fix sparql count & sample for unbound
@joernhees joernhees merged commit ab6d7f2 into RDFLib:master Jan 30, 2016
@joernhees joernhees deleted the fix_sparql_count_sample branch January 30, 2016 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request in-resolution SPARQL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aggregate operators COUNT and SAMPLE should ignore NULL values
3 participants