query-3318672975cb704fc37e86ef4826c6a6
instance_of=fire department (Q6498663); Brazil (Q155) SELECT DISTINCT ?item ?itemLabel ?countryLabel ?jurisdictionLabel ?operating_areaLabel ?official_website WHERE { VALUES ?instances_of { wd:Q6498663 } ?item (p:P31/ps:P31/(wdt:P279*)) ?instances_of; wdt:P17 ?country; p:P17 ?statement1. ?statement1 ps:P17 wd:Q155. # Q155 = Brazil; Change here to select another country OPTIONAL { ?item wdt:P1001 ?jurisdiction. } OPTIONAL { ?item wdt:P2541 ?operating_area. } OPTIONAL { ?item wdt:P856 ?official_website. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de,fr,ru,es,ja,zh,ar". } } ORDER BY (?countryLabel) (?jurisdictionLabel) (?operating_areaLabel) LIMIT 5000
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# instance_of=fire department (Q6498663); Brazil (Q155)
SELECT DISTINCT ?item ?itemLabel ?countryLabel ?jurisdictionLabel ?operating_areaLabel ?official_website WHERE {
VALUES ?instances_of {
wd:Q6498663
}
?item (p:P31/ps:P31/(wdt:P279*)) ?instances_of;
wdt:P17 ?country;
p:P17 ?statement1.
?statement1 ps:P17 wd:Q155. # Q155 = Brazil; Change here to select another country
OPTIONAL { ?item wdt:P1001 ?jurisdiction. }
OPTIONAL { ?item wdt:P2541 ?operating_area. }
OPTIONAL { ?item wdt:P856 ?official_website. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de,fr,ru,es,ja,zh,ar". }
}
ORDER BY (?countryLabel) (?jurisdictionLabel) (?operating_areaLabel)
LIMIT 5000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?country")
v1("?countryLabel"):::projected
v4("?instances_of")
v5("?item"):::projected
v8("?jurisdiction")
v2("?jurisdictionLabel"):::projected
v10("?official_website"):::projected
v9("?operating_area")
v3("?operating_areaLabel"):::projected
v7("?statement1")
a1((" "))
a2((" "))
c14(["#91;AUTO_LANGUAGE#93;,en,de,fr,ru,es,ja,zh,ar"]):::literal
c12(["bd:serviceParam"]):::iri
c7(["wd:Q155"]):::iri
bind0[/VALUES ?instances_of/]
bind0-->v4
bind00(["wd:Q6498663"])
bind00 --> bind0
v5 --"p:P31"--> a1
a1 --"p:statement/P31"--> a2
a2 --"p:direct/P279"--> v4
v5 --"p:direct/P17"--> v6
v5 --"p:P17"--> v7
v7 --"p:statement/P17"--> c7
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P1001".-> v8
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P2541".-> v9
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P856".-> v10
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end