SPARQL Query “COUNT” in Virtuoso Jena API - QueryParseException

后端 未结 2 1136
庸人自扰
庸人自扰 2021-01-16 21:17

Same query works in DBpedia Endpoint(http://ko.dbpedia.org/sparql), but not in my Java code. I am just trying to extract the frequency using \"COUNT\" function.



        
2条回答
  •  再見小時候
    2021-01-16 22:19

    This is illegal SPARQL syntax:

    SELECT ... count(distinct ?s) as ?count where
    

    It should be

    SELECT ... (count(distinct ?s) as ?count) where
    

    The you will have a problem with ?class in:

    SELECT ?class (count(distinct ?s) as ?count) where
    

    because it is not a grouped variable (using count you have a group of everything). Did you mean to have a GROUP BY ?class?

提交回复
热议问题