diff --git a/ADD_A_COUNTRY.md b/ADD_A_COUNTRY.md index f8662952ec9..df1c2998330 100644 --- a/ADD_A_COUNTRY.md +++ b/ADD_A_COUNTRY.md @@ -56,7 +56,10 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,sv" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + OPTIONAL { ?org rdfs:label ?orgLabelSv FILTER(LANG(?orgLabelSv) = "sv") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, ?orgLabelSv, STR(?org)) AS ?orgLabel) } ORDER BY ?type ?orgLabel ``` @@ -108,7 +111,10 @@ These values are all of the various "instance of"/types the various government o ```sparql - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,sv" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + OPTIONAL { ?org rdfs:label ?orgLabelSv FILTER(LANG(?orgLabelSv) = "sv") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, ?orgLabelSv, STR(?org)) AS ?orgLabel) ``` All government organizations in a country might not have a name in English and therefore one should configure one or more fallback languages. In the example above Swedish is set as a fallback language. @@ -173,13 +179,23 @@ WHERE { ?wikipedia schema:about ?uri ; schema:isPartOf . } - SERVICE wikibase:label { - # this might need to be updated when new countries are added - bd:serviceParam wikibase:language "en,mul,sv,de" . - ?headOfState rdfs:label ?headOfStateLabel . - ?headOfGov rdfs:label ?headOfGovLabel . - ?typeOfGov rdfs:label ?typeOfGovLabel . - } + OPTIONAL { ?headOfState rdfs:label ?headOfStateLabelEn FILTER(LANG(?headOfStateLabelEn) = "en") } + OPTIONAL { ?headOfState rdfs:label ?headOfStateLabelMul FILTER(LANG(?headOfStateLabelMul) = "mul") } + OPTIONAL { ?headOfState rdfs:label ?headOfStateLabelSv FILTER(LANG(?headOfStateLabelSv) = "sv") } + OPTIONAL { ?headOfState rdfs:label ?headOfStateLabelDe FILTER(LANG(?headOfStateLabelDe) = "de") } + BIND(COALESCE(?headOfStateLabelEn, ?headOfStateLabelMul, ?headOfStateLabelSv, ?headOfStateLabelDe) AS ?headOfStateLabel) + + OPTIONAL { ?headOfGov rdfs:label ?headOfGovLabelEn FILTER(LANG(?headOfGovLabelEn) = "en") } + OPTIONAL { ?headOfGov rdfs:label ?headOfGovLabelMul FILTER(LANG(?headOfGovLabelMul) = "mul") } + OPTIONAL { ?headOfGov rdfs:label ?headOfGovLabelSv FILTER(LANG(?headOfGovLabelSv) = "sv") } + OPTIONAL { ?headOfGov rdfs:label ?headOfGovLabelDe FILTER(LANG(?headOfGovLabelDe) = "de") } + BIND(COALESCE(?headOfGovLabelEn, ?headOfGovLabelMul, ?headOfGovLabelSv, ?headOfGovLabelDe) AS ?headOfGovLabel) + + OPTIONAL { ?typeOfGov rdfs:label ?typeOfGovLabelEn FILTER(LANG(?typeOfGovLabelEn) = "en") } + OPTIONAL { ?typeOfGov rdfs:label ?typeOfGovLabelMul FILTER(LANG(?typeOfGovLabelMul) = "mul") } + OPTIONAL { ?typeOfGov rdfs:label ?typeOfGovLabelSv FILTER(LANG(?typeOfGovLabelSv) = "sv") } + OPTIONAL { ?typeOfGov rdfs:label ?typeOfGovLabelDe FILTER(LANG(?typeOfGovLabelDe) = "de") } + BIND(COALESCE(?typeOfGovLabelEn, ?typeOfGovLabelMul, ?typeOfGovLabelSv, ?typeOfGovLabelDe) AS ?typeOfGovLabel) } GROUP BY ?uri ?name ?safeName ?description ?parts ?headOfGovLabel ?headOfStateLabel ?geoshape ?wikipedia ORDER BY ?name diff --git a/queries/account-data.rq b/queries/account-data.rq index 83938e514f9..71eb3e91a88 100644 --- a/queries/account-data.rq +++ b/queries/account-data.rq @@ -21,7 +21,9 @@ WHERE { BIND(IRI(REPLACE(?formatter, '\\$1', ?value)) AS ?url) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } + OPTIONAL { ?platform rdfs:label ?platformLabelEn FILTER(LANG(?platformLabelEn) = "en") } + OPTIONAL { ?platform rdfs:label ?platformLabelMul FILTER(LANG(?platformLabelMul) = "mul") } + BIND(COALESCE(?platformLabelEn, ?platformLabelMul, STR(?platform)) AS ?platformLabel) } # we order by property to ensure a consistent order, we use the URI as its incremental ID is the best indication of "importance" we have ORDER BY ?property diff --git a/queries/countries.rq b/queries/countries.rq index c6b8b3a5637..bb0f6026eb1 100644 --- a/queries/countries.rq +++ b/queries/countries.rq @@ -4,8 +4,8 @@ SELECT ?safeName ?description ?parts - (SAMPLE(?website) AS ?website) - (SAMPLE(?nativeLabel) AS ?nativeLabel) + (SAMPLE(?website_) AS ?website) + (SAMPLE(?nativeLabel_) AS ?nativeLabel) (GROUP_CONCAT(DISTINCT ?typeOfGovLabel; separator=",") AS ?typeOfGovList) ?headOfStateLabel ?headOfGovLabel @@ -59,42 +59,54 @@ WHERE { (wd:Q145 'United Kingdom' 'united-kingdom' 'Current content includes ministerial departments.' 'Scotland|scotland') (wd:Q22 'Scotland' 'united-kingdom/scotland' 'Current content includes executive agencies, executive non-departmental public bodies, advisory non-departmental public bodies, non-ministerial offices,local authorities, NHS boards, courts, public corporations, tribunals, parole boards, King\'s printer, commissioners, ombudsmen, Health and social care partnerships and government of Scotland.' '') - + (wd:Q30 'United States' 'united-states' 'Current content includes departments, Executive Office of the President, legislative branch agencies, interstate compacts for low-level radioactive waste and energy, offices of small and disadvantaged business utilization, representations, consulates, consulate generals and embassies.' 'New York|new-york,North Carolina|north-carolina') (wd:Q1454 'North Carolina' 'united-states/north-carolina' 'Current content includes the general assembly, cabinet, council of state, counties, county election boards, state agencies, supreme and appellate courts.' '') (wd:Q1384 'New York' 'united-states/new-york' 'Current content includes state agencies and counties.' '') - + } + OPTIONAL { ?uri wdt:P3896 ?geoshape . } + OPTIONAL { ?wikipedia schema:about ?uri ; schema:isPartOf . } + OPTIONAL { - ?uri wdt:P856 ?website . - ?uri wdt:P37 ?lang . - OPTIONAL { - ?uri p:P856 ?ws . - ?ws pq:P407 ?language . - FILTER (?language IN (?lang, wd:Q1860 )) - } + ?uri wdt:P856 ?website_ . + ?uri p:P856 [ ps:P856 ?website_; pq:P407 ?language ] . + FILTER (?language IN (wd:Q1860, wdt:P37)) + } + + OPTIONAL { + ?uri wdt:P1705 ?nativeLabel_ . + ?uri wdt:P37/wdt:P424 ?langCode . + FILTER(LANG(?nativeLabel_) = ?langCode) } - OPTIONAL { ?uri wdt:P35 ?headOfState } - OPTIONAL { ?uri wdt:P6 ?headOfGov } - OPTIONAL { ?uri wdt:P122 ?typeOfGov } - OPTIONAL { ?uri wdt:P1705 ?nativeLabel . ?lang wdt:P424 ?langCode . FILTER(LANG(?nativeLabel)=?langCode) } OPTIONAL { - ?uri wdt:P3896 ?geoshape . + ?uri wdt:P35 ?headOfState . + OPTIONAL { ?headOfState rdfs:label ?hos_en FILTER(LANG(?hos_en) = "en") } + OPTIONAL { ?headOfState rdfs:label ?hos_sv FILTER(LANG(?hos_sv) = "sv") } + OPTIONAL { ?headOfState rdfs:label ?hos_de FILTER(LANG(?hos_de) = "de") } + OPTIONAL { ?headOfState rdfs:label ?hos_mul FILTER(LANG(?hos_mul) = "mul") } + BIND(COALESCE(?hos_en, ?hos_sv, ?hos_de, ?hos_mul, STR(?headOfState)) AS ?headOfStateLabel) } OPTIONAL { - ?wikipedia schema:about ?uri ; - schema:isPartOf . + ?uri wdt:P6 ?headOfGov . + OPTIONAL { ?headOfGov rdfs:label ?hog_en FILTER(LANG(?hog_en) = "en") } + OPTIONAL { ?headOfGov rdfs:label ?hog_sv FILTER(LANG(?hog_sv) = "sv") } + OPTIONAL { ?headOfGov rdfs:label ?hog_de FILTER(LANG(?hog_de) = "de") } + OPTIONAL { ?headOfGov rdfs:label ?hog_mul FILTER(LANG(?hog_mul) = "mul") } + BIND(COALESCE(?hog_en, ?hog_sv, ?hog_de, ?hog_mul, STR(?headOfGov)) AS ?headOfGovLabel) } - SERVICE wikibase:label { - # this might need to be updated when new countries are added - bd:serviceParam wikibase:language "en,sv,de,mul" . - ?headOfState rdfs:label ?headOfStateLabel . - ?headOfGov rdfs:label ?headOfGovLabel . - ?typeOfGov rdfs:label ?typeOfGovLabel . + + OPTIONAL { + ?uri wdt:P122 ?typeOfGov . + OPTIONAL { ?typeOfGov rdfs:label ?tog_en FILTER(LANG(?tog_en) = "en") } + OPTIONAL { ?typeOfGov rdfs:label ?tog_sv FILTER(LANG(?tog_sv) = "sv") } + OPTIONAL { ?typeOfGov rdfs:label ?tog_de FILTER(LANG(?tog_de) = "de") } + OPTIONAL { ?typeOfGov rdfs:label ?tog_mul FILTER(LANG(?tog_mul) = "mul") } + BIND(COALESCE(?tog_en, ?tog_sv, ?tog_de, ?tog_mul, STR(?typeOfGov)) AS ?typeOfGovLabel) } } GROUP BY ?uri ?name ?safeName ?description ?parts ?headOfGovLabel ?headOfStateLabel ?geoshape ?wikipedia -ORDER BY ?name +ORDER BY ?name \ No newline at end of file diff --git a/queries/generators/austria.rq b/queries/generators/austria.rq index 45a077ce190..6d207c23481 100644 --- a/queries/generators/austria.rq +++ b/queries/generators/austria.rq @@ -35,6 +35,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelDe FILTER(LANG(?orgLabelDe) = "de") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelDe, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescDe FILTER(LANG(?orgDescDe) = "de") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescDe, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelDe FILTER(LANG(?typeLabelDe) = "de") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelDe, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/bangladesh.rq b/queries/generators/bangladesh.rq index 4a2fb0a2ac7..2ae09957c14 100644 --- a/queries/generators/bangladesh.rq +++ b/queries/generators/bangladesh.rq @@ -36,6 +36,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,bn" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + OPTIONAL { ?org rdfs:label ?orgLabelBn FILTER(LANG(?orgLabelBn) = "bn") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, ?orgLabelBn, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + OPTIONAL { ?org schema:description ?orgDescBn FILTER(LANG(?orgDescBn) = "bn") } + BIND(COALESCE(?orgDescEn, ?orgDescMul, ?orgDescBn) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + OPTIONAL { ?type rdfs:label ?typeLabelBn FILTER(LANG(?typeLabelBn) = "bn") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, ?typeLabelBn, STR(?type)) AS ?typeLabel) } ORDER BY ?typeLabel ?orgLabel diff --git a/queries/generators/belgium.rq b/queries/generators/belgium.rq index 7e8d7fe9587..142f1bd8d31 100644 --- a/queries/generators/belgium.rq +++ b/queries/generators/belgium.rq @@ -47,6 +47,25 @@ UNION BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,nl,fr,de" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + OPTIONAL { ?org rdfs:label ?orgLabelNl FILTER(LANG(?orgLabelNl) = "nl") } + OPTIONAL { ?org rdfs:label ?orgLabelFr FILTER(LANG(?orgLabelFr) = "fr") } + OPTIONAL { ?org rdfs:label ?orgLabelDe FILTER(LANG(?orgLabelDe) = "de") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, ?orgLabelNl, ?orgLabelFr, ?orgLabelDe, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + OPTIONAL { ?org schema:description ?orgDescNl FILTER(LANG(?orgDescNl) = "nl") } + OPTIONAL { ?org schema:description ?orgDescFr FILTER(LANG(?orgDescFr) = "fr") } + OPTIONAL { ?org schema:description ?orgDescDe FILTER(LANG(?orgDescDe) = "de") } + BIND(COALESCE(?orgDescEn, ?orgDescMul, ?orgDescNl, ?orgDescFr, ?orgDescDe) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + OPTIONAL { ?type rdfs:label ?typeLabelNl FILTER(LANG(?typeLabelNl) = "nl") } + OPTIONAL { ?type rdfs:label ?typeLabelFr FILTER(LANG(?typeLabelFr) = "fr") } + OPTIONAL { ?type rdfs:label ?typeLabelDe FILTER(LANG(?typeLabelDe) = "de") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, ?typeLabelNl, ?typeLabelFr, ?typeLabelDe, STR(?type)) AS ?typeLabel) } ORDER BY ?typeLabel ?orgLabel diff --git a/queries/generators/bermuda.rq b/queries/generators/bermuda.rq index 44ba594fd09..3e63b648166 100644 --- a/queries/generators/bermuda.rq +++ b/queries/generators/bermuda.rq @@ -23,6 +23,16 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/bulgaria.rq b/queries/generators/bulgaria.rq index 3c934c216ee..7fd2485653e 100644 --- a/queries/generators/bulgaria.rq +++ b/queries/generators/bulgaria.rq @@ -34,6 +34,20 @@ WHERE { MINUS { ?org wdt:P576 [] } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,bg". } + + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + OPTIONAL { ?org rdfs:label ?orgLabelBg FILTER(LANG(?orgLabelBg) = "bg") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, ?orgLabelBg, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + OPTIONAL { ?org schema:description ?orgDescBg FILTER(LANG(?orgDescBg) = "bg") } + BIND(COALESCE(?orgDescEn, ?orgDescMul, ?orgDescBg) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + OPTIONAL { ?type rdfs:label ?typeLabelBg FILTER(LANG(?typeLabelBg) = "bg") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, ?typeLabelBg, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/cameroon.rq b/queries/generators/cameroon.rq index 04a29835a2d..0c53f6178d4 100644 --- a/queries/generators/cameroon.rq +++ b/queries/generators/cameroon.rq @@ -20,6 +20,20 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,mul" } + + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelFr FILTER(LANG(?orgLabelFr) = "fr") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelFr, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescFr FILTER(LANG(?orgDescFr) = "fr") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescFr, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelFr FILTER(LANG(?typeLabelFr) = "fr") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelFr, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel \ No newline at end of file diff --git a/queries/generators/canada.rq b/queries/generators/canada.rq index 04d4df98992..02af2b675bd 100644 --- a/queries/generators/canada.rq +++ b/queries/generators/canada.rq @@ -24,6 +24,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelFr FILTER(LANG(?orgLabelFr) = "fr") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelFr, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescFr FILTER(LANG(?orgDescFr) = "fr") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescFr, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelFr FILTER(LANG(?typeLabelFr) = "fr") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelFr, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/chile.rq b/queries/generators/chile.rq index dc2b99e7635..f6b69eb8d25 100644 --- a/queries/generators/chile.rq +++ b/queries/generators/chile.rq @@ -37,6 +37,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,es". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + OPTIONAL { ?org rdfs:label ?orgLabelEs FILTER(LANG(?orgLabelEs) = "es") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, ?orgLabelEs, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + OPTIONAL { ?org schema:description ?orgDescEs FILTER(LANG(?orgDescEs) = "es") } + BIND(COALESCE(?orgDescEn, ?orgDescMul, ?orgDescEs) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + OPTIONAL { ?type rdfs:label ?typeLabelEs FILTER(LANG(?typeLabelEs) = "es") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, ?typeLabelEs, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/cuba.rq b/queries/generators/cuba.rq index 029d769499f..640997a9022 100644 --- a/queries/generators/cuba.rq +++ b/queries/generators/cuba.rq @@ -23,6 +23,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelEs FILTER(LANG(?orgLabelEs) = "es") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelEs, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescEs FILTER(LANG(?orgDescEs) = "es") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescEs, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelEs FILTER(LANG(?typeLabelEs) = "es") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelEs, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/cyprus.rq b/queries/generators/cyprus.rq index 60589b58b02..a62ee337715 100644 --- a/queries/generators/cyprus.rq +++ b/queries/generators/cyprus.rq @@ -27,6 +27,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,el" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + OPTIONAL { ?org rdfs:label ?orgLabelEl FILTER(LANG(?orgLabelEl) = "el") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, ?orgLabelEl, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + OPTIONAL { ?org schema:description ?orgDescEl FILTER(LANG(?orgDescEl) = "el") } + BIND(COALESCE(?orgDescEn, ?orgDescMul, ?orgDescEl) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + OPTIONAL { ?type rdfs:label ?typeLabelEl FILTER(LANG(?typeLabelEl) = "el") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, ?typeLabelEl, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel \ No newline at end of file diff --git a/queries/generators/czech-republic.rq b/queries/generators/czech-republic.rq index 31655c4c67d..427ab1de6d8 100644 --- a/queries/generators/czech-republic.rq +++ b/queries/generators/czech-republic.rq @@ -24,6 +24,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,cs,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelCs FILTER(LANG(?orgLabelCs) = "cs") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelCs, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescCs FILTER(LANG(?orgDescCs) = "cs") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescCs, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelCs FILTER(LANG(?typeLabelCs) = "cs") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelCs, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/denmark.rq b/queries/generators/denmark.rq index 8dc94c78ac2..c5bed0d6c28 100644 --- a/queries/generators/denmark.rq +++ b/queries/generators/denmark.rq @@ -32,6 +32,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,mul". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelDa FILTER(LANG(?orgLabelDa) = "da") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelDa, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescDa FILTER(LANG(?orgDescDa) = "da") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescDa, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelDa FILTER(LANG(?typeLabelDa) = "da") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelDa, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?topic diff --git a/queries/generators/east-timor.rq b/queries/generators/east-timor.rq index 25cb2264226..db283737040 100644 --- a/queries/generators/east-timor.rq +++ b/queries/generators/east-timor.rq @@ -25,6 +25,22 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt,tet,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelPt FILTER(LANG(?orgLabelPt) = "pt") } + OPTIONAL { ?org rdfs:label ?orgLabelTet FILTER(LANG(?orgLabelTet) = "tet") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelPt, ?orgLabelTet, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescPt FILTER(LANG(?orgDescPt) = "pt") } + OPTIONAL { ?org schema:description ?orgDescTet FILTER(LANG(?orgDescTet) = "tet") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescPt, ?orgDescTet, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelPt FILTER(LANG(?typeLabelPt) = "pt") } + OPTIONAL { ?type rdfs:label ?typeLabelTet FILTER(LANG(?typeLabelTet) = "tet") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelPt, ?typeLabelTet, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/eswatini.rq b/queries/generators/eswatini.rq index 6a12c98979a..6529353d370 100644 --- a/queries/generators/eswatini.rq +++ b/queries/generators/eswatini.rq @@ -34,6 +34,16 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/european-union.rq b/queries/generators/european-union.rq index 0bd577bce80..568024b39e5 100644 --- a/queries/generators/european-union.rq +++ b/queries/generators/european-union.rq @@ -28,6 +28,16 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/finland.rq b/queries/generators/finland.rq index 6b4524c89c3..0657a4dade6 100644 --- a/queries/generators/finland.rq +++ b/queries/generators/finland.rq @@ -32,6 +32,22 @@ UNION BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fi,sv,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelFi FILTER(LANG(?orgLabelFi) = "fi") } + OPTIONAL { ?org rdfs:label ?orgLabelSv FILTER(LANG(?orgLabelSv) = "sv") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelFi, ?orgLabelSv, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescFi FILTER(LANG(?orgDescFi) = "fi") } + OPTIONAL { ?org schema:description ?orgDescSv FILTER(LANG(?orgDescSv) = "sv") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescFi, ?orgDescSv, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelFi FILTER(LANG(?typeLabelFi) = "fi") } + OPTIONAL { ?type rdfs:label ?typeLabelSv FILTER(LANG(?typeLabelSv) = "sv") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelFi, ?typeLabelSv, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/germany.rq b/queries/generators/germany.rq index e79ebac6a6a..00d0d7dfb22 100644 --- a/queries/generators/germany.rq +++ b/queries/generators/germany.rq @@ -43,6 +43,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,mul". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelDe FILTER(LANG(?orgLabelDe) = "de") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelDe, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescDe FILTER(LANG(?orgDescDe) = "de") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescDe, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelDe FILTER(LANG(?typeLabelDe) = "de") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelDe, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?topic diff --git a/queries/generators/ghana.rq b/queries/generators/ghana.rq index 96f237198b9..6862b458ec7 100644 --- a/queries/generators/ghana.rq +++ b/queries/generators/ghana.rq @@ -30,6 +30,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ak,mul". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelAk FILTER(LANG(?orgLabelAk) = "ak") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelAk, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescAk FILTER(LANG(?orgDescAk) = "ak") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescAk, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelAk FILTER(LANG(?typeLabelAk) = "ak") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelAk, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?topic diff --git a/queries/generators/greenland.rq b/queries/generators/greenland.rq index 550b39414fe..cc10493ae01 100644 --- a/queries/generators/greenland.rq +++ b/queries/generators/greenland.rq @@ -28,6 +28,22 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,kl,da,mul". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelKl FILTER(LANG(?orgLabelKl) = "kl") } + OPTIONAL { ?org rdfs:label ?orgLabelDa FILTER(LANG(?orgLabelDa) = "da") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelKl, ?orgLabelDa, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescKl FILTER(LANG(?orgDescKl) = "kl") } + OPTIONAL { ?org schema:description ?orgDescDa FILTER(LANG(?orgDescDa) = "da") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescKl, ?orgDescDa, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelKl FILTER(LANG(?typeLabelKl) = "kl") } + OPTIONAL { ?type rdfs:label ?typeLabelDa FILTER(LANG(?typeLabelDa) = "da") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelKl, ?typeLabelDa, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?topic diff --git a/queries/generators/iceland.rq b/queries/generators/iceland.rq index 26db1ac5058..fd31fef1ca2 100644 --- a/queries/generators/iceland.rq +++ b/queries/generators/iceland.rq @@ -24,6 +24,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,is,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelIs FILTER(LANG(?orgLabelIs) = "is") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelIs, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionIs FILTER(LANG(?orgDescriptionIs) = "is") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionIs, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelIs FILTER(LANG(?typeLabelIs) = "is") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelIs, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/india.rq b/queries/generators/india.rq index 2627c17fcfb..55b985233a1 100644 --- a/queries/generators/india.rq +++ b/queries/generators/india.rq @@ -28,6 +28,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,hi,mul". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelHi FILTER(LANG(?orgLabelHi) = "hi") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelHi, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionHi FILTER(LANG(?orgDescriptionHi) = "hi") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionHi, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelHi FILTER(LANG(?typeLabelHi) = "hi") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelHi, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?topic diff --git a/queries/generators/indonesia.rq b/queries/generators/indonesia.rq index 0f2ee4d4b8b..b465ba39b66 100644 --- a/queries/generators/indonesia.rq +++ b/queries/generators/indonesia.rq @@ -40,6 +40,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,id,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelId FILTER(LANG(?orgLabelId) = "id") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelId, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescId FILTER(LANG(?orgDescId) = "id") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescId, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelId FILTER(LANG(?typeLabelId) = "id") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelId, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/ireland.rq b/queries/generators/ireland.rq index 72619efaccd..6012fc335e0 100644 --- a/queries/generators/ireland.rq +++ b/queries/generators/ireland.rq @@ -33,6 +33,19 @@ UNION BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ga,mul". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelGa FILTER(LANG(?orgLabelGa) = "ga") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelGa, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescGa FILTER(LANG(?orgDescGa) = "ga") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescGa, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelGa FILTER(LANG(?typeLabelGa) = "ga") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelGa, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?topic \ No newline at end of file diff --git a/queries/generators/japan.rq b/queries/generators/japan.rq index 7194f9b404a..eb3dd361891 100644 --- a/queries/generators/japan.rq +++ b/queries/generators/japan.rq @@ -28,6 +28,19 @@ UNION BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,ja" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + OPTIONAL { ?org rdfs:label ?orgLabelJa FILTER(LANG(?orgLabelJa) = "ja") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, ?orgLabelJa, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + OPTIONAL { ?org schema:description ?orgDescriptionJa FILTER(LANG(?orgDescriptionJa) = "ja") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionMul, ?orgDescriptionJa) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + OPTIONAL { ?type rdfs:label ?typeLabelJa FILTER(LANG(?typeLabelJa) = "ja") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, ?typeLabelJa, STR(?type)) AS ?typeLabel) } ORDER BY ?typeLabel ?orgLabel \ No newline at end of file diff --git a/queries/generators/latvia.rq b/queries/generators/latvia.rq index ad65f872c7b..8cc5aa5f4aa 100644 --- a/queries/generators/latvia.rq +++ b/queries/generators/latvia.rq @@ -32,6 +32,20 @@ WHERE { BIND(wd:Q211 AS ?country) MINUS { ?cofog wdt:P279 [] } } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,lv,mul". } + + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelLv FILTER(LANG(?orgLabelLv) = "lv") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelLv, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionLv FILTER(LANG(?orgDescriptionLv) = "lv") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionLv, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelLv FILTER(LANG(?typeLabelLv) = "lv") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelLv, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?topic diff --git a/queries/generators/luxembourg.rq b/queries/generators/luxembourg.rq index a5a083110f2..70cfdfb6013 100644 --- a/queries/generators/luxembourg.rq +++ b/queries/generators/luxembourg.rq @@ -37,6 +37,25 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,lb,de,fr,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelLb FILTER(LANG(?orgLabelLb) = "lb") } + OPTIONAL { ?org rdfs:label ?orgLabelDe FILTER(LANG(?orgLabelDe) = "de") } + OPTIONAL { ?org rdfs:label ?orgLabelFr FILTER(LANG(?orgLabelFr) = "fr") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelLb, ?orgLabelDe, ?orgLabelFr, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionLb FILTER(LANG(?orgDescriptionLb) = "lb") } + OPTIONAL { ?org schema:description ?orgDescriptionDe FILTER(LANG(?orgDescriptionDe) = "de") } + OPTIONAL { ?org schema:description ?orgDescriptionFr FILTER(LANG(?orgDescriptionFr) = "fr") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionLb, ?orgDescriptionDe, ?orgDescriptionFr, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelLb FILTER(LANG(?typeLabelLb) = "lb") } + OPTIONAL { ?type rdfs:label ?typeLabelDe FILTER(LANG(?typeLabelDe) = "de") } + OPTIONAL { ?type rdfs:label ?typeLabelFr FILTER(LANG(?typeLabelFr) = "fr") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelLb, ?typeLabelDe, ?typeLabelFr, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/malaysia.rq b/queries/generators/malaysia.rq index 36bba683ebb..f19cb09e92e 100644 --- a/queries/generators/malaysia.rq +++ b/queries/generators/malaysia.rq @@ -24,6 +24,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ms,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMs FILTER(LANG(?orgLabelMs) = "ms") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMs, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionMs FILTER(LANG(?orgDescriptionMs) = "ms") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionMs, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMs FILTER(LANG(?typeLabelMs) = "ms") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMs, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/malta.rq b/queries/generators/malta.rq index 329f35a27e3..d9cb34fbdae 100644 --- a/queries/generators/malta.rq +++ b/queries/generators/malta.rq @@ -22,6 +22,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mt,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMt FILTER(LANG(?orgLabelMt) = "mt") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMt, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionMt FILTER(LANG(?orgDescriptionMt) = "mt") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionMt, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMt FILTER(LANG(?typeLabelMt) = "mt") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMt, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/morocco.rq b/queries/generators/morocco.rq index ea61c00c780..50e755995a4 100644 --- a/queries/generators/morocco.rq +++ b/queries/generators/morocco.rq @@ -33,6 +33,25 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,ar,zgh,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelFr FILTER(LANG(?orgLabelFr) = "fr") } + OPTIONAL { ?org rdfs:label ?orgLabelAr FILTER(LANG(?orgLabelAr) = "ar") } + OPTIONAL { ?org rdfs:label ?orgLabelZgh FILTER(LANG(?orgLabelZgh) = "zgh") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelFr, ?orgLabelAr, ?orgLabelZgh, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionFr FILTER(LANG(?orgDescriptionFr) = "fr") } + OPTIONAL { ?org schema:description ?orgDescriptionAr FILTER(LANG(?orgDescriptionAr) = "ar") } + OPTIONAL { ?org schema:description ?orgDescriptionZgh FILTER(LANG(?orgDescriptionZgh) = "zgh") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionFr, ?orgDescriptionAr, ?orgDescriptionZgh, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelFr FILTER(LANG(?typeLabelFr) = "fr") } + OPTIONAL { ?type rdfs:label ?typeLabelAr FILTER(LANG(?typeLabelAr) = "ar") } + OPTIONAL { ?type rdfs:label ?typeLabelZgh FILTER(LANG(?typeLabelZgh) = "zgh") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelFr, ?typeLabelAr, ?typeLabelZgh, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/nepal.rq b/queries/generators/nepal.rq index 410bd2e9711..266b155e70b 100644 --- a/queries/generators/nepal.rq +++ b/queries/generators/nepal.rq @@ -25,6 +25,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ne,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelNe FILTER(LANG(?orgLabelNe) = "ne") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelNe, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionNe FILTER(LANG(?orgDescriptionNe) = "ne") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionNe, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelNe FILTER(LANG(?typeLabelNe) = "ne") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelNe, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/netherlands.rq b/queries/generators/netherlands.rq index d2014553814..e6508d7288f 100644 --- a/queries/generators/netherlands.rq +++ b/queries/generators/netherlands.rq @@ -64,6 +64,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nl,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelNl FILTER(LANG(?orgLabelNl) = "nl") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelNl, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionNl FILTER(LANG(?orgDescriptionNl) = "nl") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionNl, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelNl FILTER(LANG(?typeLabelNl) = "nl") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelNl, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?typeLabel ?orgLabel diff --git a/queries/generators/new-zealand.rq b/queries/generators/new-zealand.rq index 77c87e0b5fb..9ac09d37362 100644 --- a/queries/generators/new-zealand.rq +++ b/queries/generators/new-zealand.rq @@ -35,7 +35,20 @@ WHERE { MINUS { ?cofog wdt:P279 [] } } - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mi,mul" } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMi FILTER(LANG(?orgLabelMi) = "mi") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMi, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionMi FILTER(LANG(?orgDescriptionMi) = "mi") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionMi, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMi FILTER(LANG(?typeLabelMi) = "mi") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMi, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?typeLabel diff --git a/queries/generators/norway.rq b/queries/generators/norway.rq index eb364a53b0a..6c5519a7e3c 100644 --- a/queries/generators/norway.rq +++ b/queries/generators/norway.rq @@ -51,6 +51,25 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nb,no,nn,mul". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelNb FILTER(LANG(?orgLabelNb) = "nb") } + OPTIONAL { ?org rdfs:label ?orgLabelNo FILTER(LANG(?orgLabelNo) = "no") } + OPTIONAL { ?org rdfs:label ?orgLabelNn FILTER(LANG(?orgLabelNn) = "nn") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelNb, ?orgLabelNo, ?orgLabelNn, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionNb FILTER(LANG(?orgDescriptionNb) = "nb") } + OPTIONAL { ?org schema:description ?orgDescriptionNo FILTER(LANG(?orgDescriptionNo) = "no") } + OPTIONAL { ?org schema:description ?orgDescriptionNn FILTER(LANG(?orgDescriptionNn) = "nn") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionNb, ?orgDescriptionNo, ?orgDescriptionNn, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelNb FILTER(LANG(?typeLabelNb) = "nb") } + OPTIONAL { ?type rdfs:label ?typeLabelNo FILTER(LANG(?typeLabelNo) = "no") } + OPTIONAL { ?type rdfs:label ?typeLabelNn FILTER(LANG(?typeLabelNn) = "nn") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelNb, ?typeLabelNo, ?typeLabelNn, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?topic diff --git a/queries/generators/peru.rq b/queries/generators/peru.rq index db7fa41a470..ca4abd36097 100644 --- a/queries/generators/peru.rq +++ b/queries/generators/peru.rq @@ -18,6 +18,25 @@ WHERE { MINUS { ?org wdt:P1366 [] } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,qu,ay,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelEs FILTER(LANG(?orgLabelEs) = "es") } + OPTIONAL { ?org rdfs:label ?orgLabelQu FILTER(LANG(?orgLabelQu) = "qu") } + OPTIONAL { ?org rdfs:label ?orgLabelAy FILTER(LANG(?orgLabelAy) = "ay") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelEs, ?orgLabelQu, ?orgLabelAy, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionEs FILTER(LANG(?orgDescriptionEs) = "es") } + OPTIONAL { ?org schema:description ?orgDescriptionQu FILTER(LANG(?orgDescriptionQu) = "qu") } + OPTIONAL { ?org schema:description ?orgDescriptionAy FILTER(LANG(?orgDescriptionAy) = "ay") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionEs, ?orgDescriptionQu, ?orgDescriptionAy, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelEs FILTER(LANG(?typeLabelEs) = "es") } + OPTIONAL { ?type rdfs:label ?typeLabelQu FILTER(LANG(?typeLabelQu) = "qu") } + OPTIONAL { ?type rdfs:label ?typeLabelAy FILTER(LANG(?typeLabelAy) = "ay") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelEs, ?typeLabelQu, ?typeLabelAy, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/philippines.rq b/queries/generators/philippines.rq index 1b884270b39..e73549f1339 100644 --- a/queries/generators/philippines.rq +++ b/queries/generators/philippines.rq @@ -27,6 +27,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,tl,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelTl FILTER(LANG(?orgLabelTl) = "tl") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelTl, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionTl FILTER(LANG(?orgDescriptionTl) = "tl") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionTl, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelTl FILTER(LANG(?typeLabelTl) = "tl") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelTl, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/portugal.rq b/queries/generators/portugal.rq index 3d33e68e30b..da45f088cd4 100644 --- a/queries/generators/portugal.rq +++ b/queries/generators/portugal.rq @@ -33,6 +33,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt,mul". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelPt FILTER(LANG(?orgLabelPt) = "pt") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelPt, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionPt FILTER(LANG(?orgDescriptionPt) = "pt") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionPt, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelPt FILTER(LANG(?typeLabelPt) = "pt") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelPt, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?typeLabel ?topic \ No newline at end of file diff --git a/queries/generators/russia.rq b/queries/generators/russia.rq index c66073ae372..05112d7e564 100644 --- a/queries/generators/russia.rq +++ b/queries/generators/russia.rq @@ -27,6 +27,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ru,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelRu FILTER(LANG(?orgLabelRu) = "ru") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelRu, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionRu FILTER(LANG(?orgDescriptionRu) = "ru") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionRu, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelRu FILTER(LANG(?typeLabelRu) = "ru") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelRu, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/singapore.rq b/queries/generators/singapore.rq index 14ccd2c20e0..d3ed2dfb56f 100644 --- a/queries/generators/singapore.rq +++ b/queries/generators/singapore.rq @@ -26,6 +26,22 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,tl,ms,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelTl FILTER(LANG(?orgLabelTl) = "tl") } + OPTIONAL { ?org rdfs:label ?orgLabelMs FILTER(LANG(?orgLabelMs) = "ms") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelTl, ?orgLabelMs, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionTl FILTER(LANG(?orgDescriptionTl) = "tl") } + OPTIONAL { ?org schema:description ?orgDescriptionMs FILTER(LANG(?orgDescriptionMs) = "ms") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionTl, ?orgDescriptionMs, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelTl FILTER(LANG(?typeLabelTl) = "tl") } + OPTIONAL { ?type rdfs:label ?typeLabelMs FILTER(LANG(?typeLabelMs) = "ms") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelTl, ?typeLabelMs, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/south-africa.rq b/queries/generators/south-africa.rq index 52008992765..d3ccecf57dd 100644 --- a/queries/generators/south-africa.rq +++ b/queries/generators/south-africa.rq @@ -33,6 +33,46 @@ WHERE { 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". } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelAf FILTER(LANG(?orgLabelAf) = "af") } + OPTIONAL { ?org rdfs:label ?orgLabelZu FILTER(LANG(?orgLabelZu) = "zu") } + OPTIONAL { ?org rdfs:label ?orgLabelNr FILTER(LANG(?orgLabelNr) = "nr") } + OPTIONAL { ?org rdfs:label ?orgLabelNso FILTER(LANG(?orgLabelNso) = "nso") } + OPTIONAL { ?org rdfs:label ?orgLabelSt FILTER(LANG(?orgLabelSt) = "st") } + OPTIONAL { ?org rdfs:label ?orgLabelSs FILTER(LANG(?orgLabelSs) = "ss") } + OPTIONAL { ?org rdfs:label ?orgLabelTs FILTER(LANG(?orgLabelTs) = "ts") } + OPTIONAL { ?org rdfs:label ?orgLabelTn FILTER(LANG(?orgLabelTn) = "tn") } + OPTIONAL { ?org rdfs:label ?orgLabelVe FILTER(LANG(?orgLabelVe) = "ve") } + OPTIONAL { ?org rdfs:label ?orgLabelXh FILTER(LANG(?orgLabelXh) = "xh") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelAf, ?orgLabelZu, ?orgLabelNr, ?orgLabelNso, ?orgLabelSt, ?orgLabelSs, ?orgLabelTs, ?orgLabelTn, ?orgLabelVe, ?orgLabelXh, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionAf FILTER(LANG(?orgDescriptionAf) = "af") } + OPTIONAL { ?org schema:description ?orgDescriptionZu FILTER(LANG(?orgDescriptionZu) = "zu") } + OPTIONAL { ?org schema:description ?orgDescriptionNr FILTER(LANG(?orgDescriptionNr) = "nr") } + OPTIONAL { ?org schema:description ?orgDescriptionNso FILTER(LANG(?orgDescriptionNso) = "nso") } + OPTIONAL { ?org schema:description ?orgDescriptionSt FILTER(LANG(?orgDescriptionSt) = "st") } + OPTIONAL { ?org schema:description ?orgDescriptionSs FILTER(LANG(?orgDescriptionSs) = "ss") } + OPTIONAL { ?org schema:description ?orgDescriptionTs FILTER(LANG(?orgDescriptionTs) = "ts") } + OPTIONAL { ?org schema:description ?orgDescriptionTn FILTER(LANG(?orgDescriptionTn) = "tn") } + OPTIONAL { ?org schema:description ?orgDescriptionVe FILTER(LANG(?orgDescriptionVe) = "ve") } + OPTIONAL { ?org schema:description ?orgDescriptionXh FILTER(LANG(?orgDescriptionXh) = "xh") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionAf, ?orgDescriptionZu, ?orgDescriptionNr, ?orgDescriptionNso, ?orgDescriptionSt, ?orgDescriptionSs, ?orgDescriptionTs, ?orgDescriptionTn, ?orgDescriptionVe, ?orgDescriptionXh, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelAf FILTER(LANG(?typeLabelAf) = "af") } + OPTIONAL { ?type rdfs:label ?typeLabelZu FILTER(LANG(?typeLabelZu) = "zu") } + OPTIONAL { ?type rdfs:label ?typeLabelNr FILTER(LANG(?typeLabelNr) = "nr") } + OPTIONAL { ?type rdfs:label ?typeLabelNso FILTER(LANG(?typeLabelNso) = "nso") } + OPTIONAL { ?type rdfs:label ?typeLabelSt FILTER(LANG(?typeLabelSt) = "st") } + OPTIONAL { ?type rdfs:label ?typeLabelSs FILTER(LANG(?typeLabelSs) = "ss") } + OPTIONAL { ?type rdfs:label ?typeLabelTs FILTER(LANG(?typeLabelTs) = "ts") } + OPTIONAL { ?type rdfs:label ?typeLabelTn FILTER(LANG(?typeLabelTn) = "tn") } + OPTIONAL { ?type rdfs:label ?typeLabelVe FILTER(LANG(?typeLabelVe) = "ve") } + OPTIONAL { ?type rdfs:label ?typeLabelXh FILTER(LANG(?typeLabelXh) = "xh") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelAf, ?typeLabelZu, ?typeLabelNr, ?typeLabelNso, ?typeLabelSt, ?typeLabelSs, ?typeLabelTs, ?typeLabelTn, ?typeLabelVe, ?typeLabelXh, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY DESC(?type) diff --git a/queries/generators/sweden.rq b/queries/generators/sweden.rq index 7dcf7419674..ad0839bdf7d 100644 --- a/queries/generators/sweden.rq +++ b/queries/generators/sweden.rq @@ -1,4 +1,8 @@ # expected_result_count: 766 +PREFIX rdfs: +PREFIX schema: +PREFIX wd: +PREFIX wdt: SELECT DISTINCT ?qid ?orgLabel @@ -45,7 +49,7 @@ WHERE { wd:Q10475844 # domstolsverket (1) ✔ } - BIND("courts administration agency" AS ?typeLabel) + BIND("courts administration agency" AS ?typeLabelSpecial) } MINUS { ?org wdt:P576 [] } @@ -57,7 +61,20 @@ WHERE { MINUS { ?cofog wdt:P279 [] } } - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,sv,mul" } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelSv FILTER(LANG(?orgLabelSv) = "sv") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelSv, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionSv FILTER(LANG(?orgDescriptionSv) = "sv") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionSv, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelSv FILTER(LANG(?typeLabelSv) = "sv") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelSpecial, ?typeLabelEn, ?typeLabelSv, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?typeLabel diff --git a/queries/generators/switzerland.rq b/queries/generators/switzerland.rq index 225a9cb0887..91fea115b05 100644 --- a/queries/generators/switzerland.rq +++ b/queries/generators/switzerland.rq @@ -26,6 +26,25 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,it,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelDe FILTER(LANG(?orgLabelDe) = "de") } + OPTIONAL { ?org rdfs:label ?orgLabelFr FILTER(LANG(?orgLabelFr) = "fr") } + OPTIONAL { ?org rdfs:label ?orgLabelIt FILTER(LANG(?orgLabelIt) = "it") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelDe, ?orgLabelFr, ?orgLabelIt, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionDe FILTER(LANG(?orgDescriptionDe) = "de") } + OPTIONAL { ?org schema:description ?orgDescriptionFr FILTER(LANG(?orgDescriptionFr) = "fr") } + OPTIONAL { ?org schema:description ?orgDescriptionIt FILTER(LANG(?orgDescriptionIt) = "it") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionDe, ?orgDescriptionFr, ?orgDescriptionIt, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelDe FILTER(LANG(?typeLabelDe) = "de") } + OPTIONAL { ?type rdfs:label ?typeLabelFr FILTER(LANG(?typeLabelFr) = "fr") } + OPTIONAL { ?type rdfs:label ?typeLabelIt FILTER(LANG(?typeLabelIt) = "it") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelDe, ?typeLabelFr, ?typeLabelIt, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/ukraine.rq b/queries/generators/ukraine.rq index 1e1a184be25..b30dadc4264 100644 --- a/queries/generators/ukraine.rq +++ b/queries/generators/ukraine.rq @@ -24,6 +24,19 @@ WHERE { BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,uk,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelUk FILTER(LANG(?orgLabelUk) = "uk") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelUk, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionUk FILTER(LANG(?orgDescriptionUk) = "uk") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionUk, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelUk FILTER(LANG(?typeLabelUk) = "uk") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelUk, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/united-kingdom.rq b/queries/generators/united-kingdom.rq index 85425acdc8f..9d1bae680c2 100644 --- a/queries/generators/united-kingdom.rq +++ b/queries/generators/united-kingdom.rq @@ -25,6 +25,16 @@ WHERE { MINUS { ?cofog wdt:P279 [] } } - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/generators/united-kingdom/scotland.rq b/queries/generators/united-kingdom/scotland.rq index 5d5dca1ec5c..22fcf8e4219 100644 --- a/queries/generators/united-kingdom/scotland.rq +++ b/queries/generators/united-kingdom/scotland.rq @@ -56,5 +56,22 @@ WHERE { MINUS { ?cofog wdt:P279 [] } } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,sco,gd" } + + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + OPTIONAL { ?org rdfs:label ?orgLabelSco FILTER(LANG(?orgLabelSco) = "sco") } + OPTIONAL { ?org rdfs:label ?orgLabelGd FILTER(LANG(?orgLabelGd) = "gd") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, ?orgLabelSco, ?orgLabelGd, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + OPTIONAL { ?org schema:description ?orgDescSco FILTER(LANG(?orgDescSco) = "sco") } + OPTIONAL { ?org schema:description ?orgDescGd FILTER(LANG(?orgDescGd) = "gd") } + BIND(COALESCE(?orgDescEn, ?orgDescMul, ?orgDescSco, ?orgDescGd) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + OPTIONAL { ?type rdfs:label ?typeLabelSco FILTER(LANG(?typeLabelSco) = "sco") } + OPTIONAL { ?type rdfs:label ?typeLabelGd FILTER(LANG(?typeLabelGd) = "gd") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, ?typeLabelSco, ?typeLabelGd, STR(?type)) AS ?typeLabel) }ORDER BY ?type ?orgLabel diff --git a/queries/generators/united-states.rq b/queries/generators/united-states.rq index 549870b7e8f..463ea9558ad 100644 --- a/queries/generators/united-states.rq +++ b/queries/generators/united-states.rq @@ -65,6 +65,17 @@ WHERE { MINUS { ?org wdt:P3999 [] } MINUS { ?org wdt:P361/wdt:P31 wd:Q5244910 } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul". } + + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY DESC(LCASE(?typeLabel)) ?orgLabel diff --git a/queries/generators/united-states/new-york.rq b/queries/generators/united-states/new-york.rq index 89bbf9e229b..2dbe789fed2 100644 --- a/queries/generators/united-states/new-york.rq +++ b/queries/generators/united-states/new-york.rq @@ -18,6 +18,17 @@ WHERE { MINUS { ?org wdt:P576 [] } MINUS { ?org wdt:P1366 [] } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } + + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel \ No newline at end of file diff --git a/queries/generators/united-states/north-carolina.rq b/queries/generators/united-states/north-carolina.rq index 6067df36a7f..2d8a4025dc6 100644 --- a/queries/generators/united-states/north-carolina.rq +++ b/queries/generators/united-states/north-carolina.rq @@ -57,6 +57,17 @@ WHERE { MINUS { ?org wdt:P1366 [] } MINUS { ?org wdt:P576 [] } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul". } + + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescEn FILTER(LANG(?orgDescEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescMul FILTER(LANG(?orgDescMul) = "mul") } + BIND(COALESCE(?orgDescEn, ?orgDescMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?typeLabel ?orgLabel diff --git a/queries/generators/uruguay.rq b/queries/generators/uruguay.rq index ccc17e3379d..99b8598373d 100644 --- a/queries/generators/uruguay.rq +++ b/queries/generators/uruguay.rq @@ -17,6 +17,19 @@ WHERE { MINUS { ?org wdt:P1366 [] } BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) - SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,mul" } + OPTIONAL { ?org rdfs:label ?orgLabelEn FILTER(LANG(?orgLabelEn) = "en") } + OPTIONAL { ?org rdfs:label ?orgLabelEs FILTER(LANG(?orgLabelEs) = "es") } + OPTIONAL { ?org rdfs:label ?orgLabelMul FILTER(LANG(?orgLabelMul) = "mul") } + BIND(COALESCE(?orgLabelEn, ?orgLabelEs, ?orgLabelMul, STR(?org)) AS ?orgLabel) + + OPTIONAL { ?org schema:description ?orgDescriptionEn FILTER(LANG(?orgDescriptionEn) = "en") } + OPTIONAL { ?org schema:description ?orgDescriptionEs FILTER(LANG(?orgDescriptionEs) = "es") } + OPTIONAL { ?org schema:description ?orgDescriptionMul FILTER(LANG(?orgDescriptionMul) = "mul") } + BIND(COALESCE(?orgDescriptionEn, ?orgDescriptionEs, ?orgDescriptionMul) AS ?orgDescription) + + OPTIONAL { ?type rdfs:label ?typeLabelEn FILTER(LANG(?typeLabelEn) = "en") } + OPTIONAL { ?type rdfs:label ?typeLabelEs FILTER(LANG(?typeLabelEs) = "es") } + OPTIONAL { ?type rdfs:label ?typeLabelMul FILTER(LANG(?typeLabelMul) = "mul") } + BIND(COALESCE(?typeLabelEn, ?typeLabelEs, ?typeLabelMul, STR(?type)) AS ?typeLabel) } ORDER BY ?type ?orgLabel diff --git a/queries/organization-optional.rq b/queries/organization-optional.rq index 77ce71adb06..85ba0e96462 100644 --- a/queries/organization-optional.rq +++ b/queries/organization-optional.rq @@ -1,62 +1,66 @@ -SELECT - # note that SAMPLE in Blazegraph always picks the first object - (SAMPLE(?website) AS ?website) - (SAMPLE(?email) AS ?email) - (SAMPLE(?phone) AS ?phone) - (SAMPLE(?citizensInitiatives ) AS ?citizensInitiatives) - (SAMPLE(?foiUrl) AS ?foiUrl) - (SAMPLE(?contactPage) AS ?contactPage) - (SAMPLE(?regulatoryText ) AS ?regulatoryText) - (SAMPLE(?regulatoryTextTitle ) AS ?regulatoryTextTitle) - (SAMPLE(?personLabel) AS ?leadBy) - (SAMPLE(?parentOrg) AS ?parent) - ?wikipedia -WHERE { - BIND(wd:{{.}} AS ?org) +SELECT + (SAMPLE(?website_) AS ?website) + (SAMPLE(?email_) AS ?email) + (SAMPLE(?citizensInitiatives_) AS ?citizensInitiatives) + (SAMPLE(?foiUrl_) AS ?foiUrl) + (SAMPLE(?contactPage_) AS ?contactPage) + (SAMPLE(?regulatoryText_) AS ?regulatoryText) + (SAMPLE(?regulatoryTextTitle_) AS ?regulatoryTextTitle) + (SAMPLE(?phone_) AS ?phone) + (SAMPLE(?ledByLabel_) AS ?ledByLabel) + (SAMPLE(?latestStart_) AS ?latestStart) + (SAMPLE(?wikipedia_) AS ?wikipedia) - OPTIONAL { ?org wdt:P856 ?website } - OPTIONAL { ?org wdt:P968 ?email } - OPTIONAL { ?org wdt:P9732 ?citizensInitiatives } - OPTIONAL { ?org wdt:P11266 ?contactPage } - OPTIONAL { ?org wdt:P10214 ?foiUrl } +WHERE { + VALUES ?org { wd:{{.}} } OPTIONAL { - ?org wdt:P92 ?regulatoryTextItem . - ?regulatoryTextItem wdt:P953 ?regulatoryText ; - wdt:P1476 ?regulatoryTextTitle . + # ensures we get the most relevant(the latest) position + ?org wdt:P1313 ?position . + { + SELECT ?position (MAX(?startDate) AS ?latestStart_) WHERE { + ?ledBy wdt:P31 wd:Q5 . + ?ledBy p:P39 ?posStatement . + ?posStatement ps:P39 ?position . + ?posStatement pq:P580 ?startDate . + FILTER NOT EXISTS { ?posStatement pq:P582 ?endDate . } + } + GROUP BY ?position + } + OPTIONAL { + ?ledBy wdt:P31 wd:Q5 . + ?ledBy p:P39 ?posStatement . + ?posStatement ps:P39 ?position . + ?posStatement pq:P580 ?latestStart_ . + FILTER NOT EXISTS { ?posStatement pq:P582 ?endDate . } + OPTIONAL { ?ledBy rdfs:label ?ledByLabelEn . FILTER(LANG(?ledByLabelEn) = "en") } + OPTIONAL { ?ledBy rdfs:label ?ledByLabelSv . FILTER(LANG(?ledByLabelSv) = "sv") } + OPTIONAL { ?ledBy rdfs:label ?ledByLabelMul . FILTER(LANG(?ledByLabelMul) = "mul") } + BIND(COALESCE(?ledByLabelEn, ?ledByLabelSv, ?ledByLabelMul, STR(?ledBy)) AS ?ledByLabel_) + } } - OPTIONAL { ?org wdt:P749 ?parentOrg } + OPTIONAL { ?org wdt:P856 ?website_ } + OPTIONAL { ?org wdt:P968 ?email_ } + OPTIONAL { ?org wdt:P9732 ?citizensInitiatives_ } + OPTIONAL { ?org wdt:P10214 ?foiUrl_ } + OPTIONAL { ?org wdt:P11266 ?contactPage_ } OPTIONAL { - ?org wdt:P2388|wdt:P1313 ?office . - ?positionStatement ps:P39 ?office . - ?person p:P39 ?positionStatement . - ?person wdt:P31 wd:Q5 . - MINUS { ?positionStatement pq:P582 ?endtime } - MINUS { ?person wdt:P570 [] } - FILTER ( ?office != wd:Q30185 ) - } - - OPTIONAL { - ?org wdt:P488|wdt:P169|wdt:P1037|wdt:P3975 ?person . + ?org wdt:P92 ?regulatoryTextItem . + ?regulatoryTextItem wdt:P953 ?regulatoryText_ ; + wdt:P1476 ?regulatoryTextTitle_ . } OPTIONAL { - ?org wdt:P1329 ?phone . - ?org p:P1329 ?phoneStatement . - ?phoneStatement (ps:P1329) [] . - FILTER(EXISTS { ?phoneStatement prov:wasDerivedFrom ?reference. }) + ?org wdt:P1329 ?phone_ . + ?org p:P1329 ?phone_Statement . + ?phone_Statement (ps:P1329) [] . + FILTER(EXISTS { ?phone_Statement prov:wasDerivedFrom ?reference. }) } OPTIONAL { - ?wikipedia schema:about ?org ; + ?wikipedia_ schema:about ?org ; schema:isPartOf . } - - SERVICE wikibase:label { - # this might need to be updated when new countries are added - bd:serviceParam wikibase:language "en,sv,mul" . - ?person rdfs:label ?personLabel . - } -} GROUP BY ?wikipedia +}