Using this Freebase query as an example, how can I run the same query using the Wikidata api?
[{
"id": null,
"name": null,
"type": "/film/film",
"/film/film/directed_by": "Steven Spielberg",
"/film/film/genre": "Drama",
"/film/film/story_by": [],
"starring": [{
"actor": [{
"name": "Tom Hanks",
"key": [{
"namespace": "/authority/imdb/name",
"value": null
}]
}]
}],
"/film/film/initial_release_date>": "2000",
"/film/film/initial_release_date<": "2003"
}]
Thank you.
You can not do it with the Wikidata API, however you can do it with Wikidata Query Service. Here's an example query:
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
SELECT ?film ?filmLabel ?date WHERE {
# Is a film
?film wdt:P31 wd:Q11424 .
# Director is Steven Spielberg
?film wdt:P57 wd:Q8877 .
# genre is drama film
# ?film wdt:P136 wd:Q130232 .
# Starring Tom Hanks
?film wdt:P161 wd:Q2263 .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
# published on date
?film wdt:P577 ?date .
FILTER(year(?date)>2000 && year(?date)<2003)
}
You can try it here. Note that I commented out the genre check. This is because Wikidata does not have any films with your criteria and genre "drama", but does have one film which is published at given date and is filmed by Spielberg and includes Tom Hanks:
wd:Q208108* Catch Me If You Can 2002-01-01T00:00:00Z
You can find more links to documentation at the service home page and user manual, and also Query Service community pages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With