Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Jena 2.13.0
-
None
Description
Reported on the mailing list:
http://s.apache.org/jena-algebra-roundtripping-bug
Some queries roundtrip incorrectly through the Algebra.compile() to OpAsQuery.asQuery() flow e.g.
SELECT (COUNT(*) as ?count) { SELECT DISTINCT ?uri ?graph WHERE { GRAPH ?graph { ?uri ?p ?o . } } LIMIT 1 }
Produces algebra:
project (?tripod_count_var) (extend ((?tripod_count_var ?.0)) (group () ((?.0 (count))) (distinct (project (?uri ?graph) (graph ?graph (bgp (triple ?uri ?p ?o))))))))
Which round trips back to:
SELECT DISTINCT (count(*) AS ?tripod_count_var) WHERE { { SELECT ?uri ?graph WHERE { GRAPH ?graph { ?uri ?p ?o} } } }
Note that the DISTINCT was incorrectly moved to the outer query
The problem is that the conversion does not correct cope with the case of being within a project and needs to spawn a sub-converter to cope as OpProject already does