Hi Rick,
Sorry, your not having a good time of it here.
Not one but 2 related bugs (filter in wrong place, lost the aggregate
function) this time. HAVING is particularly hard because it isn't a
simple mapping to one algebra form.
If split up:
--------------
PREFIX qb: <http://purl.org/linked-data/cube#>
SELECT ?obs (COUNT(?value) AS ?C)
WHERE
{ ?obs a qb:Observation .
?obs qb:measureType ?measure .
?obs ?measure ?value
}
GROUP BY ?obs
HAVING ( ?C > 1 )
--------------
it goes wrong as well.
I've recorded it as
https://issues.apache.org/jira/browse/JENA-963
A couple of things would be good:
You can raise JIRA directly - I attached code to the JIRA like it was
from JENA-954. Prefixes etc. - query-in, query-out.
What would be really good is fix the test coverage. "TestOpAsQuery" is
the test class. Do you have a complete (nearly complete ...) list of
features? What's missing in TestOpAsQuery?
If we can get the coverage up, we'll be a better position long term.
Andy
On 15/06/15 16:57, Rick Moynihan wrote:
Hi all,
I've been using the recent fixes to ARQ (made in JENA-954) around rendering
SPARQL queries and have encountered another problem where a valid query
appears to roundtrip to an invalid one.
The problematic query is this:
SELECT ?obs
WHERE {
?obs a qb:Observation ;
qb:measureType ?measure ;
?measure ?value ;
.
}
GROUP BY ?obs
HAVING (COUNT(?value) > 1)
Which generates this SSE:
(project
(?obs)
(filter
(> ?.0 1)
(group
(?obs)
((?.0
(count ?value)))
(bgp
(triple ?obs <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://purl.org/linked-data/cube#Observation>)
(triple ?obs <http://purl.org/linked-data/cube#measureType>
?measure)
(triple ?obs ?measure ?value)))))
But when round tripped back into SPARQL with OpAsQuery.asQuery, leads to
this invalid query:
SELECT ?obs
WHERE
{ ?obs <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> qb:Observation .
?obs qb:measureType ?measure .
?obs ?measure ?value
FILTER ( ?.0 > 1 )
}
GROUP BY ?obs
R.