0

If possible, i want to return the results in Json or XML format. Is there any ways to do so? Earlier I did it using freebase.com but it is now deprecated. Please help.

Termininja
  • 6,620
  • 12
  • 48
  • 49

2 Answers2

1

This query would look a lot like the one to get the list of all films on Wikidata but adding another filter:

instead of http://wdq.wmflabs.org/api?q=claim[31:11424] (return all the entities marked as instances of film), you would do

  • http://wdq.wmflabs.org/api?q=claimCLAIM[31:11424] AND CLAIM[495:884] (return all the entities marked as instances of film and South Korea (Q884) as country of origin (P495))
  • http://wdq.wmflabs.org/api?q=claimCLAIM[31:11424] AND CLAIM[495:423] (the same for North Korea (Q423))

Then to parse the results and get the entities data, it would be the same as for the list of all the films

Remarques:

  • you will probably need to encode those URLs to get something that looks like: http://wdq.wmflabs.org/api?q=CLAIM%5B31%3A11424%5D%20AND%20CLAIM%5B495%3A884%5D

  • here is the full API documentation. Notice that this is an experimental API, which might be replaced in the coming year

Community
  • 1
  • 1
maxlath
  • 1,804
  • 15
  • 24
  • Thank you so much. It worked. But i am getting quite less number of films when compared to what we see on wikipedia. This is because, many movie don't have "country of origin" property. Is there any alternative to get all the movies. Is it possible to get movie details from the page "list of korean cinemas"? – Ajay Pandith Sep 03 '15 at 11:07
  • It's probably mostly due to the fact that the data is still incomplete: for instance, https://www.wikidata.org/wiki/Q4890852 is missing a P495 statement at the moment, so it won't appear in the query results – maxlath Sep 03 '15 at 11:24
  • So now, is there any alternative? To get details of all the korean films? The wiki list article "list of korean cinema" or "cinema of korea" has links to all the films. Can I make use of it and query? – Ajay Pandith Sep 03 '15 at 12:01
0

The overview on Wikipedia may be more complete than Wikidata, as you've noticed yourself also. However, I could only find overviews per year, such as on https://en.wikipedia.org/wiki/List_of_South_Korean_films_of_2015.

To get a list of titles from that page, you would first retreive the raw wikicode of the page: https://en.wikipedia.org/w/index.php?action=raw&title=List_of_South_Korean_films_of_2015, and then run a regular expression such as /\{lang\|[^\|]+\|([^\}]+)/g on the code.

This returns a list of 149 titles.

Peter
  • 2,874
  • 2
  • 31
  • 42