-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Adds custom SPARQL operator OX_LATERAL #274
Conversation
"FOO OX_LATERAL(?v1 ?vn) SUBSELECT" means that for all bindings emitted from FOO SUBSELECT is going to be called with ?v1 ?vn already set from the binding from FOO
I'm not sure what the currently assumed state of stability of a query structure is when serializing and deserializing it. Until now we've constructed the query as a When testing As a "workaround"(/ more desirable solution 😅 ) I've eliminated the roundtrip (#276). With that workaround in place, I was able to integrate the feature in the first places, and it's looking good so far! :) |
It's bad. I have just merged #270 that makes sure the serialization output can be parsed. But in the future we should definitely ensure that serialization -> deserialization ends up with the exact same algebra, at least in common cases.
Thank you!
Amazing! |
As promised, further feedback: We've now integrated it into all places we wanted for now in our codebase, and seems to be working without issues! :) Generally, we feel like composing lateral queries via spargebra puts quite a bit more stress on the tools available for composing queries, and required us to write a few utilities for that (e.g. for correctly creating an intermediate |
Hi! Thank you very much for the feedback. It's great! About the creation of intermediate |
One thing that I've been stubbing my toe on now is the join behaviour of In most situations there was a way to work around that (or the alternative way of constructing the query was more optimized anyway), but I seem to be encountering situation where a A workaround seems to be:
|
Yes.
That's a great point. This make me realise I have made a huge mistake in the current implementation of SELECT * WHERE {
VALUES ?s { ex:s }
OPTIONAL {
FILTER(!BOUND(?s))
VALUES ?o { ex:o }
}
} it returns properly (?s = SELECT * WHERE {
VALUES ?s { ex:s }
OPTIONAL {
OX_LATERAL(?s) {SELECT * WHERE {
FILTER(!BOUND(?s))
VALUES ?o { ex:o }
}}
} it returns (?s = To fix that properly I believe we should introduce as you said a This way: SELECT * WHERE {
VALUES ?s { ex:s }
OX_LATERAL OPTIONAL {
FILTER(!BOUND(?s))
VALUES ?o { ex:o }
}
} would return (?s = Side note: it is likely we would also need "LATERAL" support for the "GRAPH" and "SERVICE" keywords. What do you think about it? |
@hobofan I have updated this pull request. The Side note: The python failure in the CI is independant of this PR. |
Thanks! I've updated our usage to those new changes, and they work great! With this we can now fully express the lateral join intentions in serialized SPARQL queries (which previously only were possible via in-memory construction of The only remaining thing that feels a bit weird is having the repetition in constructs like these (which will/would feel less verbose with a stabilized
Sorry for not being more responsive when it comes to designing the syntax, but I feel like you (and the other people commenting in related issues) have a very good grasp on it, and I don't think I have much to add on that front. What I can do is giving feedback from the "consumer" perspective, and from that point of view, the feature feels great! :) |
@hobofan Thank you! Great to hear it works for you and you avoided the algebra hacks. Indeed having two nested "LATERAL" is quite verbose but not having them would mean that everything inside "LATERAL" is going to be "LATERAL" so we would have to build a way to "escape" LATERAL to express some queries...
Thank you! "Customer" feedbacks are amazing to check that the features are actually usable and understandable. |
I have opened #336 with an implementation following SPARQL 1.2 SEP-0006 and compatible with Apache Jena. |
The other implementation is now merged and released |
"FOO OX_LATERAL(?v1 ?vn) SUBSELECT" means that for all bindings emitted from FOO SUBSELECT is going to be called with ?v1 ?vn already set from the binding from FOO
For example:
Closes #267