Search code examples
sparqldbpedia

Querying Dbpedia by DBO - SPARQL


I am trying to extract the manufacturer section of this dbpedia page http://dbpedia.org/page/Diageo. However my SPARQL query returns nothing. Yet I can return most other values on the page, such as keyPersons which has the exact same layout.

PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT ?label
WHERE { <http://dbpedia.org/resource/Diageo>
        dbpedia-owl:keyPerson ?label }

PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT ?label
WHERE { <http://dbpedia.org/resource/Diageo>
        dbpedia-owl:manufacturer ?label }

Any ideas?


Solution

  • In DBpedia, an entity page displays statements in which an entity may be not only a subject, but also an object. In the latter case, respective property appears as "is ... of".

    Conversely, the page you have linked to says that dbr:Diageo is dbo:manufacturer of dbr:Johnnie_Walker etc. This means that dbr:Johnnie_Walker dbo:manufacturer dbr:Diageo holds, not that dbr:Diageo dbo:manufacturer dbr:Johnnie_Walker does.

    By the way, rdfs:range of dbo:manufacturer is dbo:Organization.

    Thus, you should looking for triples that match reversed pattern:

    SELECT * WHERE { ?variable dbo:manufacturer ?dbr:Diageo . }
    

    Or, using property paths:

    SELECT * WHERE { dbr:Diageo ^dbo:manufacturer ?variable . }
    

    Try it on DBpedia