query-ad77181533d0f67b68840c55fad91462
Propertiesinstance of (P31)
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?class ?classLabel ?cnt
WHERE {
{
SELECT ?class (count(*) as ?cnt)
WHERE {
SELECT DISTINCT ?item ?class
WHERE {
{
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "www.wikidata.org";
wikibase:api "Generator";
mwapi:generator "search";
mwapi:gsrsearch "inlabel:university of California, davis"@en;
mwapi:gsrlimit "max".
?item wikibase:apiOutputItem mwapi:title. }
?item wdt:P31 ?class.
} UNION {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "www.wikidata.org";
wikibase:api "Generator";
mwapi:generator "search";
mwapi:gsrsearch "inlabel:UC Davis"@en;
mwapi:gsrlimit "max".
?item wikibase:apiOutputItem mwapi:title. }
?item wdt:P31 ?class.
} } #order by ?item ?class limit 300
} group by ?class order by ?class
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by?classLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?class"):::projected
v1("?classLabel"):::projected
v4("?cnt"):::projected
v3("?item")
c4(["www.wikidata.org"]):::literal
c12(["max"]):::literal
c16([sinlabel:UC Davis^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>"]):::literal
c8(["search"]):::literal
c2(["bd:serviceParam"]):::iri
c10([sinlabel:university of California, davis^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>"]):::literal
c19(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c14(["mwapi:title"]):::iri
c6(["Generator"]):::literal
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:endpoint"--> c4
c2 --"mwapi:api"--> c6
c2 --"mwapi:generator"--> c8
c2 --"mwapi:gsrsearch"--> c16
c2 --"mwapi:gsrlimit"--> c12
v3 --"mwapi:apiOutputItem"--> c14
end
v3 --"wdt:P31"--> v2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:endpoint"--> c4
c2 --"mwapi:api"--> c6
c2 --"mwapi:generator"--> c8
c2 --"mwapi:gsrsearch"--> c10
c2 --"mwapi:gsrlimit"--> c12
v3 --"mwapi:apiOutputItem"--> c14
end
v3 --"wdt:P31"--> v2
end
union0r <== or ==> union0l
end
bind1[/"count(*)"/]
bind1 --as--o v4
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c2 --"mwapi:language"--> c19
end