Query both DBPedia and Wikidata at the same time?

☆樱花仙子☆ 提交于 2019-12-11 05:45:31

问题


Is there a way to query both DBPedia and Wikidata at the same time? Like any way to query all the people in DBPedia and Wikidata at the same time?

PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX dbo: <http://dbpedia.org/ontology/> 

{ SELECT ?person WHERE { ?person wdt:P31 wd:Q5 } limit 100 }
UNION 
{ SELECT * { ?person a dbo:Person } }

Try here


回答1:


Thanks to @AKSW I got the answer to my question.

The Federated SPARQL queries would do the trick:

PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX dbo: <http://dbpedia.org/ontology/> 

SELECT ?person WHERE { 
  SERVICE <http://dbpedia.org/sparql> {?person a dbo:Person }
  SERVICE <https://query.wikidata.org/sparql> { ?person wdt:P31 wd:Q5 }
} LIMIT 100 

try here



来源:https://stackoverflow.com/questions/41353093/query-both-dbpedia-and-wikidata-at-the-same-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!