Is it possible to return relationships between two objects in SPARQL?

北城余情 提交于 2019-12-13 04:39:06

问题


I am a beginner in SPARQL and I would like to know if it is possible to return relationships between two objects. For example I would like to write a SPARQL query which returns the relationship between Thierry Henry and Arsenal in dbpedia.


回答1:


SELECT ?relationship
WHERE {
  <http://dbpedia.org/resource/Thierry_Henry> 
  ?relationship 
  <http://dbpedia.org/resource/Arsenal_F.C.>
}

i.e.:

show me the predicates (?relationship) where the subject is the DBPedia resource Thierry_Henry and the object is the DBPedia resource Arsenal_F.C.

..which results to:

dbpedia:ontology/team
dbpedia2:clubs

..which apparently means that Thierry Henry was part of the Arsenal team and belonged to the Arsenal Football Club. See the result on DBPedia SPARQL Explorer.



来源:https://stackoverflow.com/questions/32526559/is-it-possible-to-return-relationships-between-two-objects-in-sparql

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