query-fcb5e11d5ec04827e78b4b8099d7bdec
Best way to go about getting all "classes" that have atleast one {?thing wdt:P31/wdt:P279 ?class} relationshipHi, I'm building an interface for performing simple SPARQL queries on Wikidata. I need an autocomplete feature for this, for which I've used the Wikidata query service thus far. However, I only want to list wikidata entries that have at least one entry that is an instance- or subclass of that first entry. .09:06, 25 March 2020 (UTC)) at contribs • talk (Matsjsk comment was added byunsignedThe preceding – Should I download a dump and set up my own index? If this is possible to do using SPARQL or some other service, that would be greatly preferrable. : There are 69548 direct classes:Matsjsk@
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT distinct ?class WHERE {
?item wdt:P31 ?class.
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?class"):::projected
v1("?item")
v1 --"wdt:P31"--> v2