rdf:为SPARQL输入Jena API不工作?
为什么用于SPARQL的Jena API(Java)不为带有rdf:为SPARQL输入Jena API不工作?,sparql,jena,Sparql,Jena,为什么用于SPARQL的Jena API(Java)不为带有rdf:type的查询提供任何结果?其他SPARQL查询工作正常。例如,此查询不起作用: SELECT DISTINCT ?p{ ?p rdf:type :AAA } 完整代码: String queryString=listOfPrefixesOntNormXML+" \n" +"SELECT DISTINCT ?p{ ?p rdf:type :AAA }"; System.out.pr
rdf:type
的查询提供任何结果?其他SPARQL查询工作正常。例如,此查询不起作用:
SELECT DISTINCT ?p{
?p rdf:type :AAA
}
完整代码:
String queryString=listOfPrefixesOntNormXML+" \n"
+"SELECT DISTINCT ?p{ ?p rdf:type :AAA }";
System.out.println(queryString);
Query query = QueryFactory.create(queryString);
QueryExecution qExe = QueryExecutionFactory.sparqlService( "http://dbpedia.org/sparql", query );
ResultSet results = qExe.execSelect();
ResultSetFormatter.out(System.out, results, query) ;
完整查询字符串:
PREFIX : <http://www.co-ode.org/ontologies/pizza/pizza.owl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xml: <http://www.w3.org/XML/1998/namespace>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl11: <http://www.w3.org/2006/12/owl11#>
PREFIX pizza: <http://www.co-ode.org/ontologies/pizza/pizza.owl#>
PREFIX owl11xml: <http://www.w3.org/2006/12/owl11-xml#>
SELECT DISTINCT ?p{ ?p rdf:type :AAA }
前缀:
前缀owl:
前缀rdf:
前缀xml:
前缀xsd:
前缀rdfs:
前缀owl11:
前缀比萨饼:
前缀owl11xml:
选择不同的?p{?p rdf:type:AAA}
因为您正在向DBpedia端点提出查询,以查找不存在的:AAA
的rdf:type
如果将其更改为
dbo:Book
,它应该可以工作,因为DBpedia中存在rdf:type
因为您正在向DBpedia端点提出查询,以查找不存在的:AAA
的rdf:type
如果将其更改为
dbo:Book
,它应该可以工作,因为DBpedia中存在rdf:type
检查rdf:
和:
的前缀声明。它是正确的,请参阅上面的完整代码和输出检查rdf:
和:
的前缀声明。它是正确的,请参阅上面的完整代码和输出我现在看到了。。。我的错误dbo:book
->dbo:book
我现在明白了。。。我的错误dbo:book
->dbo:book