query-7d12a708c4a341e220103758dc138d9a
f. # classes
SELECT (COUNT(DISTINCT ?class) as ?nb_classes)
WITH
{
SELECT DISTINCT ?item
WHERE
{
?item wdt:P279* wd:Q181388 .
# ?item wdt:P641 wd:Q847 .
}
} as %a
{
INCLUDE %a
?item (wdt:P31|wdt:P279) ?class
}
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
# f. # classes
SELECT (COUNT(DISTINCT ?class) as ?nb_classes)
{
{
SELECT DISTINCT ?item
WHERE
{
?item wdt:P279* wd:Q181388 .
# ?item wdt:P641 wd:Q847 .
}
}
?item (wdt:P31|wdt:P279) ?class
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?class"):::projected
v1("?item")
v3("?nb_classes")
c2(["wd:Q181388"]):::iri
v1 --"wdt:P279"--> c2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P279"--> v2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> v2
end
union0r <== or ==> union0l
end
bind1[/"count(?class)"/]
v2 --o bind1
bind1 --as--o v3