Search code examples
sparqldbpedia

SPARQL query to print the name, birthday pairs for a list of people in dbpedia


Given a list of Wikipedia article titles (people's names), how do I print the name, birthday pair for each person?


Solution

  • Here is one way to do it using the VALUES clause in SPARQL 1.1:

    PREFIX dbpedia: <http://dbpedia.org/resource/>
    PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
    PREFIX foaf: <http://xmlns.com/foaf/0.1/>
    SELECT ?givenName ?surname ?birth
    WHERE
    {      
      ?person dbpedia-owl:birthDate ?birth .      
      ?person foaf:givenName ?givenName .      
      ?person foaf:surname ?surname .      
      VALUES ?person { dbpedia:Albert_Einstein dbpedia:Max_Planck dbpedia:Marie_Curie }
    }