-
Notifications
You must be signed in to change notification settings - Fork 15
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
Allow blank nodes to be reused across expressions #34
Comments
Skolemization does indeed sound the right way to go here. This issue in Comunica would be a requirement for this: comunica/comunica#355 |
Checking to see if this issue has been slated for work in the near term? We're running into some use cases that are blocked by this. |
@justinwb Will schedule it in @rubensworks' agenda. |
Or maybe also @joachimvh, they can decide who is most appropriate. |
I've started working on the solution described in comunica/comunica#355. This will mean that Comunica will not output any blank nodes anymore originating from sources (unless enforced by SPARQL via As far as I know, this shouldn't be a problem for users downstream, and SPARQL spec-compliant. |
That by itself seems too strong? Should at least be a switch (off by default to have correct query semantics)?
Do we have evidence? Perhaps something @Dexagod might want to dive into? |
Hmm, I just realized there is a |
When federating over multiple sources, the outcoming blank nodes coming from each source will receive a distinct blank node, so that they can not be joined across different sources, even if they have the same blank node label. A reverse translation also takes place for incoming queries with blank nodes, so that these blank nodes will only match if they come from that source. Blank nodes coming from sources will receive a .skolemized field containing a named node. This named node can be queried again as an IRI, and this will be interpreted by Comunica as a blank node corresponding to the proper source, assuming that the array of sources remains the same. Closes #355 Required for LDflex/Query-Solid#34
Saw a commit go in at comunica/comunica#624 - is the expectation that this will provide the full resolution or is there now additional work to do in ldflex to take advantage of the changes? |
@justinwb That should be it, mostly. We'd still need to add LDflex support for the |
Comunica 1.11.0 has now been released with this new feature, so implementing |
Awesome thanks for the update! Is anyone slotted to add |
Still on backlog currently; will discuss with the team. |
Currently, a blank node resulting from one expression, cannot be reused in another. Following the example of
https://github.com/solid/query-ldflex/issues/33
, the following snippets return different results:This happens because Alice's friends are identified by blank nodes, and they lose context across multiple expressions. If we retry both snippets with
Alice2
, which has IRI friends, we get the same results.We could strive to reuse blank nodes across expressions, by internally skolemizing them. Here is a sketch of how that could work:
_:b1
is still output as aBlankNode
, but has a special internal field.skolemized
that containsurn:skolem:1234
.NamedNode
is turned into a skolemized `BlankNode.The key is inserting skolemization and deskolemization processing in the right place, for which I need to ask @rubensworks for help.
We could simply skolemize upon parsing, and then deskolemize right before results are returned. This works in all cases, except when Comunica directly operates on a store (the contents of which it did not parse, so it can contain actual blank nodes).
And alternative approach is a skolemizing store wrapper. It takes a store as an argument, and translates on the fly in its
match
etc. methods.Perhaps both approaches can be used in conjunction: skolemization in parsers for all cases, except when a store is passed, then we wrap it.
The text was updated successfully, but these errors were encountered: