1

Is there a way to restrict the returned claims on wikidata's REST API? For example I am using this query:

https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q17714&props=claims&format=json&languages=de|en

which returns all claims for the entity. But I am only interested in "P31", for example. It seems excessive to download the whole set. Any ideas?

  • it's not that excessive to download the entire file (in this case less than 200KB), and then filter locally. – philshem Apr 17 '18 at 14:35
  • 1
    wikidata.org/w/… ? Better learn SPARQL. – Stanislav Kralin Apr 17 '18 at 14:50
1

Following Stanislavs comment: It is possible using the REST SPARQL Endpoint at

https://query.wikidata.org/sparql?query=SPARQL

The query would be:

SELECT ?instanceof ?instanceofLabel WHERE {
 wd:Q17714 wdt:P31 ?instanceof.
 SERVICE wikibase:label {
  bd:serviceParam wikibase:language 'de' .
 }
}

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.