Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions ADD_A_COUNTRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -173,13 +179,23 @@ WHERE {
?wikipedia schema:about ?uri ;
schema:isPartOf <https://en.wikipedia.org/> .
}
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
Expand Down
4 changes: 3 additions & 1 deletion queries/account-data.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
62 changes: 37 additions & 25 deletions queries/countries.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.' '')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in a few other places new whitespace have been introduced.

(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 <https://en.wikipedia.org/> . }

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_ .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the intended changes here? The commit says it's related to SAMPLE but it does not seem to be?

@fenymufyd fenymufyd Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a timeout problem with the original query when it is being run with QLever (something to do with uri or lang). But with WDQS it outputs OK in 3197 ms

So I asked LLMs to find out what wrong and it changed some parts of the query structure so now it is able to run it in 3225 ms on QLever

I have not done enough due diligence to review AI change in this file so it may confuse people with how it breaks the whitespace and line ordering of the query (Sorry 😥)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, sounds like a interesting mystery for my review! :-)

?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 <https://en.wikipedia.org/> .
?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
15 changes: 14 additions & 1 deletion queries/generators/austria.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 14 additions & 1 deletion queries/generators/bangladesh.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 20 additions & 1 deletion queries/generators/belgium.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 11 additions & 1 deletion queries/generators/bermuda.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 15 additions & 1 deletion queries/generators/bulgaria.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 15 additions & 1 deletion queries/generators/cameroon.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 14 additions & 1 deletion queries/generators/canada.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 14 additions & 1 deletion queries/generators/chile.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 14 additions & 1 deletion queries/generators/cuba.rq
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading
Loading