WolfgangFahl / snapquery

Frontend to Introduce Named Queries and Named Query Middleware to wikidata
Apache License 2.0
4 stars 1 forks source link

add federated query examples from wikidata mailinglist #32

Open WolfgangFahl opened 2 weeks ago

WolfgangFahl commented 2 weeks ago

see #27 see also

David replied to Egon Date: Mon, 17 Jun 2024 09:19:45 +0200

Hi, thank you for the update.

The email writes that "Queries that need federation will need to be rewritten. You can ask for help to rewrite queries".

Do you have guidelines on how to do this? It took quite some effort to make some of the (I thought simple) queries work, but later improvements showed more workable. How were they developed? How do people rewrite the SPARQL queries when two or more query triples are distributed over the two SPARQL endpoint, and particularly when they depend on each other?

We wrote some general documentation at https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/WDQS_graph_split/Federation_Limits including some explanation of how federation works underhood, the limitations and some common mistakes I have made when rewriting queries. https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/WDQS_graph_split/Federated_Queries_Examples is more concrete and have a dozen real world queries that we rewrote and some documentation on the process we went through when rewritting, it includes two scholia queries. A common pattern I often found to be useful is the use of UNION and properly identifying the triples selecting the publications.