I'm trying to execute this SPARQL query in PROTEGE 2000, but the MAX function isn't working. it's like Max() isn't accepting the type of ?cpt.
SELECT ?searcher (COUNT(?publication) AS ?cpt)
WHERE {ont:GradeP ont:isFor ?searcher.
?publication ont:isPublishedBy ?searcher.}
GROUP BY ?searcher
HAVING (MAX(?cpt))
here's the exception :
SparqlReasonerException: org.openrdf.query.QueryEvaluationException: Unsupported value expr type: class org.openrdf.query.algebra.Max
The request is working without
HAVING
, so i guess there is no problem with my ontology. So can please anyone tell me where is the issue. Thanks!
I'm not sure why you are using group by
here, but maybe you have a reason. One way to do it is by using order by
. I have provided an example on dbpedia.
select distinct ?x count(?y) as ?count
where{
?x a dbpedia-owl:Person.
?x dbpprop:author ?y
}
order by desc(?count)
limit 1
The result is here.