Search code examples
sparqlsemantic-webdbpedia

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


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.


Solution

  • 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.