dev2win
dev2win

Reputation: 11

Problem with basics queries form dbpedia with sparql

Why can get results with this query:

SELECT *
              WHERE {
                ?person rdfs:label "Kirk Douglas"@en;
                dbo:birthPlace ?place. # With dbp: too
              }

but not with another one:


SELECT *
              WHERE {
                ?person rdfs:label "Kirk Douglas"@en;
                dbo:starring ?film.
              }

I'm following tags in https://dbpedia.org/page/Kirk_Douglas

Some tip to understand it.

Thx!

Upvotes: 1

Views: 65

Answers (1)

logi-kal
logi-kal

Reputation: 7880

In dbr:Kirk_Douglas you can read:

dbo:birthPlace     dbr:Amsterdam_(city),_New_York
...
is dbo:starring of dbr:The_Light_at_the_Edge_of_the_World
                   dbr:Cast_a_Giant_Shadow
                   dbr:Two-Fisted_Tales_(film)
                   ...

where is dbo:starring of is a way of simulating an inverse property for dbo:starring.

Indeed, in dbo:starring you can read:

rdfs:domain dbo:Work
...
rdfs:range dbo:Actor

This means that you shouldn't build triples like ?actor dbo:starring ?work, while ?work dbo:starring ?actor is a valid triple.

So your query should be something like:

SELECT *
WHERE {
  ?person rdfs:label "Kirk Douglas"@en .
  ?film dbo:starring ?person .
}

Upvotes: 1

Related Questions