How to require a Wikidata class or any subclass?

Hi,

In my naive first approach for a " How to get started with ShEx on Wikidata? " help page [1], I try to verify that every item with a certain exernal id is an organization or some subtype of organization. With a SPARQL query [2], that is quite straightforward - using a property path - and reveals relevant results.

However, in ShEx I have not been able to create a query to recursively check if an instance is attached to any subclass of a given class. It would be great if somebody could help out. My starting point was this [3].

Cheers, Joachim

PS. While the restriction "some class or a subclass of it" will be probably quite common in Wikidata, organization (wd:Q43229) may not be the best demo example for an introduction: Currently it has more than 19,000 subclasses [4] - often indeed instances. It may however serve as a nasty case for tests.


[1] https://www.wikidata.org/wiki/User:Jneubert/How_to_get_started_with_ShEx_on_Wikidata%3F
[2] https://www.wikidata.org/wiki/User:Jneubert/Special_queries#PM20_type_%22co/%22_which_are_not_an_organization
[3] https://rawgit.com/shexSpec/shex.js/wikidata/doc/shex-simple.html?manifestURL=https://raw.githubusercontent.com/jneubert/wd-shex-test/master/dummy.manifest.json
[4] http://zbw.eu/beta/sparql-lab/?endpoint=https://query.wikidata.org/bigdata/namespace/wdq/sparql&queryRef=https://api.github.com/repos/zbw/sparql-queries/contents/wikidata/all_subclasses.rq

Received on Wednesday, 20 June 2018 17:11:28 UTC