mediawiki - Wikidata query service traverse property -


i trying list of hyperonymes of given wikidata item. instance want traverse "subclass of" element https://www.wikidata.org/wiki/q4421

how sparql command https://query.wikidata.org like?

you can use property path (*) syntax.

in case wdt:p279* mention 0 or more time wdt:p279 subclass of equivalent in wikidata model.

i added few variation here include depth can order them

select ?entity ?entitylabel (count(?mid) ?depth) {   wd:q4421 wdt:p279* ?mid.   ?mid wdt:p279* ?entity   service wikibase:label { bd:serviceparam wikibase:language "en" } } group ?entity ?entitylabel order ?depth 

https://query.wikidata.org/#select%20%3fentity%20%3fentitylabel%20%28count%28%3fmid%29%20as%20%3fdepth%29%20where%20%7b%0a%20%20wd%3aq4421%20wdt%3ap279%2a%20%3fmid.%0a%20%20%3fmid%20wdt%3ap279%2a%20%3fentity%0a%20%20service%20wikibase%3alabel%20%7b%0a%20%20%20%20bd%3aserviceparam%20wikibase%3alanguage%20%22en%22%20.%0a%20%20%20%7d%0a%7d%20group%20by%20%3fentity%20%3fentitylabel%0aorder%20by%20%3fdepth


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -