Search code examples
sparqldbpedia

Getting dates from DBPedia


It's my first time using DBpedia and I need to check whether a page is representing a person and if so, I need to extract his birthdate. The examples on the net have shown where the result outputs entire pages as a result and not single properties. My input is the link to the DBPedia page

for ex: "http://dbpedia.org/resource/Cristiano_Ronaldo".

It should first check if he is a person and if so, get his birthdate


Solution

  • When dealing with DBpedia, you need to know where exactly to put the restrictions. Basically you need to first say x is a person and then say now filter out all the information about x but the birthDate:

    Prefix dbpedia-owl:<http://dbpedia.org/ontology/>
    select distinct * where {
    ?x a dbpedia-owl:Person.
    ?x dbpedia-owl:birthDate ?b
    } LIMIT 100