-
Notifications
You must be signed in to change notification settings - Fork 71
Ported queries to be compatible with QLever #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7250671
552930f
593d0e7
6ef17e3
d35011f
54b577a
43f3927
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 <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_ . | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 😥)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment.
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.