jena 中的 SPARQL execdescribe 查询只给出前缀作为输出

SPARQL execdescribe query in jena only giving prefix as output

下面的 SPARQL execdescribe 查询只给我两个前缀作为输出,而 运行 Jena 查询但是当我 运行 这个查询在 virtuoso SPARQL 端点上时它给出了完美的输出。

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX db: <http://dbpedia.org/ontology/> 
PREFIX prop: <http://dbpedia.org/property/>
DESCRIBE ?movie ?author ?genre
WHERE { 
?movie rdf:type db:Film ;
prop:author ?author ;
prop:genre ?genre .
}
LIMIT 2
OFFSET 0

当我 运行 使用 Jena 时,我只得到这样的两行输出,

@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .

下面是我正在使用的代码,但经过一些查询后它工作正常,

String queryString = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>" + 
                "PREFIX db: <http://dbpedia.org/ontology/> " + 
                "PREFIX prop: <http://dbpedia.org/property/>" + 
                "DESCRIBE ?movie ?author ?genre" + 
                "WHERE { " + 
                "?movie rdf:type db:Film ;" + 
                "prop:author ?author ;" + 
                "prop:genre ?genre ." + 
                "}" + 
                "LIMIT 2" + 
                "OFFSET 0";

        QueryExecution qexec = QueryExecutionFactory.sparqlService("http://localhost:8890/sparql", queryString);
        Model results = qexec.execDescribe();

        results.write(System.out,"TTL");

它完美地为我提供了关于 virtuoso SPARQL 端点的输出。 下面是屏幕截图,

正如@AKSW 在评论中所建议的那样,查询中存在 space 问题。所以在编辑我的查询后,它将完美地工作。