Getting list of actors from dbpedia using SPARQL -


i have trying solve task have retrieve list of actors given film name. new both sparql , dbpedia.

after reading tutorials, far have following:

prefix dbpo: <http://dbpedia.org/ontology/>  select ?actor_name {   service <http://dbpedia.org/sparql> {     "total recall" dbpo:movietitle  ?moviename .     ?moviename dbpo:actor ?actor.     ?actor dbpo:actor_name ?actor_name.   } } 

perhaps getting names wrong.

on general note, how should go finding specific service points dbpedia, such 1 described in question.

i'm not sure getting properties using in query, don't appear used on relevant resources. additional problem that, although sparql allows triple pattern, literals can't subjects of rdf triples, you'd need in order match

"total recall" dbpo:movietitle  ?moviename . 

this triple, if legal, assertion string "total recall" has movie title, , bind variable ?moviename title. string isn't movie though, wouldn't have movie title, either.

in particular case, take @ information dbpedia has on total recall visiting

you'll see triples of form

dbpprop:starring dbpedia:ronny_cox dbpprop:starring dbpedia:arnold_schwarzenegger 

which suggests you'd want query like:

select ?actorname {    ?film rdfs:label "total recall"@en ;         dbpprop:starring ?actor .   ?actor rdfs:label ?actorname .   filter(langmatches(lang(?actorname),"en")) } 

sparql results

that query suitable plugging public dbpedia sparql endpoint, if you're running locally , want use service keyword federate query, service <http://dbpedia.org/sparql>:

prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix dbpprop: <http://dbpedia.org/property/>  select ?actorname {    service <http://dbpedia.org/sparql> {     ?film rdfs:label "total recall"@en ;           dbpprop:starring ?actor .     ?actor rdfs:label ?actorname .     filter(langmatches(lang(?actorname),"en"))   } } 

in general, 1 of best ways see kinds of classes , properties used in dbpedia exploit fact dbpedia has naming convention resources, discussed in dbpedia resource name standard, given wikipedia article xyz, can retrieve http://dbpedia.org/resource/xyz , @ data. ontology classes , properties, can see documentation ontology, , browse ontology classes. interactive queries, public sparql endpoint useful.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -