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
GH-1374: add copyWithRegisties Context helper method #1375
Conversation
I suppose the ARQ method to copy the function registries should eventually also copy the service executor registries (one is already available and another for bulk requests is in the works) - they are typically very small and I don't think it makes sense to exclude those when one explicitly asks for a deep copy of the context in order to add isolated extensions. Maybe instead of naming the method For consistency, the |
PropertyFunctionRegistry res = new PropertyFunctionRegistry(); | ||
if (from == null) { | ||
return res; | ||
} | ||
res.registry.putAll(from.registry); | ||
return res; |
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.
Redundant return can be removed if written that way:
if (from != null) {
res.registry.putAll(from.registry);
}
return res;
I think this is a good idea. |
Discussion on #1374. Context should be intent neutral and not know the value of any symbols. |
What is appropriate place to such functionality ? This is static helper, instance of Maybe, in the case of |
|
Is there something else I can do in additional in the bounds of this PR ? Maybe marking deprecated all other static-helpers of |
Thanks for asking. My first step is to look at #1381 to understand that - and it does currently look like there is a bug managing contexts in QueryExec. A fix may well have knock on-effects. At the moment, there are several active and time-consuming PRs in flight in unrelated areas. |
…onFactory#create(Query, Graph, Context) helpers
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.
Only thing is {@code null)
=> {@code null}
each time in javadoc but I'll fix that.
Feature request: a convenient way to execute a query against graph in a dedicated context.
If we want to execute a query in isolated context with unique set of independent functions and p-functions,
we will encounter some difficulties:
org.apache.jena.sparql.util.Context#copy
performs only shallow copying, not deeporg.apache.jena.query.QueryExecution
So we have to spend some time to find the proper way.
I think this can be simplified by adding two new helper-methods:
Context#copyWithFunctionRegistries(Context)
- the method to create a copy ofContext
with copied function and p-function registriesQueryExecutionFactory#create(Query, Graph, Context)
- the method to createQueryExceution
for aGraph
with the given contextBy submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.
See the Apache Jena "Contributing" guide.