You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Dick Murray <da...@gmail.com> on 2012/11/22 15:16:04 UTC

Context issue with custom UpdateEngineFactory.

Hi all.

I need the UpdateEngineFactory accept(..) to query a user defined value in
the passed Context or is there a way that I can get a user defined Symbol
into the Context at the point I submit an UpdateAction?

The UpdateEngineFactory accept(..) is triggered via a call to
UpdateAction.execute(..).

Prior to this call I need to put a Symbol into the context for the
accept(..) to retrieve.

But I cannot see how to achieve this.

Looking at the Jena code.

UpdateAction.execute(..) calls

UpdateAction.execute$(..) calls

UpdateExecutionFactory.create(..) calls with Context parameter as null

UpdateExecutionFactory.make(..)

make(..) is private. and according to the Eclipse call hierachy make(..) is
only called by create(..) which means the Context always ends up being a
copy of ARQ.getContext() because the first lines of make(..) code are...

        if ( context == null )
            context = ARQ.getContext().copy();

I've looked at
http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/sparql/util/class-use/Context.htmlbut
nothing obvious springs out...

Regards Dick.

Re: Context issue with custom UpdateEngineFactory.

Posted by Dick Murray <da...@gmail.com>.
Thank you Andy.

I realised that I wanted the context for the accept() but as I was passing
the custom update factory (and ultimately the update engine worker I
needed) to the update processor base I didn't need the context any more as
I can pass in the correct factory.

But the context access via the exposed make has allowed me to achieve
something else... :-)

Dick.

On 23 November 2012 13:44, Andy Seaborne <an...@apache.org> wrote:

> On 23/11/12 13:38, Andy Seaborne wrote:
>
>> On 22/11/12 15:20, Dick Murray wrote:
>>
>>> Hi all.
>>>
>>> Looking further I found the UpdateProcessorBase and wrote the following
>>> wrapper;
>>>
>>> context = ARQ.getContext().copy();
>>> put(u4EndpointIDSymbol, endpointGetID());
>>> uProc = new UpdateProcessorBase(**updateRequest,
>>> GraphStoreFactory.create(**graphDataset), context, updateEngineFactory);
>>> execute();
>>>
>>> Which is basically what private static UpdateProcessor make(UpdateRequest
>>> updateRequest, GraphStore graphStore, Binding initialBinding, Context
>>> context) does.
>>>
>>> I still create my custom UpdateEngineFactory but I don't register it with
>>> UpdateEngineRegistry.get().**add(updateEngineFactory);
>>>
>>> Anyone see any issues with this?
>>>
>>
>>
> (pressed send too soon .... "send" != "save")
>
>
>  No - looks OK.
>>
>> There should a method on UpdateProcess to expose the per-execution
>> context (the copy of the global ARQ.getContext() ,merged with any per
>> graph store (which means the original dataset).
>>
>> Added in SVN.  It was missing in the interface.
>>
>> The dataset can also have it's own context - that's copied into the
>> execution one (another fix around the copy of ARQ.getContext)
>>
>
> The case of wanting context access during UpdateEngine lookup is covered
> by setting on the graphstore/dataset.  There could be an explicit context
> argument in UpdateExecutionFactory.
>
> I've added access to make(....), but not added a "Context" variant to
> every factory method.
>
> Caution - a context can be null - for example, the remote access
> UpdateProcessors.  It isn't for a local one.
>
>
>
>>      Andy
>>
>>
>>> Dick.
>>>
>>>
>>> On 22 November 2012 14:16, Dick Murray <da...@gmail.com> wrote:
>>>
>>>  Hi all.
>>>>
>>>> I need the UpdateEngineFactory accept(..) to query a user defined
>>>> value in
>>>> the passed Context or is there a way that I can get a user defined
>>>> Symbol
>>>> into the Context at the point I submit an UpdateAction?
>>>>
>>>> The UpdateEngineFactory accept(..) is triggered via a call to
>>>> UpdateAction.execute(..).
>>>>
>>>> Prior to this call I need to put a Symbol into the context for the
>>>> accept(..) to retrieve.
>>>>
>>>> But I cannot see how to achieve this.
>>>>
>>>> Looking at the Jena code.
>>>>
>>>> UpdateAction.execute(..) calls
>>>>
>>>> UpdateAction.execute$(..) calls
>>>>
>>>> UpdateExecutionFactory.create(**..) calls with Context parameter as
>>>> null
>>>>
>>>> UpdateExecutionFactory.make(..**)
>>>>
>>>> make(..) is private. and according to the Eclipse call hierachy make(..)
>>>> is only called by create(..) which means the Context always ends up
>>>> being a
>>>> copy of ARQ.getContext() because the first lines of make(..) code are...
>>>>
>>>>          if ( context == null )
>>>>              context = ARQ.getContext().copy();
>>>>
>>>> I've looked at
>>>> http://jena.apache.org/**documentation/javadoc/arq/com/**
>>>> hp/hpl/jena/sparql/util/class-**use/Context.htmlbut<http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/sparql/util/class-use/Context.htmlbut>
>>>> nothing obvious springs out...
>>>>
>>>> Regards Dick.
>>>>
>>>>
>>>
>>
>

Re: Context issue with custom UpdateEngineFactory.

Posted by Andy Seaborne <an...@apache.org>.
On 23/11/12 13:38, Andy Seaborne wrote:
> On 22/11/12 15:20, Dick Murray wrote:
>> Hi all.
>>
>> Looking further I found the UpdateProcessorBase and wrote the following
>> wrapper;
>>
>> context = ARQ.getContext().copy();
>> put(u4EndpointIDSymbol, endpointGetID());
>> uProc = new UpdateProcessorBase(updateRequest,
>> GraphStoreFactory.create(graphDataset), context, updateEngineFactory);
>> execute();
>>
>> Which is basically what private static UpdateProcessor make(UpdateRequest
>> updateRequest, GraphStore graphStore, Binding initialBinding, Context
>> context) does.
>>
>> I still create my custom UpdateEngineFactory but I don't register it with
>> UpdateEngineRegistry.get().add(updateEngineFactory);
>>
>> Anyone see any issues with this?
>

(pressed send too soon .... "send" != "save")

> No - looks OK.
>
> There should a method on UpdateProcess to expose the per-execution
> context (the copy of the global ARQ.getContext() ,merged with any per
> graph store (which means the original dataset).
>
> Added in SVN.  It was missing in the interface.
>
> The dataset can also have it's own context - that's copied into the
> execution one (another fix around the copy of ARQ.getContext)

The case of wanting context access during UpdateEngine lookup is covered 
by setting on the graphstore/dataset.  There could be an explicit 
context argument in UpdateExecutionFactory.

I've added access to make(....), but not added a "Context" variant to 
every factory method.

Caution - a context can be null - for example, the remote access 
UpdateProcessors.  It isn't for a local one.

>
>      Andy
>
>>
>> Dick.
>>
>>
>> On 22 November 2012 14:16, Dick Murray <da...@gmail.com> wrote:
>>
>>> Hi all.
>>>
>>> I need the UpdateEngineFactory accept(..) to query a user defined
>>> value in
>>> the passed Context or is there a way that I can get a user defined
>>> Symbol
>>> into the Context at the point I submit an UpdateAction?
>>>
>>> The UpdateEngineFactory accept(..) is triggered via a call to
>>> UpdateAction.execute(..).
>>>
>>> Prior to this call I need to put a Symbol into the context for the
>>> accept(..) to retrieve.
>>>
>>> But I cannot see how to achieve this.
>>>
>>> Looking at the Jena code.
>>>
>>> UpdateAction.execute(..) calls
>>>
>>> UpdateAction.execute$(..) calls
>>>
>>> UpdateExecutionFactory.create(..) calls with Context parameter as null
>>>
>>> UpdateExecutionFactory.make(..)
>>>
>>> make(..) is private. and according to the Eclipse call hierachy make(..)
>>> is only called by create(..) which means the Context always ends up
>>> being a
>>> copy of ARQ.getContext() because the first lines of make(..) code are...
>>>
>>>          if ( context == null )
>>>              context = ARQ.getContext().copy();
>>>
>>> I've looked at
>>> http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/sparql/util/class-use/Context.htmlbut
>>> nothing obvious springs out...
>>>
>>> Regards Dick.
>>>
>>
>


Re: Context issue with custom UpdateEngineFactory.

Posted by Andy Seaborne <an...@apache.org>.
On 22/11/12 15:20, Dick Murray wrote:
> Hi all.
>
> Looking further I found the UpdateProcessorBase and wrote the following
> wrapper;
>
> context = ARQ.getContext().copy();
> put(u4EndpointIDSymbol, endpointGetID());
> uProc = new UpdateProcessorBase(updateRequest,
> GraphStoreFactory.create(graphDataset), context, updateEngineFactory);
> execute();
>
> Which is basically what private static UpdateProcessor make(UpdateRequest
> updateRequest, GraphStore graphStore, Binding initialBinding, Context
> context) does.
>
> I still create my custom UpdateEngineFactory but I don't register it with
> UpdateEngineRegistry.get().add(updateEngineFactory);
>
> Anyone see any issues with this?

No - looks OK.

There should a method on UpdateProcess to expose the per-execution 
context (the copy of the global ARQ.getContext() ,merged with any per 
graph store (which means the original dataset).

Added in SVN.  It was missing in the interface.

The dataset can also have it's own context - that's copied into the 
execution one (another fix around the copy of ARQ.getContext)

	Andy

>
> Dick.
>
>
> On 22 November 2012 14:16, Dick Murray <da...@gmail.com> wrote:
>
>> Hi all.
>>
>> I need the UpdateEngineFactory accept(..) to query a user defined value in
>> the passed Context or is there a way that I can get a user defined Symbol
>> into the Context at the point I submit an UpdateAction?
>>
>> The UpdateEngineFactory accept(..) is triggered via a call to
>> UpdateAction.execute(..).
>>
>> Prior to this call I need to put a Symbol into the context for the
>> accept(..) to retrieve.
>>
>> But I cannot see how to achieve this.
>>
>> Looking at the Jena code.
>>
>> UpdateAction.execute(..) calls
>>
>> UpdateAction.execute$(..) calls
>>
>> UpdateExecutionFactory.create(..) calls with Context parameter as null
>>
>> UpdateExecutionFactory.make(..)
>>
>> make(..) is private. and according to the Eclipse call hierachy make(..)
>> is only called by create(..) which means the Context always ends up being a
>> copy of ARQ.getContext() because the first lines of make(..) code are...
>>
>>          if ( context == null )
>>              context = ARQ.getContext().copy();
>>
>> I've looked at
>> http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/sparql/util/class-use/Context.htmlbut nothing obvious springs out...
>>
>> Regards Dick.
>>
>


Re: Context issue with custom UpdateEngineFactory.

Posted by Dick Murray <da...@gmail.com>.
Hi all.

Looking further I found the UpdateProcessorBase and wrote the following
wrapper;

context = ARQ.getContext().copy();
put(u4EndpointIDSymbol, endpointGetID());
uProc = new UpdateProcessorBase(updateRequest,
GraphStoreFactory.create(graphDataset), context, updateEngineFactory);
execute();

Which is basically what private static UpdateProcessor make(UpdateRequest
updateRequest, GraphStore graphStore, Binding initialBinding, Context
context) does.

I still create my custom UpdateEngineFactory but I don't register it with
UpdateEngineRegistry.get().add(updateEngineFactory);

Anyone see any issues with this?

Dick.


On 22 November 2012 14:16, Dick Murray <da...@gmail.com> wrote:

> Hi all.
>
> I need the UpdateEngineFactory accept(..) to query a user defined value in
> the passed Context or is there a way that I can get a user defined Symbol
> into the Context at the point I submit an UpdateAction?
>
> The UpdateEngineFactory accept(..) is triggered via a call to
> UpdateAction.execute(..).
>
> Prior to this call I need to put a Symbol into the context for the
> accept(..) to retrieve.
>
> But I cannot see how to achieve this.
>
> Looking at the Jena code.
>
> UpdateAction.execute(..) calls
>
> UpdateAction.execute$(..) calls
>
> UpdateExecutionFactory.create(..) calls with Context parameter as null
>
> UpdateExecutionFactory.make(..)
>
> make(..) is private. and according to the Eclipse call hierachy make(..)
> is only called by create(..) which means the Context always ends up being a
> copy of ARQ.getContext() because the first lines of make(..) code are...
>
>         if ( context == null )
>             context = ARQ.getContext().copy();
>
> I've looked at
> http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/sparql/util/class-use/Context.htmlbut nothing obvious springs out...
>
> Regards Dick.
>