Search code examples
sparqlwikipediasemantic-webontologydbpedia

Can I use DBpedia to reference the first / given / Christian name of a person on Wikipedia?


I don't believe Wikipedia's infoboxes take into account the various parts of a person's name such as separating the surname from the given (aka first or Christian) name, etc.

But I also believe DBPedia uses several other ontologies besides what it gets directly from Wikipedia.

So what I'm wondering is whether it's possible to make SPARQL queries which will select people from Wikipedia based on just their given name.

For instance could I query for All knights of the British empire whose first name is "Tim"?


Solution

  • Here's a query similar to what you want:

    SELECT * 
        WHERE 
          {
             ?person rdf:type yago:BritishKnights  . 
             ?person foaf:givenName ?name.
             FILTER regex(?name, "Walter", "i")
          }  
    LIMIT 100
    

    It selects British Knights with the name "Walter". It works in the DBPedia sparql endpoint. I think it's a decent starting point.

    You'll find the following resources useful:

    • British Knights - the concept used in my example query
    • Knights by occupation - here you can find links to some more resources than just BritishKnights. For example, Musicians and Actors are not returned by the query above, instead, they can be found in separate categories.

    • Knights - even more general, here you'll find hyperlinks to resources describing knights from different countries, etc.

    • Sir - the concept of "Sir"
    • Friend Of A Friend - an ontology for describing people and their relations. I used its givenName property in my example
    • vCard RDF ontology - another one with name properties
    • A tutorial on SPARQL filters

    EDIT: Tim Berners-Lee can also be found. The British honours system does not seem simple at all. Good luck with your search. This query takes into consideration the kind of knighthood T. Berners-Lee was honored with.

    SELECT * 
    WHERE 
      {
         ?person dcterms:subject category:Knights_Commander_of_the_Order_of_the_British_Empire . 
         ?person foaf:givenName ?name.
         FILTER regex(?name, "Tim", "i")
      }  
    LIMIT 100
    

    It's all a matter of getting to know the right data sets.

    EDIT:

    It's also possible to avoid using a FILTER if you use an appropriate RDF literal, such as:

    SELECT ?person
    WHERE 
      {
         ?person rdf:type yago:BritishKnights  . 
         ?person foaf:givenName "Walter"@en .
      }  
    

    More information on this can be found in the w3c specification