Hi, Andy, 

Thanks for your help. 

I 've tried out your suggestions, it worked well. 

Basically, three steps are important:

1) remote URI for endpoint:
String serviceUri = getDatasetUri() + PropNameValue.update.getName();  
(something like "http://xxx.ccc.com:3030/dataset/update";;)


2) update string:
String updateString = "COPY <" + orgUri + "> TO <" + cpUri + ">";


3) get handles for UpdateRequest and UpdateProcessor
UpdateRequest ur = UpdateFactory.create(updateString);
UpdateProcessor up = UpdateExecutionFactory.createRemote(ur, serviceUri);

up.execute();


Cheers, 
Frank


+++


From: Andy Seaborne <[email protected]>
To: [email protected] 
Sent: Friday, September 28, 2012 1:23 AM
Subject: Re: Remote named graph
 
On 28/09/12 01:46, Frank Lee wrote:
> Hi, Andy,
>
> For query, we have:
>
> String queryUri = "http://xxx.ccc.com:3030/dataset/query";;
> Query query = QueryFactory.create(queryString);
>
> QueryEngineHTTP qeHttp = QueryExecutionFactory.createServiceRequest(queryUri, 
> query);
>
> ResultSet results = qeHttp.execSelect();
>
>
> which is perfect.
>
> How about for update?
> Do we also have similar things like:
>
> String updateUri = "http://xxx.ccc.com:3030/dataset/update";;
> UpdateRequest ur = UpdateFactory.create(updateString);
>
>
> And then get the handle to execute update? It'd be great if you can come up 
> with some code examples.

UpdateExecutionFactory.createRemote.

Javadoc:
http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/update/UpdateExecutionFactory.html#createRemote%28com.hp.hpl.jena.update.UpdateRequest,%20java.lang.String%29

The project would be delighted to receive additional content for the web 
site.  The content is in svn:

https://svn.apache.org/repos/asf/jena/site/trunk/

    Andy

>
> Thanks
> Frank
>
>
>
>
> ________________________________
>   From: Frank Lee <[email protected]>
> To: "[email protected]" <[email protected]>
> Sent: Wednesday, September 26, 2012 1:17 PM
> Subject: Re: Remote named graph
>
> Thanks, Andy. It made good sense.
>
> Cheers,
> Frank
>
>
>
> ________________________________
> From: Andy Seaborne <[email protected]>
> To: [email protected]
> Sent: Wednesday, September 26, 2012 11:31 AM
> Subject: Re: Remote named graph
>
> On 26/09/12 01:06, Frank Lee wrote:
>> Thanks for that, Andy.
>>
>> So, we can't use any existing API (for we've already grabbed the handle of 
>> the namedGraph model) to duplicate it, SPARQL/update is the only way to do 
>> it.
>
> Mu suggestions were made so as to avoid copying everything onto the
> local machine, and copying it back out again.   Using COPY, only a copy
> within the remote machine is done.  Is that what you are trying to do?
>
>      Andy
>
>
>>
>>
>>
>> ________________________________
>>     From: Andy Seaborne <[email protected]>
>> To: [email protected]
>> Sent: Tuesday, September 25, 2012 2:34 PM
>> Subject: Re: Remote named graph
>>
>> On 25/09/12 00:33, Frank Lee wrote:
>>> Hi, Andy,
>>>
>>> What will be better way to duplicate existing named graph remotely?
>>> Or duplicated many with different URIs. Is there any simple API to
>>> use for it? Thanks.
>>>
>>> Cheers Frank
>>
>> SPARQL Update:
>>
>> something like
>>
>> COPY <g1> To <g2>
>>
>> for a one to one copy:
>>
>> or
>>
>> INSERT { GRAPH <g> { ?s ?p ?o } }
>> WHERE { GRAPH ?g { ?s ?p ?o } FILTER ( ?g IN ( <g1>, <g2>, <g3> ) ) }
>>
>> for many
>>
>> (untested)
>>
>>        Andy
>>

Reply via email to