query-c4a817362c2b0eb0acb3b0129bc2c4ec
Category metadata select distinct ?item ?category ?categoryLabel ?P31Label ?topic ?topicLabel ?list ?listLabel ?commons_sitelink where { { ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . # ambassador or high commissioner ?item wdt:P910 ?category . optional { ?category wdt:P31 ?P31 . } optional { ?category wdt:P301 ?topic . } optional { ?category wdt:P1753 ?list . } optional { ?commons_sitelink schema:about ?category ; schema:isPartOf https://commons.wikinedia.org/ . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
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 schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Category metadata
select distinct ?item ?category ?categoryLabel ?P31Label ?topic ?topicLabel ?list ?listLabel ?commons_sitelink where
{
{ ?item wdt:P31 wd:Q18115939 . } union { ?item wdt:P31 wd:Q56760832 } . # ambassador or high commissioner
?item wdt:P910 ?category .
optional { ?category wdt:P31 ?P31 . }
optional { ?category wdt:P301 ?topic . }
optional { ?category wdt:P1753 ?list . }
optional { ?commons_sitelink schema:about ?category ;
schema:isPartOf <https://commons.wikinedia.org/> . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?P31")
v2("?category"):::projected
v6("?commons_sitelink"):::projected
v1("?item"):::projected
v5("?list"):::projected
v4("?topic"):::projected
c2(["wd:Q18115939"]):::iri
c3(["wd:Q56760832"]):::iri
c11(["bd:serviceParam"]):::iri
c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c9([https://commons.wikinedia.org/]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c2
end
union0r <== or ==> union0l
end
v1 --"wdt:P910"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P31".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P301".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P1753".-> v5
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v6 -."schema:about".-> v2
v6 --"schema:isPartOf"--> c9
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end