Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Jena 3.1.1, Jena 3.2.0, Jena 3.3.0, Jena 3.4.0, Jena 3.5.0, Jena 3.6.0
Description
Given a SPARQL query like this:
SELECT ?foo WHERE {
?foo ?bar ?baz . # Not essential for problem just to show we can't optimise it away.
VALUES ?foo { }
}
If you compile it into an SSE with something like this:
Algebra.compile(QueryFactory.create("SELECT ?foo WHERE { ?foo ?bar ?baz . VALUES ?foo { }}"));
You end up with a semantically different SSE:
(project (?foo)
(join
(bgp (triple ?foo ?bar ?baz))
(table empty)))
Note how "(table empty)" has lost the ?foo binding, which means that this query returns all results for ?foo, where it should return no results.
I'm not sure how this query should be expressed in SSE form I'd suggest:
(table (vars ?foo) empty)
Though currently this will get simplified in code like this into an EmptyTable if you do something like:
BuilderTable.build(Item.createList((SSE.parse("(table (vars ?foo) empty)")));
Additionally it appears quite a bit of code carries through this assumption that an empty table will never have a binding.
As far as I can tell this issue effects many prior versions of JENA including 3.6.0.
Attachments
Issue Links
- links to