您面前有一个交互式 Web 服务,您可以做的最有用的事情之一是将您的查询概括为一个应该返回您正在寻找的结果的超集的查询,作为一种健全性检查。在这种情况下,如果您询问dbpedia:Cupertino
.
select ?p ?o where {
dbpedia:Cupertino ?p ?o
}
SPARQL 结果
p o
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Thing
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/Place
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/PopulatedPlace
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/Settlement
http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://schema.org/Place
http://dbpedia.org/ontology/wikiPageID 337802
http://dbpedia.org/ontology/wikiPageRevisionID 16202923
http://www.w3.org/2000/01/rdf-schema#label "Cupertino"@en
http://dbpedia.org/ontology/wikiPageRedirects http://dbpedia.org/resource/Cupertino,_California
http://xmlns.com/foaf/0.1/isPrimaryTopicOf http://en.wikipedia.org/wiki/Cupertino
http://www.w3.org/ns/prov#wasDerivedFrom http://en.wikipedia.org/wiki/Cupertino?oldid=16202923
在这种情况下,这dbpedia-owl:wikiPageRedirects
是非常重要的。当您在Web 浏览器中dbpedia:Cupertino
输入完整的 URI http://dbpedia.org/resource/Cupertino时,请仔细查看最终的结果。您最终到达http://dbpedia.org/page/Cupertino,_California,这意味着您实际询问的资源是http://dbpedia.org/resource/Cupertino,_California(当您在浏览器,您从/resource/
to重定向/page/
,但命名约定仍然相同。
要dbpedia:Cupertino
在查询中使用,您需要添加重定向信息。因此,您可以使用以下查询来获取您正在寻找的结果:
select ?type where {
dbpedia:Cupertino dbpedia-owl:wikiPageRedirects*/dbpedia-owl:type ?type
}
SPARQL 结果