0

I am trying to get filtered data from the Wikidata API, currently I can do a general search using this API, but now there have been specific cases where I have to filter this information, for example, I need to get a list of only authors to get the Q identifier and although I also reviewed the Wikidata Query Service this is too heavy to bring all the items, I used a SPARQL query and did a test and to get less than 3000 results it took 26 seconds, this is too much for a search service.

This is the query I use to get the authors.

SELECT DISTINCT ?author ?authorLabel WITH {
  SELECT ?item ?author WHERE {
    ?item wdt:P50 ?author.
  } LIMIT 100000
} AS %FOO {
  INCLUDE %FOO
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

I also need to search by categories but it has not been possible for me to filter the searches in any way, does anyone know a way to do it?

logi-kal
  • 7,107
  • 6
  • 31
  • 43
  • I have no idea what you're trying to do. The query as is gets you (in theory) all works and their respective authors. That's a few (hundred) million, which is why it times out. – Matthias Winkelmann Jul 29 '21 at 21:27
  • I am trying to develop an advanced search using Wikidata, I need to be able to search for work and filter them by authors, but first I must be able to obtain a list of authors, unfortunately when trying to obtain the list and due to the type of SPARQL queries they return time out. – Daniel Lopez Jul 30 '21 at 15:59

0 Answers0