diff --git a/jargon.txt b/jargon.txt index 57d8fe323a5..ce8a68ab579 100644 --- a/jargon.txt +++ b/jargon.txt @@ -280,3 +280,8 @@ urlencoded iglob RequestException str +fieldOfWorkList +fieldOfWorks +orgWork +orgWork +orgWork diff --git a/queries/generators/austria.rq b/queries/generators/austria.rq index 45a077ce190..c05bbf84d26 100644 --- a/queries/generators/austria.rq +++ b/queries/generators/austria.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q40 AS ?country) @@ -33,8 +34,14 @@ WHERE { } } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/bermuda.rq b/queries/generators/bermuda.rq index 44ba594fd09..756ff979b88 100644 --- a/queries/generators/bermuda.rq +++ b/queries/generators/bermuda.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q23635 AS ?country) @@ -21,8 +22,14 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/cameroon.rq b/queries/generators/cameroon.rq index 04a29835a2d..0a79b41bf32 100644 --- a/queries/generators/cameroon.rq +++ b/queries/generators/cameroon.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q1009 AS ?country) VALUES ?type { @@ -19,7 +20,14 @@ WHERE { ?org wdt:P17 ?country . MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,mul" } } -ORDER BY ?type ?orgLabel \ No newline at end of file +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country +ORDER BY ?type ?orgLabel diff --git a/queries/generators/canada.rq b/queries/generators/canada.rq index 04d4df98992..9dc4b4af8f5 100644 --- a/queries/generators/canada.rq +++ b/queries/generators/canada.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q16 AS ?country) @@ -22,8 +23,14 @@ WHERE { MINUS { ?org wdt:P1366 [] } MINUS { ?org wdt:P582 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/chile.rq b/queries/generators/chile.rq index dc2b99e7635..079548864a1 100644 --- a/queries/generators/chile.rq +++ b/queries/generators/chile.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q298 AS ?country) { @@ -31,12 +31,13 @@ WHERE { MINUS { ?org wdt:P1366 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,es". } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/cuba.rq b/queries/generators/cuba.rq index 029d769499f..fff5a2a89a1 100644 --- a/queries/generators/cuba.rq +++ b/queries/generators/cuba.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q241 AS ?country) @@ -21,8 +22,14 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/czech-republic.rq b/queries/generators/czech-republic.rq index 31655c4c67d..63289846798 100644 --- a/queries/generators/czech-republic.rq +++ b/queries/generators/czech-republic.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q213 AS ?country) @@ -22,8 +23,14 @@ WHERE { MINUS { ?org wdt:P1366 [] } MINUS { ?org wdt:P582 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,cs,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/denmark.rq b/queries/generators/denmark.rq index a55584e52a2..aa559cb977d 100644 --- a/queries/generators/denmark.rq +++ b/queries/generators/denmark.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q35 AS ?country) VALUES ?type { @@ -23,12 +23,13 @@ WHERE { MINUS { ?org wdt:P571 ?start . FILTER (?start > NOW() ) } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,mul". } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?topic diff --git a/queries/generators/east-timor.rq b/queries/generators/east-timor.rq index 25cb2264226..ed74df41dfc 100644 --- a/queries/generators/east-timor.rq +++ b/queries/generators/east-timor.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q574 AS ?country) @@ -23,8 +24,14 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt,tet,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/finland.rq b/queries/generators/finland.rq index 6b4524c89c3..3302e6985e4 100644 --- a/queries/generators/finland.rq +++ b/queries/generators/finland.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q33 AS ?country) { @@ -30,8 +31,14 @@ UNION MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fi,sv,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/germany.rq b/queries/generators/germany.rq index e79ebac6a6a..ccb66ed45fd 100644 --- a/queries/generators/germany.rq +++ b/queries/generators/germany.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q183 AS ?country) { @@ -37,12 +37,13 @@ WHERE { MINUS { ?org wdt:P3999 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,mul". } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?topic diff --git a/queries/generators/ghana.rq b/queries/generators/ghana.rq index 96f237198b9..9603490859f 100644 --- a/queries/generators/ghana.rq +++ b/queries/generators/ghana.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q117 AS ?country) @@ -24,12 +24,13 @@ WHERE { MINUS { ?org wdt:P3999 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ak,mul". } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?topic diff --git a/queries/generators/greenland.rq b/queries/generators/greenland.rq index 550b39414fe..87b1c71bca0 100644 --- a/queries/generators/greenland.rq +++ b/queries/generators/greenland.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q223 AS ?country) @@ -22,12 +22,13 @@ WHERE { MINUS { ?org wdt:P3999 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,kl,da,mul". } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?topic diff --git a/queries/generators/iceland.rq b/queries/generators/iceland.rq index 26db1ac5058..bc1c1fc2f85 100644 --- a/queries/generators/iceland.rq +++ b/queries/generators/iceland.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q189 AS ?country) VALUES ?type { @@ -22,8 +23,14 @@ WHERE { MINUS { ?org wdt:P1366 [] } MINUS { ?org p:P31 ?s . ?s ps:P31 wd:Q955655 . ?s pq:P582 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,is,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/india.rq b/queries/generators/india.rq index 2627c17fcfb..7414567bd72 100644 --- a/queries/generators/india.rq +++ b/queries/generators/india.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q668 AS ?country) VALUES ?type { @@ -22,12 +22,13 @@ WHERE { MINUS { ?org wdt:P3999 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,hi,mul". } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?topic diff --git a/queries/generators/indonesia.rq b/queries/generators/indonesia.rq index 8d211be0c65..8997efa9e49 100644 --- a/queries/generators/indonesia.rq +++ b/queries/generators/indonesia.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q252 AS ?country) @@ -23,8 +24,14 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,id,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/ireland.rq b/queries/generators/ireland.rq index 72619efaccd..1002bfdb9fd 100644 --- a/queries/generators/ireland.rq +++ b/queries/generators/ireland.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q27 AS ?country) { @@ -27,12 +27,13 @@ UNION MINUS { ?org wdt:P3999 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ga,mul". } } -ORDER BY ?type ?topic \ No newline at end of file +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country +ORDER BY ?type ?topic diff --git a/queries/generators/latvia.rq b/queries/generators/latvia.rq index ad65f872c7b..e46bfd0970b 100644 --- a/queries/generators/latvia.rq +++ b/queries/generators/latvia.rq @@ -6,8 +6,9 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog -WHERE { BIND(wd:Q211 AS ?country) + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) +WHERE { + BIND(wd:Q211 AS ?country) { VALUES ?type { wd:Q3345345 # Municipality of Latvia (35) @@ -27,11 +28,14 @@ WHERE { BIND(wd:Q211 AS ?country) MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } MINUS { ?org wdt:P3999 [] } + OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,lv,mul". } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?topic diff --git a/queries/generators/luxembourg.rq b/queries/generators/luxembourg.rq index a5a083110f2..7c88e7c8e78 100644 --- a/queries/generators/luxembourg.rq +++ b/queries/generators/luxembourg.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q32 AS ?country) @@ -34,9 +35,15 @@ WHERE { pq:P582 ?end ]. } - + + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,lb,de,fr,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/malaysia.rq b/queries/generators/malaysia.rq index 36bba683ebb..d99e8b8c794 100644 --- a/queries/generators/malaysia.rq +++ b/queries/generators/malaysia.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q833 AS ?country) @@ -22,8 +23,14 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ms,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/malta.rq b/queries/generators/malta.rq index 329f35a27e3..4549c22fe67 100644 --- a/queries/generators/malta.rq +++ b/queries/generators/malta.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q233 AS ?country) @@ -20,8 +21,14 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mt,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/morocco.rq b/queries/generators/morocco.rq index ea61c00c780..520b05f001c 100644 --- a/queries/generators/morocco.rq +++ b/queries/generators/morocco.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q1028 AS ?country) { @@ -30,9 +31,15 @@ WHERE { MINUS { ?org wdt:P1366 [] } MINUS { ?org wdt:P3999 [] } MINUS { ?org wdt:P31 wd:Q19953632. } - + + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,ar,zgh,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/nepal.rq b/queries/generators/nepal.rq index 410bd2e9711..79441424868 100644 --- a/queries/generators/nepal.rq +++ b/queries/generators/nepal.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q837 AS ?country) @@ -22,9 +23,14 @@ WHERE { MINUS { ?org wdt:P1366 [] } MINUS { ?org wdt:P582 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ne,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/netherlands.rq b/queries/generators/netherlands.rq index 610a3648818..960622df579 100644 --- a/queries/generators/netherlands.rq +++ b/queries/generators/netherlands.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q55 AS ?country) @@ -58,8 +59,14 @@ WHERE { FILTER ( ?start > NOW() ) } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nl,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/new-zealand.rq b/queries/generators/new-zealand.rq index b661b394f80..fd33b90bd8b 100644 --- a/queries/generators/new-zealand.rq +++ b/queries/generators/new-zealand.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q664 AS ?country) @@ -30,11 +30,12 @@ WHERE { MINUS { ?org wdt:P3999 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mi,mul" } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - -} ORDER BY ?typeLabel +} +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country +ORDER BY ?typeLabel diff --git a/queries/generators/norway.rq b/queries/generators/norway.rq index 7085b95d8e7..09b721fd83a 100644 --- a/queries/generators/norway.rq +++ b/queries/generators/norway.rq @@ -6,7 +6,6 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog WHERE { BIND(wd:Q20 AS ?country) @@ -36,12 +35,13 @@ WHERE { MINUS { ?org wdt:P3999 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nb,no,nn,mul". } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?topic diff --git a/queries/generators/peru.rq b/queries/generators/peru.rq index db7fa41a470..b75ca8c1c46 100644 --- a/queries/generators/peru.rq +++ b/queries/generators/peru.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q419 AS ?country) VALUES ?type { @@ -13,11 +14,19 @@ WHERE { wd:Q861184 # regions (25) wd:Q509686 # provinces (196) } - ?org wdt:P31 ?type . + +?org wdt:P31 ?type . MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,qu,ay,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/philippines.rq b/queries/generators/philippines.rq index 1b884270b39..401074a6368 100644 --- a/queries/generators/philippines.rq +++ b/queries/generators/philippines.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q928 AS ?country) @@ -25,8 +26,14 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org p:P1366 ?r . MINUS { ?r pq:P582 [] } } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,tl,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/portugal.rq b/queries/generators/portugal.rq index 3d33e68e30b..35fa292d131 100644 --- a/queries/generators/portugal.rq +++ b/queries/generators/portugal.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q45 AS ?country) @@ -25,14 +25,15 @@ WHERE { MINUS { ?org wdt:P1366 [] } MINUS { ?org wdt:P3999 [] } MINUS { ?org p:P31 ?p . ?p pq:P582 ?edate . FILTER (DATATYPE(?edate) = xsd:dateTime && ?edate < now())} - + OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt,mul". } } -ORDER BY ?typeLabel ?topic \ No newline at end of file +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country +ORDER BY ?typeLabel ?topic diff --git a/queries/generators/russia.rq b/queries/generators/russia.rq index c66073ae372..7c314e97da0 100644 --- a/queries/generators/russia.rq +++ b/queries/generators/russia.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q159 AS ?country) @@ -25,8 +26,14 @@ WHERE { } } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ru,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/singapore.rq b/queries/generators/singapore.rq index 14ccd2c20e0..88f27f43359 100644 --- a/queries/generators/singapore.rq +++ b/queries/generators/singapore.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q334 AS ?country) @@ -24,8 +25,14 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,tl,ms,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/south-africa.rq b/queries/generators/south-africa.rq index 52008992765..bcf1a35fd3e 100644 --- a/queries/generators/south-africa.rq +++ b/queries/generators/south-africa.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q258 AS ?country) @@ -27,12 +27,13 @@ WHERE { MINUS { ?org wdt:P3999 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,af,zu,nr,nso,st,ss,ts,tn,ve,xh,mul". } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY DESC(?type) diff --git a/queries/generators/sweden.rq b/queries/generators/sweden.rq index 7095d009e92..a4660ec9ce3 100644 --- a/queries/generators/sweden.rq +++ b/queries/generators/sweden.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q34 AS ?country) @@ -53,11 +53,13 @@ WHERE { MINUS { ?org wdt:P3999 [] } OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,sv,mul" } - BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) + BIND(REPLACE(STR(?org), STR(wd:), "") AS ?qid) -} ORDER BY ?typeLabel +} +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country +ORDER BY ?typeLabel diff --git a/queries/generators/switzerland.rq b/queries/generators/switzerland.rq index 225a9cb0887..6798c017ff1 100644 --- a/queries/generators/switzerland.rq +++ b/queries/generators/switzerland.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q39 AS ?country) @@ -23,9 +24,14 @@ WHERE { MINUS { ?org wdt:P582 [] } MINUS { ?org wdt:P571 ?date . FILTER (DATATYPE(?date) = xsd:dateTime && ?date > now()) } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,it,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/ukraine.rq b/queries/generators/ukraine.rq index 1e1a184be25..3555d1e9cd3 100644 --- a/queries/generators/ukraine.rq +++ b/queries/generators/ukraine.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q212 AS ?country) @@ -22,8 +23,14 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,uk,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/united-kingdom.rq b/queries/generators/united-kingdom.rq index 85425acdc8f..33546781166 100644 --- a/queries/generators/united-kingdom.rq +++ b/queries/generators/united-kingdom.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q145 AS ?country) @@ -21,10 +21,11 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/united-kingdom/scotland.rq b/queries/generators/united-kingdom/scotland.rq index 7de311f11fd..3810fd95eea 100644 --- a/queries/generators/united-kingdom/scotland.rq +++ b/queries/generators/united-kingdom/scotland.rq @@ -6,7 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country - ?cofog + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q145 AS ?country) @@ -61,10 +61,11 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) OPTIONAL { - ?org wdt:P9798/wdt:P279* ?cofog . - MINUS { ?cofog wdt:P279 [] } + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date } SERVICE wikibase:label { bd:serviceParam wikibase:language "en,sco,gd,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/generators/uruguay.rq b/queries/generators/uruguay.rq index ccc17e3379d..ef8718378cb 100644 --- a/queries/generators/uruguay.rq +++ b/queries/generators/uruguay.rq @@ -6,6 +6,7 @@ SELECT DISTINCT ?type ?typeLabel ?country + (GROUP_CONCAT(DISTINCT ?fieldOfWork; separator=",") AS ?fieldOfWorkList) WHERE { BIND(wd:Q77 AS ?country) VALUES ?type { @@ -15,8 +16,15 @@ WHERE { ?org wdt:P31 ?type . MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } + + OPTIONAL { + ?org wdt:P101 ?fieldOfWork . + # TODO: check for end date + } + BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,mul" } } +GROUP BY ?qid ?orgLabel ?orgDescription ?type ?typeLabel ?country ORDER BY ?type ?orgLabel diff --git a/queries/topics.rq b/queries/topics.rq index 5e98f31039c..5e700b0174f 100644 --- a/queries/topics.rq +++ b/queries/topics.rq @@ -1,14 +1,8 @@ SELECT DISTINCT * WHERE { - VALUES (?class ?safeName ?name) { - (wd:Q108107925 "general-public-services" "General Public Services") - (wd:Q108107955 "defense" "Defense") - (wd:Q108107969 "public-order-safety" "Public order and safety") - (wd:Q108107990 "economic-affairs" "Economic affairs") - (wd:Q108108058 "environmental-protection" "Environmental protection") - (wd:Q108108075 "housing-community-amenities" "Housing and community amenities") - (wd:Q108108099 "health" "Health") - (wd:Q108108141 "recreation-culture-religion" "Recreation, culture, and religion") - (wd:Q108108158 "education" "Education") - (wd:Q108108190 "social-protection" "Social protection") + VALUES (?safeName ?name) { + ("defense" "Defense") + ("environmental-protection" "Environmental protection") + ("health" "Health") + ("education" "Education") } -} ORDER BY ?class \ No newline at end of file +} ORDER BY ?class diff --git a/queries/topics/defense.rq b/queries/topics/defense.rq new file mode 100644 index 00000000000..18cbe3fb83a --- /dev/null +++ b/queries/topics/defense.rq @@ -0,0 +1,10 @@ +SELECT DISTINCT * WHERE { + VALUES (?field) { + (wd:Q451987) + (wd:Q2351849) + (wd:Q1791716) + (wd:Q18643213) + (wd:Q1985622) + (wd:Q501700) + } +} diff --git a/queries/topics/education.rq b/queries/topics/education.rq new file mode 100644 index 00000000000..7119504114c --- /dev/null +++ b/queries/topics/education.rq @@ -0,0 +1,7 @@ +SELECT DISTINCT * WHERE { + VALUES (?field) { + (wd:Q136822) + (wd:Q2351849) + (wd:Q8434) + } +} diff --git a/queries/topics/environmental-protection.rq b/queries/topics/environmental-protection.rq new file mode 100644 index 00000000000..e316b1c4390 --- /dev/null +++ b/queries/topics/environmental-protection.rq @@ -0,0 +1,18 @@ +SELECT DISTINCT * WHERE { + VALUES (?field) { + (wd:Q832237) + (wd:Q219416) + (wd:Q20113959) + (wd:Q1774427) + (wd:Q12705) + (wd:Q43619) + (wd:Q1640238) + (wd:Q7937) + (wd:Q47041) + (wd:Q25261) + (wd:Q42250) + (wd:Q7942) + (wd:Q125928) + (wd:Q2249676) + } +} diff --git a/queries/topics/health.rq b/queries/topics/health.rq new file mode 100644 index 00000000000..4b17c6a7daf --- /dev/null +++ b/queries/topics/health.rq @@ -0,0 +1,8 @@ +SELECT DISTINCT * WHERE { + VALUES (?field) { + (wd:Q11190) + (wd:Q31207) + (wd:Q334911) + (wd:Q317309) + } +} diff --git a/templates/topic-page.html b/templates/topic-page.html index 9fe7a521a14..59b876e24cd 100644 --- a/templates/topic-page.html +++ b/templates/topic-page.html @@ -26,7 +26,7 @@

Agencies

{{- $countries := query "countries.rq" -}} -{{- $topic := .class -}} +{{- $topics := query (join "" "topics/" .safeName ".rq") -}} @@ -41,13 +41,23 @@

Agencies

{{- $countryLabel := .name.String -}} {{- $orgs := query (join "" "generators/" $country ".rq") -}} {{- range $orgs -}} - {{- if eq $topic .cofog -}} - - - - - - + {{- $org := . -}} + {{- $fieldOfWorks := split .fieldOfWorkList "," -}} + {{/* check if any of the field of works match any of the topics */}} + {{- range $fieldOfWorks -}} + {{- $orgWork := . -}} + {{- range $topics -}} + {{- if ne $orgWork "" -}} + {{- if eq .field (uri $orgWork) -}} + + + + + + + {{- end -}} + {{- end -}} + {{- end -}} {{- end -}} {{- end -}} {{- end -}}
{{ .orgLabel }}{{ include "components/social-icons.html" .qid.String }}{{ .typeLabel }}{{ $countryLabel }}
{{ $org.orgLabel }}{{ include "components/social-icons.html" $org.qid.String }}{{ $org.typeLabel }}{{ $countryLabel }}