query-c76fcb04ba0dea26b1f0c30d9afeb762

rq turtle/ttl

expected_result_count: 991 SELECT DISTINCT ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country WHERE { BIND(wd:Q31 AS ?country) { VALUES ?type { wd:Q2288140 # Federal Scientific Institutes (13) wd:Q107637441 # Public Institution of Social Security (12) wd:Q3356161 # Public Interest Organizations (16) wd:Q1846372 # Federal Public Service (11) wd:Q1788820 # defence ministry (1) wd:Q21004446 # Public Planning Service (3) wd:Q17373496 # language areas (4) wd:Q89934 # communities (3) wd:Q83057 # regions (4) wd:Q83116 # extant provinces (10) wd:Q2621126 # police zones (182) wd:Q3575878 # emergency zones (35) wd:Q493522 # municipalities (581) wd:Q190752 # supreme court (2) wd:Q32766 # constitutional court (1) wd:Q2570643 # senate (1) wd:Q375928 # lower house (1) wd:Q17627622 # community and regional parliament (5) } ?org wdt:P31 ?type; wdt:P17 ?country . } UNION { VALUES ?type { wd:Q121856465 # delegations (8) wd:Q112307194 # consulate generals (15) wd:Q3917681 # embassies (83) } ?org wdt:P31 ?type; wdt:P137 ?country . } UNION { VALUES ?type { wd:Q5244910 # de facto embassy (1) } ?org wdt:P31 ?type; wdt:P17 wd:Q865; wdt:P137 ?country . } MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } MINUS { ?org wdt:P582 [] } MINUS { ?org wdt:P571 ?date . FILTER (DATATYPE(?date) = xsd:dateTime && ?date > now()) }

BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid)

SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nl,fr,de" } } ORDER BY ?type ?orgLabel

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
# expected_result_count: 991
SELECT DISTINCT
?qid
?orgLabel
?orgDescription
?type
?typeLabel
?country
WHERE {
   BIND(wd:Q31 AS ?country)
{
  VALUES ?type {
    wd:Q2288140 # Federal Scientific Institutes (13)
    wd:Q107637441 # Public Institution of Social Security (12)
    wd:Q3356161 # Public Interest Organizations (16)
    wd:Q1846372 # Federal Public Service (11)
    wd:Q1788820 # defence ministry (1)
    wd:Q21004446 # Public Planning Service (3)
    wd:Q17373496 # language areas (4)
    wd:Q89934 # communities (3)
    wd:Q83057 # regions (4)
    wd:Q83116 # extant provinces (10)
    wd:Q2621126 # police zones (182)
    wd:Q3575878 # emergency zones (35)
    wd:Q493522 # municipalities (581)
    wd:Q190752 # supreme court (2)
    wd:Q32766 # constitutional court (1)
    wd:Q2570643 # senate (1)
    wd:Q375928 # lower house (1)
    wd:Q17627622 # community and regional parliament (5)
}
?org wdt:P31 ?type; wdt:P17 ?country .
}
UNION
{
  VALUES ?type {
    wd:Q121856465 # delegations (8)
    wd:Q112307194 # consulate generals (15)
    wd:Q3917681 # embassies (83)
}
?org wdt:P31 ?type; wdt:P137 ?country .
}
UNION
{
  VALUES ?type {
    wd:Q5244910 #  de facto embassy (1)
  }
  ?org wdt:P31 ?type; wdt:P17 wd:Q865; wdt:P137 ?country .
}
  MINUS { ?org wdt:P576 [] }
  MINUS { ?org wdt:P1366 [] }
  MINUS { ?org wdt:P582 [] }
  MINUS { ?org wdt:P571 ?date . FILTER (DATATYPE(?date) = xsd:dateTime && ?date > now()) }

  BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid)

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nl,fr,de" }
}
ORDER BY ?type ?orgLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?country"):::projected v5("?date") v4("?org") v2("?orgLabel"):::projected v6("?qid"):::projected v5("?type"):::projected a1((" ")) a2((" ")) a3((" ")) c13(["en,nl,fr,de"]):::literal c11(["bd:serviceParam"]):::iri c4(["wd:Q865"]):::iri bind0[/"'wd:Q31'"/] bind0 --as--o v3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; bind1[/VALUES ?type/] bind1-->v5 bind10(["wd:Q5244910"]) bind10 --> bind1 v4 --"wdt:P31"--> v5 v4 --"wdt:P17"--> c4 v4 --"wdt:P137"--> v3 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; bind2[/VALUES ?type/] bind2-->v5 bind20(["wd:Q121856465"]) bind20 --> bind2 bind21(["wd:Q112307194"]) bind21 --> bind2 bind22(["wd:Q3917681"]) bind22 --> bind2 v4 --"wdt:P31"--> v5 v4 --"wdt:P137"--> v3 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; bind3[/VALUES ?type/] bind3-->v5 bind30(["wd:Q2288140"]) bind30 --> bind3 bind31(["wd:Q107637441"]) bind31 --> bind3 bind32(["wd:Q3356161"]) bind32 --> bind3 bind33(["wd:Q1846372"]) bind33 --> bind3 bind34(["wd:Q1788820"]) bind34 --> bind3 bind35(["wd:Q21004446"]) bind35 --> bind3 bind36(["wd:Q17373496"]) bind36 --> bind3 bind37(["wd:Q89934"]) bind37 --> bind3 bind38(["wd:Q83057"]) bind38 --> bind3 bind39(["wd:Q83116"]) bind39 --> bind3 bind310(["wd:Q2621126"]) bind310 --> bind3 bind311(["wd:Q3575878"]) bind311 --> bind3 bind312(["wd:Q493522"]) bind312 --> bind3 bind313(["wd:Q190752"]) bind313 --> bind3 bind314(["wd:Q32766"]) bind314 --> bind3 bind315(["wd:Q2570643"]) bind315 --> bind3 bind316(["wd:Q375928"]) bind316 --> bind3 bind317(["wd:Q17627622"]) bind317 --> bind3 v4 --"wdt:P31"--> v5 v4 --"wdt:P17"--> v3 end union0r <== or ==> union0l end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v4 --"wdt:P576"--> a1 end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v4 --"wdt:P1366"--> a2 end subgraph minus6["MINUS"] style minus6 stroke-width:6px,fill:pink,stroke:red; v4 --"wdt:P582"--> a3 end subgraph minus7["MINUS"] style minus7 stroke-width:6px,fill:pink,stroke:red; f8[["?date = 'xsd:dateTime'?date > NOW()"]] f8 --> v5 v4 --"wdt:P571"--> v5 end bind9[/"replace(str(?org),'http://www.wikidata.org/entity/','')"/] v4 --o bind9 bind9 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end