Search code examples
sparqldbpediaquerying

How to get films starring for one actor in dbpedia sparql?


I have the following code where I get the starring for all films selected:

SELECT ?f ?starring
WHERE {
?f rdf:type dbo:Film .
?f dbo:starring ?starring
}

Is there a way where I can get films of specific starring (actor) like "Tom Hanks" for example?


Solution

  • Just add the DBpedia resource representing the actor, as the object of the tipple pattern:

    SELECT ?f 
    WHERE {
    ?f rdf:type dbo:Film .
    ?f dbo:starring dbr:Tom_Hanks .
    }