-
Notifications
You must be signed in to change notification settings - Fork 2
SPARQL Federated Query support #186
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
Conversation
Also add support for SPARQL protocol headers for specifying query graphs.
773f219 to
a902fa1
Compare
|
For the reasons I noted in the other PR I don't think this endpoint approach is ideal. It creates inconsistencies between a ledger I visit via a webpage and then how it is used. It also slightly complicates developer experience because I can't just append methods to an api URL but need to reconstruct every method I want to use. It gets away from "Resource" semantics which I think is valuable. Not sure the breadth of the benefits of our router config this approach makes, and I'm sure there is a balance that has to be weighed, but I'd much rather put extra weight on DX and semantics than chosen library patterns in that balance. |
|
This approach was because I had to get something working quickly, and after about 90 minutes of faffing trying to get the other approach to support POST queries I binned it and whipped this up. I still think that the simplicity and performance of this approach are worth a lot, but this wasn't intended as a production implementation, just what was necessary for the demo. |
We do not currently support dynamic middleware, so there is no need for the ability to sort it dynamically.
There was an awful lot of indirection in the construction of our router. I've consolidated all of the routes into one top-level definition so we can see all the routes at one time.
Requests made to `/fluree/ledger/<ledger-alias/<op>`, where op corresponds to the operation endpoint suffix (query, update, insert, upsert, transact) are rewritten and rerouted to the top-level `/fluree/<op>` route handlers. This saves us from having to manually handle all the work the middleware does while still allowing the `/<ledger-alias/<op>` route construction instead of the `/<op>/<ledger-alias>` form.
0c8b011 to
f761f82
Compare
This reverts commit 964542a. Now that the demo is over we no longer need this task.
Also updates the db dep to fix an issue with SERVICE SILENT.
0b82e23 to
9f754d2
Compare
Need to dissoc the :reitit.core/match key in order to properly re-match during routing.
94b4d50 to
67eefe9
Compare
67eefe9 to
4ff9245
Compare
zonotope
left a comment
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.
🍏
SPARQL Federated Query Support
Demonstrate a local/remote join using a SPARQL
SERVICEquery clause.Also refactors our http router and adds support for ledger-specific requests.
Ledger specific request support
Now you can address a specific ledger via URL, which is critical for SPARQL
SERVICEclauses - you cannot specify custom headers or payloads within the syntax provided, so the URL needs to contain all the information necessary to properly resolve the ledger or graph the query needs.The ledger-specific requests are available via these paths:
/fluree/ledger/<ledger-alias>/<operation>Requests with URIs that match this path are rewritten to target the more general endpoint and the
ledger-aliasis supplied as afluree-ledgerheader, and then rerouted. For example, aPOST /fluree/ledger/my/ledger/queryis rerouted to/fluree/querywith the addedfluree-ledger: my/ledgerheader (overriding any suppliedfluree-ledgerheader.Implementation notes
After looking at #174, I decided to implement similar functionality but with an approach that requires less code and that is more performant. All ledger-specific requests are rerouted transparently by the
ledger-specific-handlerso that we maintain the same middleware stack and all operations are handled the same, regardless of how they are addressed.I've chosen the path prefix
/fluree/ledger/<ledger-alias>for our ledger-specific routes instead of/fluree/<ledger-alias>in order to avoid "conflicting" routes, which come with a performance penalty.https://github.com/fluree/core/issues/207
fluree/db#1134