首页 文章

检索dbpedia-owl:使用dbpedia-owl:wikiPageRedirect值输入资源的值?

提问于
浏览
4

Visitng http://dbpedia.org/resource/Cupertino显示了有关Cupertino的DBpedia RDF信息 . 如您所见,它具有 property 和 Value 等:

dbpedia-owl:type  dbpedia:City

但是,DBpedia endpoints 上的此查询不返回任何结果:

SELECT ?type  WHERE {
  dbpedia:Cupertino  dbpedia-owl:type ?type
}

SPARQL results

为什么我无法检索 dbpedia-owl:type 属性的值?

1 回答

  • 3

    你面前有一个互动的网络服务,你可以做的最有用的事情之一就是将你的查询概括为一个应该返回结果超集的查询,这对你看看如果要求全部会发生什么有用 dbpedia:Cupertino 的属性和值 .

    select ?p ?o where {
      dbpedia:Cupertino ?p ?o 
    }
    

    SPARQL results

    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/ 重定向到 /page/ ,但命名约定仍然相同 .

    要在查询中使用 dbpedia:Cupertino ,请'd need to add the redirect information. Thus, you could use the following query to get the results that you'重新查找:

    select ?type where {
      dbpedia:Cupertino dbpedia-owl:wikiPageRedirects*/dbpedia-owl:type ?type
    }
    

    SPARQL results

相关问题