查询DBpedia

网址:http://dbpedia.org/sparql

注意事项:

  1. 属性路径都是xxx/ontology/yyy
  2. xxx/page/yyyxxx/resource/yyy会相互转换,但是将后者作为查询sql属性值

示例:

SELECT ?e ?p ?s
  WHERE
    {
      ?e <http://dbpedia.org/ontology/award>         <http://dbpedia.org/resource/Pulitzer_Prize_for_Fiction>  .

      ?e <http://dbpedia.org/ontology/award>  <http://dbpedia.org/resource/Nobel_Prize_in_Literature> .

            ?e       <http://dbpedia.org/ontology/birthPlace> <http://dbpedia.org/resource/Oak_Park,_Illinois> .
      
      ?e ?p ?s .

    }

史蒂芬霍金,很多人关注和他的生辰和死亡时间

select *
where {
  ?man <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Scientist> .
  ?man <http://dbpedia.org/ontology/birthDate> ?birth .
  ?man <http://dbpedia.org/ontology/deathDate> ?death .
     FILTER ( REGEX(?birth,"42-01-08")||REGEX(?death,"42-01-08")||REGEX(?birth,"18-03-14")||REGEX(?death,"18-03-14") )
}

posted on 2018-04-21 14:18  coderDu  阅读(711)  评论(0编辑  收藏  举报