Skip to content

Ported queries to be compatible with QLever#661

Open
fenymufyd wants to merge 7 commits into
govdirectory:mainfrom
fenymufyd:qlever-compatible-query-port
Open

Ported queries to be compatible with QLever#661
fenymufyd wants to merge 7 commits into
govdirectory:mainfrom
fenymufyd:qlever-compatible-query-port

Conversation

@fenymufyd

Copy link
Copy Markdown
Contributor

Description

I've ported all .rq query files to be compatible with QLever. I used LLM (Copilot) to do most of the tedious work but I've tested some samples of the queries manually on WQDS and QLever and it works on both services. I think it also made organization-optional.rq faster on QLever, about 5-8 sec per item.

Issue Reference

this should fix #498

Checklist

Please ensure the following before submitting the PR:

  • I have tested the changes locally, and they work as expected.
  • The code follows the project's coding standards and conventions.
  • I have updated relevant documentation (if needed).
  • I have added unit tests or performed manual testing where necessary.

@Abbe98
Abbe98 self-requested a review July 15, 2026 13:50

@Abbe98 Abbe98 left a comment

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.

Thank you so much for this work! Here are a few first notes.

Comment thread queries/generators/ukraine.rq
Comment thread queries/countries.rq
(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.

Comment thread queries/countries.rq
?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! :-)

?org wdt:P92 ?regulatoryTextItem .
?regulatoryTextItem wdt:P953 ?regulatoryText ;
wdt:P1476 ?regulatoryTextTitle .
?org wdt:P1313 ?position .

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.

I changed this organization ?leadBy query logic because the former query had a weird bug on QLever where it would output a random QID item on the column instead of the correct position holder. This does not happen on WDQS but with this subquery logic change it would work on both WDQS and QLever

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.

Thank you, it could do with a code comment.

@fenymufyd fenymufyd left a comment

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.

reviewed all except countries.rq

@Abbe98

Abbe98 commented Jul 15, 2026

Copy link
Copy Markdown
Member

Thank you @fenymufyd, I have some time scheduled for Govdirectory on Friday and will try to get a in depth review done!

@Abbe98

Abbe98 commented Jul 17, 2026

Copy link
Copy Markdown
Member

I'm rather happy now with this now! I want to merge #655 first and then rebase this. Not sure if I will be able to get it over the finish line before/during Wikimania but I hope so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make our SPARQL queries compatible with non-Blazegraph endpoints

2 participants