query-bebf074693450fa0990a59d6c84c9486
Number of identifier properties by class and type
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?classes ?type (COUNT(DISTINCT ?p) as ?count) WHERE {
SELECT DISTINCT ?p ?type (GROUP_CONCAT(?class) AS ?classes) WHERE {
{
# Wikidata property with datatype external identifier
?p wikibase:propertyType wikibase:ExternalId .
BIND ('I' AS ?class)
} UNION {
# Wikidata property for a unique identifier
SELECT DISTINCT ?p ?class {
?p wdt:P31/wdt:P279* wd:Q19847637 .
BIND ('U' AS ?class)
}
}
?p wikibase:propertyType ?type .
# SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?p ?type
} GROUP BY ?classes ?type
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?class")
v4("?classes"):::projected
v5("?count")
v1("?p"):::projected
v3("?type"):::projected
a1((" "))
c5(["wd:Q19847637"]):::iri
c2(["wikibase:ExternalId"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c5
bind0[/"'U'"/]
bind0 --as--o v3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wikibase:propertyType"--> c2
bind1[/"'I'"/]
bind1 --as--o v3
end
union0r <== or ==> union0l
end
v1 --"wikibase:propertyType"--> v3
bind3[/"?class"/]
v3 --o bind3
bind3 --as--o v4
bind5[/"count(?p)"/]
v1 --o bind5
bind5 --as--o v5