query-ebd2168d9d2257519b22b726c1470b1d
title: Query to retrieve all current government agencies of Jamaica (as of July 2024) (should be 126) SELECT DISTINCT ?item ?itemLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". } { SELECT DISTINCT ?item WHERE { ?item p:P31 ?statement0. ?statement0 (ps:P31) wd:Q327333. ?item p:P17 ?statement1. ?statement1 (ps:P17) wd:Q766. MINUS { ?item wdt:P576 [] } MINUS { ?item wdt:P1366 [] } } } }
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#>
#title: Query to retrieve all current government agencies of Jamaica (as of July 2024) (should be 126)
SELECT DISTINCT ?item ?itemLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
{
SELECT DISTINCT ?item WHERE {
?item p:P31 ?statement0.
?statement0 (ps:P31) wd:Q327333.
?item p:P17 ?statement1.
?statement1 (ps:P17) wd:Q766.
MINUS { ?item wdt:P576 [] }
MINUS { ?item wdt:P1366 [] }
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v2("?statement0")
v3("?statement1")
a1((" "))
a2((" "))
c2(["bd:serviceParam"]):::iri
c7(["wd:Q327333"]):::iri
c4(["#91;AUTO_LANGUAGE#93;"]):::literal
c10(["wd:Q766"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v1 --"p:P31"--> v2
v2 --"p:statement/P31"--> c7
v1 --"p:P17"--> v3
v3 --"p:statement/P17"--> c10
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v1 --"p:direct/P576"--> a1
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v1 --"p:direct/P1366"--> a2
end