You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jena.apache.org by "galgonek (via GitHub)" <gi...@apache.org> on 2025/02/07 11:30:00 UTC
[I] Service enhancer does not respect variable scopes [jena]
galgonek opened a new issue, #2996:
URL: https://github.com/apache/jena/issues/2996
### Version
5.3.0
### What happened?
The service enhancer does not take variable scope into account when performing substitutions.
For example, the following query should return some solutions:
```sparql
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT * WHERE {
VALUES ?O { "string" }
SERVICE <loop:https://idsm.elixir-czech.cz/sparql/endpoint/idsm> {
SELECT ?S WHERE {
?S dcterms:issued ?O.
}
}
}
```
However, no solution is returned because the service enhancer performs the following call with an incorrect substitution of the variable `?O`:
```sparql
SELECT ?S
WHERE
{ ?S <http://purl.org/dc/terms/issued> "string" }
```
On the other hand, the following query returns some results, even though it should not:
```sparql
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT ?S WHERE {
VALUES ?O { "string" }
SERVICE <loop:https://idsm.elixir-czech.cz/sparql/endpoint/idsm> {
?S dcterms:issued ?X.
minus {
?S dcterms:issued ?O.
}
}
}
```
This is again caused by incorrect substitution:
```sparql
SELECT *
WHERE
{ ?S <http://purl.org/dc/terms/issued> ?X
MINUS
{ ?S <http://purl.org/dc/terms/issued> "string" }
}
```
### Relevant output and stacktrace
```shell
```
### Are you interested in making a pull request?
None
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
Re: [I] Service enhancer does not respect variable scopes [jena]
Posted by "galgonek (via GitHub)" <gi...@apache.org>.
galgonek closed issue #2996: Service enhancer does not respect variable scopes
URL: https://github.com/apache/jena/issues/2996
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
Re: [I] Service enhancer does not respect variable scopes [jena]
Posted by "galgonek (via GitHub)" <gi...@apache.org>.
galgonek commented on issue #2996:
URL: https://github.com/apache/jena/issues/2996#issuecomment-2642990345
Thank you for the explanation, and I apologize for not reading the documentation thoroughly enough.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
Re: [I] Service enhancer does not respect variable scopes [jena]
Posted by "Aklakan (via GitHub)" <gi...@apache.org>.
Aklakan commented on issue #2996:
URL: https://github.com/apache/jena/issues/2996#issuecomment-2642948889
This behavior is in accordance with the [documentation](https://jena.apache.org/documentation/query/service_enhancer.html).
> ### SERVICE loop: vs LATERAL
> Since Jena 4.7.0 the SPARQL engine has native support for the LATERAL keyword which should almost always be preferred over SERVICE <loop:>. The use of SERVICE <loop:> is essentially only justified in combination with bulk requests, such as SERVICE <loop:bulk+5:>.
> Also note, that the semantics of loop: and LATERAL differ: the former substitutes variables **regardless of scope**, whereas the latter substitutes only in-scope variables. Another difference is, that loop: creates a new execution context for each request (even for local ones) such that the NOW() function will yield increasing timestamps as query execution progresses.
> Currently, the SE plugin does not support bulk requests under LATERAL semantics.
A note on the background: The reason for this difference is, on the one hand, that the service enhancer plugin predates the formalization and implementation of LATERAL and on the other hand the goal was to add the bulk and caching features without requiring changes to jena's core machinery.
If for some reason this behavior is a blocking issue for you, the best I can offer is to try out the service enhancer from this branch (my working copy of jena):
https://github.com/Aklakan/jena/tree/se-fixes-2023-11-29
This one should allow for writing `SERVICE <loop+scoped:bulk+5:...>` which mimics LATERAL semantics more closely, as substitution is then only performed on in-scope variables. This should behave more in expected ways, but because of the basic substitution there are still corner cases where results will differ from LATERAL.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
Re: [I] Service enhancer does not respect variable scopes [jena]
Posted by "Aklakan (via GitHub)" <gi...@apache.org>.
Aklakan commented on issue #2996:
URL: https://github.com/apache/jena/issues/2996#issuecomment-2642996106
No worries - thanks for evaluating the plugin :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org