I have two issues:
ISSUE 1
This first issue has decent documentation here on Stack, except that no one else seems to be getting the same results as me, so I thought it would be good for everyone for me to ask it here. When I run the following query:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX type: <http://dbpedia.org/class/yago/>
PREFIX prop: <http://dbpedia.org/ontology/>
SELECT DISTINCT ?person ?commonName ?nationality WHERE {
?person a dbpedia-owl:Person ;
dbpedia-owl:commonName ?commonName . FILTER(lang(?commonName) = 'en')
?person a dbpedia-owl:Person;
dbpedia-owl:birthDate ?birthDate
}
LIMIT 30
I get this list of people:
Great. Now I try to cut out the duplicates (like Abbas Suan who appears three times in three separate languages- I want to keep the English) I do this:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX type: <http://dbpedia.org/class/yago/>
PREFIX prop: <http://dbpedia.org/ontology/>
SELECT DISTINCT ?person (SAMPLE(?commonName) as ?commonName) ?birthDate WHERE {
?person a dbpedia-owl:Person ;
dbpedia-owl:commonName ?commonName . FILTER(lang(?commonName) = 'en')
?person a dbpedia-owl:Person;
dbpedia-owl:birthDate ?birthDate
}
LIMIT 30
With these results: NEW SPARQL RESULTS
So, it seems to me like I have two completely different lists of people. How can I know that I'm not losing people this way? I am trying to download every single person on wikipedia with certain attributes, which is a nice segway to issue 2.
ISSUE 2
When I write the above code, it works fine for those two attributes. However, when I try to add nationality and knownFor attributes (so we know what they did and where they come from), the code bugs out. Even though all of these attributes are on the same page for Person in the DBPedia structure.
This code shows nothing for the nationality and knownFor fields:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX type: <http://dbpedia.org/class/yago/>
PREFIX prop: <http://dbpedia.org/ontology/>
SELECT DISTINCT ?person (SAMPLE(?commonName) as ?commonName) ?birthDate ?nationality ? knownFor WHERE {
?person a dbpedia-owl:Person ;
dbpedia-owl:commonName ?commonName . FILTER(lang(?commonName) = 'en')
?person a dbpedia-owl:Person;
dbpedia-owl:birthDate ?birthDate .
OPTIONAL {?person a dbpedia-owl:Person;
dbpedia-owl:nationality ?nationality .}
OPTIONAL {?person a dbpedia-owl:Person;
dbpedia-owl:knownFor ?knownFor .}
}
LIMIT 30
with these results:
Any help for any of the issues would be very helpful! Thanks