I have a list of URLs to wikipedia pages and query dbpedia data on lod.openlinksw.com endpoint. The code is the same as in this question. What would be good to understand is: how is it possible that for some urls it doesn't work altough dbpedia pages have correct foaf:isPrimaryTopicOf urls?
Here a simplifyed query for the corresponding dbpedia and wikipedia pages.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT Distinct ?name ?s ?url WHERE {
?s a foaf:Person .
FILTER NOT EXISTS { ?s rdf:type dbo:FictionalCharacter }.
?s foaf:isPrimaryTopicOf ?url.
?s rdfs:label ?name.
filter(langMatches(lang(?name), "en")).
?s foaf:isPrimaryTopicOf <http://en.wikipedia.org/wiki/Adi_Shankara>.
}
LIMIT 1
From the list with ~40 urls that were pulled from wikipedia, i get ~10 empty responses. First i thought may be there is something wrong with the urls but most of them seem fine. Here more of 'not working' cases:
In 1st (Harald_Fairhair) and in 4th (Kenneth_MacAlpin) cases there are different urls that point to the same wikipage so i need to find out how to deal with such cases. But i don't understand why the rest doesn't work. Any help would be appreciated.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?name ?s ?url
WHERE {
VALUES ?url { <http://en.wikipedia.org/wiki/Adi_Shankara>
<http://en.wikipedia.org/wiki/Harald_I_of_Norway>
<http://en.wikipedia.org/wiki/Ivar_the_Boneless>
<http://en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa>
<http://en.wikipedia.org/wiki/Kenneth_I_of_Scotland>
<http://en.wikipedia.org/wiki/Li_Deyu>
}
?s ^dbo:wikiPageRedirects*
/foaf:isPrimaryTopicOf ?url .
FILTER NOT EXISTS { ?s rdf:type dbo:FictionalCharacter }
?s rdfs:label ?name .
FILTER(langMatches(LANG(?name), "en")).
}
How does this query (and live results from DBpedia) work for you?
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT Distinct ?name ?s ?url WHERE {
VALUES ?url { <http://en.wikipedia.org/wiki/Adi_Shankara>
<http://en.wikipedia.org/wiki/Harald_I_of_Norway>
<http://en.wikipedia.org/wiki/Ivar_the_Boneless>
<http://en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa>
<http://en.wikipedia.org/wiki/Kenneth_I_of_Scotland>
<http://en.wikipedia.org/wiki/Li_Deyu>
}
?s foaf:isPrimaryTopicOf ?url .
# ?s rdf:type foaf:Person .
FILTER NOT EXISTS { ?s rdf:type dbo:FictionalCharacter }
?s rdfs:label ?name .
FILTER(langMatches(LANG(?name), "en")).
# ?s foaf:isPrimaryTopicOf <http://en.wikipedia.org/wiki/Adi_Shankara>.
}
# LIMIT 10
Does any of that help you understand what was going wrong before?