query-2dd7d03e977f4f7ab03daa6d0fc29ef6
Propertiesinstance of (P31)
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?class ?classLabel ?ExternalID ?ExternalIDLabel (COUNT(*) AS ?count) WHERE {
{
SELECT DISTINCT ?x WHERE {
VALUES ?c {wd:Q84263196 wd:Q81068910 wd:Q82069695}
{?c ?p ?x} UNION {?x ?p ?c}
}
}
?x wdt:P31 ?class.
?x ?p1 ?y.
?ExternalID wikibase:directClaim ?p1.
?ExternalID wikibase:propertyType wikibase:ExternalId.
?class rdfs:label ?classLabel.
FILTER(LANG(?classLabel)="en")
?ExternalID rdfs:label ?ExternalIDLabel.
FILTER(LANG(?ExternalIDLabel)="en")
}
GROUP BY ?class ?classLabel ?ExternalID ?ExternalIDLabel
ORDER BY DESC(?count)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?ExternalID"):::projected
v2("?ExternalIDLabel"):::projected
v4("?c")
v7("?class"):::projected
v3("?classLabel"):::projected
v11("?count")
v5("?p")
v8("?p1")
v6("?x")
v9("?y")
c5(["wikibase:ExternalId"]):::iri
f0[["?ExternalIDLabel = 'en'"]]
f0 --> v2
f1[["?classLabel = 'en'"]]
f1 --> v3
bind2[/VALUES ?c/]
bind2-->v4
bind20(["wd:Q84263196"])
bind20 --> bind2
bind21(["wd:Q81068910"])
bind21 --> bind2
bind22(["wd:Q82069695"])
bind22 --> bind2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v6 -->v5--> v4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 -->v5--> v6
end
union0r <== or ==> union0l
end
v6 --"wdt:P31"--> v7
v6 -->v8--> v9
v10 --"wikibase:directClaim"--> v8
v10 --"wikibase:propertyType"--> c5
v7 --"rdfs:label"--> v3
v10 --"rdfs:label"--> v2
bind4[/"count(*)"/]
bind4 --as--o v11