I'm writing a python code to match the list of actors between DBPEDIA and WIKIDATA. First i'm retrieving the list of actors with some additional information such as birth date, birth place from Dbpedia using SPARQL and using the same list of actors which are retrieved from Dbpedia, i'm trying to retrieve some additional information such as awards received. My python code is throwing an error.
I have a hunch that the dbpedia portion of the query is timing out within wikidata. Skipping the federated binding and adding a limit, the query goes to completion, but takes several seconds. Un-comment the triple about the awards, and it times out.
Since there are problems with the SPARQL, I'm going to ignore the Python processing for now.
Independent of that, I found two glitches:
# missing prefixes
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT *
WHERE {
SERVICE <http://dbpedia.org/sparql> {
?c rdf:type <http://umbel.org/umbel/rc/Actor> ;
rdfs:label ?Actor
FILTER ( lang(?Actor) = "en" )
?c dbo:deathDate ?Death_date ;
dbo:birthPlace ?b
# date filterning not working... add cast
FILTER ( xsd:date(?Death_date) >= "1990 - 01 - 01"^^xsd:date )
?b rdfs:label ?birth_Place
FILTER ( lang(?birth_Place) = "en" )
?Starring rdf:type dbo:Film ;
dbo:starring ?c .
?c dbo:deathCause ?d .
?d dbp:name ?Cause_Of_Death .
?c owl:sameAs ?wikidata_actor
FILTER strstarts(str(?wikidata_actor), "http://www.wikidata.org")
}
# ?wikidata_actor wdt:P166 ?award_received.
}
LIMIT 9
Every SPARQL endpoint has its own unique personality. So in my opinion, federated queries (which use the service
keyword and hit two or more endpoints) can be especially tricky. In case you're new to federation, here's an unrelated query that works.
There is some entity that tweets under the name 'darwilliamstour'. What is the name of that entity?
select *
where
{
?twitterer wdt:P2002 'darwilliamstour' .
service <http://dbpedia.org/sparql>
{
?twitterer rdfs:label ?name
}
}