SPARQL-Abfrage "COUNT" in der Virtuoso Jena-API - QueryParseException

Gleiche Abfrage funktioniert in DBpedia Endpoint http: //ko.dbpedia.org/sparq), aber nicht in meinem Java-Code. Ich versuche nur, die Frequenz mit der Funktion "COUNT" zu extrahieren.

VirtGraph set = new VirtGraph("http://ko.dbpedia.org", HOST, USERNAME, PASSWORD);
Query freqsparql = QueryFactory.create("SELECT ?class count(distinct ?s) as ?count where{?s <http://ko.dbpedia.org/property/이름> ?o. ?s a ?class.} order by DESC(?count)");
VirtuosoQueryExecution freqvqe = VirtuosoQueryExecutionFactory.create(freqsparql, set);
ResultSet freqresults = freqvqe.execSelect();

Und der Fehler ist wie folgt.

Exception in thread "main" com.hp.hpl.jena.query.QueryParseException: Encountered " "count" "count "" at line 1, column 15.
Was expecting one of:
<VAR1> ...
<VAR2> ...
"from" ...
"where" ...
"(" ...
"{" ...

at com.hp.hpl.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:102)
at com.hp.hpl.jena.sparql.lang.ParserSPARQL11.parse$(ParserSPARQL11.java:53)
at com.hp.hpl.jena.sparql.lang.SPARQLParser.parse(SPARQLParser.java:37)
at com.hp.hpl.jena.query.QueryFactory.parse(QueryFactory.java:148)
at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:80)
at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:53)
at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:41)

Ich benutze virt_jena2.jar und virtjdbc4.jar. Ich habe ähnliche Fragen und Antworten durchgesehen (Jena ARQ-Erweiterung und SPARQL 1.1 unterstützen diese aggregierte Abfrage. Ich konnte jedoch nicht feststellen, wie ich sie ändern kann. Ich glaube, ich verwende SPARQL 1.1, da die Fehlermeldung PARSERSPARQL11 enthält. java), kann aber noch nicht herausfinden, wie dies zu diesem Zeitpunkt gelöst werden kann.

Danke im Voraus

String sparqlQueryString = "SELECT ?class count(distinct ?s) as ?count    where{?s <http://ko.dbpedia.org/property/이름> ?o. ?s a ?class.} order by DESC(?count)";
Query query = QueryFactory.create(sparqlQueryString);
QueryExecution qexec = QueryExecutionFactory.sparqlService(
                "http://ko.dbpedia.org/sparql", query);
try {
    ResultSet results = qexec.execSelect();
    while(results.hasNext()){
        QuerySolution freqresult = results.nextSolution();
        RDFNode domain = freqresult.get("class");
        RDFNode freqcount = freqresult.get("count");
        System.out.println(freqresult);
        System.out.println(domain + "---" + freqcount);
    }
} catch (Exception e) {
    e.printStackTrace();
} finally {
    qexec.close();
}

Dieser Jena-Code (ohne Virtuoso) gibt mir dieselbe Fehlermeldung.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage