maxlath / wikibase-dump-filter

Filter and format a newline-delimited JSON stream of Wikibase entities
97 stars 15 forks source link

Filter formatting #24

Closed YovaKem closed 4 years ago

YovaKem commented 4 years ago

Is it possible to format the following query into a valid filter somehow?

SELECT ?work ?workLabel
WHERE
{
  ?work wdt:P31/wdt:P279* wd:Q43229. # instance of any subclass of work of art
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

I want to get all entities that are instances of a subclass (of a subclass, etc.) of organizations.

maxlath commented 4 years ago

so you could in theory get the list of all 14498 recursive sub-classes of organization, and write a long claim option filter such as:

echo 'P31:Q55190098,Q54814599,Q53858112,Q53828709,Q53361238' > ./claim
cat entities.json | wikidata-filter --claim ./claim > organizations.ndjson

but, while I could't experience it myself, it might get slow (cf #14)

YovaKem commented 4 years ago

Thanks, I did that and speed doesn't seem to be a problem.