You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Andy Seaborne <an...@apache.org> on 2012/08/28 11:05:16 UTC

Remote named graph

> Hi, Andy,
>
> It's easy to get the model for a named graph from local TDB dataset
>
> tdb_dir = "c:\\tdb";
>
> ds = TDBFactory.createDataset(tdb_dir);
>
>
> String ngUri = "http://xxx .."
> Model model = ds.getNamedModel(ngUri);
>
> However, if we run fuseki server with TDB remotely,  how can we get the model for the specified named graph?
> For instance, the fuseki server run at remote server with IP address: 172.25.19.233 and tdb directory is /home/tdb at linux machine.
>
> Thanks.
>
> Frank
>
>
> +++

Frank,

I'm not sure what you mean: access the remote named graph or pull its 
contents to the local machine.

1/ Access:

Use GRAPH in a SPARQL query.

2/ The remote graph has a name using the SPARQL Graph store protocol:

http://host/datasets/data?graph=http://xxx ..

You can simple GET this although there is some code to present that 
nicely in Fuseki (DatasetAccessor).

This is a local copy.

(this code will move from Fuseki into ARQ sometime with a consequent 
package renaming)

	Andy

Re: Remote named graph

Posted by Frank Lee <fr...@yahoo.com>.
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 <an...@apache.org>
To: users@jena.apache.org 
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 <fr...@yahoo.com>
> To: "users@jena.apache.org" <us...@jena.apache.org>
> Sent: Wednesday, September 26, 2012 1:17 PM
> Subject: Re: Remote named graph
>
> Thanks, Andy. It made good sense.
>
> Cheers,
> Frank
>
>
>
> ________________________________
> From: Andy Seaborne <an...@apache.org>
> To: users@jena.apache.org
> 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 <an...@apache.org>
>> To: users@jena.apache.org
>> 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
>>

Re: Remote named graph

Posted by Andy Seaborne <an...@apache.org>.
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 <fr...@yahoo.com>
> To: "users@jena.apache.org" <us...@jena.apache.org>
> Sent: Wednesday, September 26, 2012 1:17 PM
> Subject: Re: Remote named graph
>
> Thanks, Andy. It made good sense.
>
> Cheers,
> Frank
>
>
>
> ________________________________
> From: Andy Seaborne <an...@apache.org>
> To: users@jena.apache.org
> 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 <an...@apache.org>
>> To: users@jena.apache.org
>> 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
>>


Re: Remote named graph

Posted by Frank Lee <fr...@yahoo.com>.
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.

Thanks
Frank




________________________________
 From: Frank Lee <fr...@yahoo.com>
To: "users@jena.apache.org" <us...@jena.apache.org> 
Sent: Wednesday, September 26, 2012 1:17 PM
Subject: Re: Remote named graph
 
Thanks, Andy. It made good sense. 

Cheers, 
Frank



________________________________
From: Andy Seaborne <an...@apache.org>
To: users@jena.apache.org 
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 <an...@apache.org>
> To: users@jena.apache.org
> 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
>

Re: Remote named graph

Posted by Frank Lee <fr...@yahoo.com>.
Thanks, Andy. It made good sense. 

Cheers, 
Frank



________________________________
 From: Andy Seaborne <an...@apache.org>
To: users@jena.apache.org 
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 <an...@apache.org>
> To: users@jena.apache.org
> 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
>

Re: Remote named graph

Posted by Andy Seaborne <an...@apache.org>.
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 <an...@apache.org>
> To: users@jena.apache.org
> 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
>


Re: Remote named graph

Posted by Frank Lee <fr...@yahoo.com>.
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. 



________________________________
 From: Andy Seaborne <an...@apache.org>
To: users@jena.apache.org 
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

Re: Remote named graph

Posted by Andy Seaborne <an...@apache.org>.
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


Re: Remote named graph

Posted by Frank Lee <fr...@yahoo.com>.
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


________________________________
 From: Andy Seaborne <an...@apache.org>
To: users@jena.apache.org 
Sent: Wednesday, August 29, 2012 1:32 AM
Subject: Re: Remote named graph
 
On 28/08/12 23:19, Frank Lee wrote:
> Hi, Andy.
>
> Thanks so much for your warm help.
>
> Obtaining the handle of  DatasetAccessor what I really wanted. Thanks.
>
> BTW, how can we get the list/interator of namedGraphs from DatasetAccessor or ARQ?

You can use:

SELECT ?g { GRAPH ?g {} }

the interface DatasetAccessor does not provide such an operation and you 
need to get it from elsewhere - the interface could be used to a thing 
that stores graphs as a distributed map without ability to enumerate all 
keys ... like a very large key-value store providing just the SPARQL 
Graph Store Protocol (which despite the name, is not a query protocol).

    Andy

>
> Thanks.
> Frank
>
>
>
> ________________________________
>   From: Andy Seaborne <an...@apache.org>
> To: users@jena.apache.org
> Sent: Tuesday, August 28, 2012 2:05 AM
> Subject: Remote named graph
>
>> Hi, Andy,
>>
>> It's easy to get the model for a named graph from local TDB dataset
>>
>> tdb_dir = "c:\\tdb";
>>
>> ds = TDBFactory.createDataset(tdb_dir);
>>
>>
>> String ngUri = "http://xxx .."
>> Model model = ds.getNamedModel(ngUri);
>>
>> However, if we run fuseki server with TDB remotely,  how can we get the model for the specified named graph?
>> For instance, the fuseki server run at remote server with IP address: 172.25.19.233 and tdb directory is /home/tdb at linux machine.
>>
>> Thanks.
>>
>> Frank
>>
>>
>> +++
>
> Frank,
>
> I'm not sure what you mean: access the remote named graph or pull its
> contents to the local machine.
>
> 1/ Access:
>
> Use GRAPH in a SPARQL query.
>
> 2/ The remote graph has a name using the SPARQL Graph store protocol:
>
> http://host/datasets/data?graph=http://xxx ..
>
> You can simple GET this although there is some code to present that
> nicely in Fuseki (DatasetAccessor).
>
> This is a local copy.
>
> (this code will move from Fuseki into ARQ sometime with a consequent
> package renaming)
>
>      Andy
>

Re: Merge from Remote named graph and local RDF file

Posted by Frank Lee <fr...@yahoo.com>.
Hi, Andy, 

The error code went away after I updated Fuseki/TDB to the latest version. Thanks a lot. 

Also, merging the local RDF file (containing measurement data) into the remote existing named graph has been successfully completed. Again, thanks for warm help. 
One last question. Can we 'UNDO' the merging (like roll back) after successfully merged -- if the user wants to try different RDF data? 



Cheers, 
Frank




________________________________
 From: Andy Seaborne <an...@apache.org>
To: users@jena.apache.org 
Sent: Monday, September 3, 2012 8:14 AM
Subject: Re: Merge from Remote named graph and local RDF file
 
On 31/08/12 18:12, Frank Lee wrote:
> Thanks a lot, Andy I'll try it shortly.
>

> This morning, I put new war at my server to deploy. Somehow, saw the
> following exceptions when I tried to load one of named graph.

> Error code is 500.
>
> What could be possible root cause then? Thanks,.

This is occasional?  If so, your running an old version (of Fuseki).

    Andy

>
> Cheers,
> Frank
>
> ......
> INFO  [33] Query = PREFIX  cim:  <http://iec.ch/TC57/2010/CIM-schema-cim15#> PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#> PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>  SELECT DISTINCT  ?id ?name ?transformer ?windingInfo ?grounded WHERE   { { GRAPH <http://dm360.nexant.com/graphs/HZhang/berkeley/6.0/20120820172059>         { ?id cim:IdentifiedObject.name ?name .           ?id rdf:type cim:DistributionTransformerWinding .           ?id cim:DistributionTransformerWinding.Transformer ?transformer .           ?id cim:DistributionTransformerWinding.WindingInfo ?windingInfo .           ?id cim:DistributionTransformerWinding.grounded ?grounded         }     }   }
> WARN  [33] RC = 500 : Currently in a transaction (location:/home/hzhang/tdb/tdb2/)
> com.hp.hpl.jena.sparql.JenaTransactionException: Currently in a transaction (location:/home/hzhang/tdb/tdb2/)
>          at com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction.checkNotActive(DatasetGraphTransaction.java:94)
>          at com.hp.hpl.jena.tdb.migrate.DatasetGraphTrackActive.begin(DatasetGraphTrackActive.java:51)
>          at org.apache.jena.fuseki.servlets.HttpAction.beginRead(HttpAction.java:87)
>          at org.apache.jena.fuseki.servlets.SPARQL_Query.execute(SPARQL_Query.java:228)
>          at org.apache.jena.fuseki.servlets.SPARQL_Query.executeWithParameter(SPARQL_Query.java:197)
>          at org.apache.jena.fuseki.servlets.SPARQL_Query.perform(SPARQL_Query.java:113)
>          at org.apache.jena.fuseki.servlets.SPARQL_ServletBase.doCommon(SPARQL_ServletBase.java:92)
>          at org.apache.jena.fuseki.servlets.SPARQL_Query.doGet(SPARQL_Query.java:93)
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>          at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547)
>          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1359)
>          at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:77)
>          at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:181)
>          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1330)
>          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
>          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
>          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:941)
>          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
>          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
>          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)
>          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
>          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
>          at org.eclipse.jetty.server.Server.handle(Server.java:349)
>          at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
>          at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:919)
>          at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582)
>          at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
>          at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:50)
>          at org.eclipse.jetty.server.nio.BlockingChannelConnector$BlockingChannelEndPoint.run(BlockingChannelConnector.java:293)
>          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
>          at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
>          at java.lang.Thread.run(Unknown Source)
> INFO  [33] 500 Currently in a transaction (location:/home/hzhang/tdb/tdb2/)
> INFO  [32] 200 OK
>
>
>
> ++++
>
>
>
> ________________________________
>   From: Andy Seaborne <an...@apache.org>
> To: users@jena.apache.org
> Sent: Friday, August 31, 2012 2:36 AM
> Subject: Re: Merge from Remote named graph and local RDF file
>
> On 30/08/12 19:34, Frank Lee wrote:
>> One more question:
>>
>> What will be the best way to merge tow endpoints, one is the namedGraph at remote server and one is the local RDF file.
>> For example, the graph does not have status value, but the local rdf file has.  Thanks.
>>
>> Cheers,
>> Frank.
>
> Just add the contents of one graph into another
>
> Remote:
>
> POST local graph to remote graph
>
> Local:
>
> Read remote graph into same model as local graph.
>
> Take a copy of the target first if you want 3 graphs: 2 originals and
> one which is the merge of the two.
>
>      Andy
>

Re: Merge from Remote named graph and local RDF file

Posted by Andy Seaborne <an...@apache.org>.
On 31/08/12 18:12, Frank Lee wrote:
> Thanks a lot, Andy I'll try it shortly.
>

> This morning, I put new war at my server to deploy. Somehow, saw the
> following exceptions when I tried to load one of named graph.

> Error code is 500.
>
> What could be possible root cause then? Thanks,.

This is occasional?  If so, your running an old version (of Fuseki).

	Andy

>
> Cheers,
> Frank
>
> ......
> INFO  [33] Query = PREFIX  cim:  <http://iec.ch/TC57/2010/CIM-schema-cim15#> PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#> PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>  SELECT DISTINCT  ?id ?name ?transformer ?windingInfo ?grounded WHERE   { { GRAPH <http://dm360.nexant.com/graphs/HZhang/berkeley/6.0/20120820172059>         { ?id cim:IdentifiedObject.name ?name .           ?id rdf:type cim:DistributionTransformerWinding .           ?id cim:DistributionTransformerWinding.Transformer ?transformer .           ?id cim:DistributionTransformerWinding.WindingInfo ?windingInfo .           ?id cim:DistributionTransformerWinding.grounded ?grounded         }     }   }
> WARN  [33] RC = 500 : Currently in a transaction (location:/home/hzhang/tdb/tdb2/)
> com.hp.hpl.jena.sparql.JenaTransactionException: Currently in a transaction (location:/home/hzhang/tdb/tdb2/)
>          at com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction.checkNotActive(DatasetGraphTransaction.java:94)
>          at com.hp.hpl.jena.tdb.migrate.DatasetGraphTrackActive.begin(DatasetGraphTrackActive.java:51)
>          at org.apache.jena.fuseki.servlets.HttpAction.beginRead(HttpAction.java:87)
>          at org.apache.jena.fuseki.servlets.SPARQL_Query.execute(SPARQL_Query.java:228)
>          at org.apache.jena.fuseki.servlets.SPARQL_Query.executeWithParameter(SPARQL_Query.java:197)
>          at org.apache.jena.fuseki.servlets.SPARQL_Query.perform(SPARQL_Query.java:113)
>          at org.apache.jena.fuseki.servlets.SPARQL_ServletBase.doCommon(SPARQL_ServletBase.java:92)
>          at org.apache.jena.fuseki.servlets.SPARQL_Query.doGet(SPARQL_Query.java:93)
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>          at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547)
>          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1359)
>          at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:77)
>          at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:181)
>          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1330)
>          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
>          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
>          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:941)
>          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
>          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
>          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)
>          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
>          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
>          at org.eclipse.jetty.server.Server.handle(Server.java:349)
>          at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
>          at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:919)
>          at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582)
>          at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
>          at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:50)
>          at org.eclipse.jetty.server.nio.BlockingChannelConnector$BlockingChannelEndPoint.run(BlockingChannelConnector.java:293)
>          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
>          at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
>          at java.lang.Thread.run(Unknown Source)
> INFO  [33] 500 Currently in a transaction (location:/home/hzhang/tdb/tdb2/)
> INFO  [32] 200 OK
>
>
>
> ++++
>
>
>
> ________________________________
>   From: Andy Seaborne <an...@apache.org>
> To: users@jena.apache.org
> Sent: Friday, August 31, 2012 2:36 AM
> Subject: Re: Merge from Remote named graph and local RDF file
>
> On 30/08/12 19:34, Frank Lee wrote:
>> One more question:
>>
>> What will be the best way to merge tow endpoints, one is the namedGraph at remote server and one is the local RDF file.
>> For example, the graph does not have status value, but the local rdf file has.  Thanks.
>>
>> Cheers,
>> Frank.
>
> Just add the contents of one graph into another
>
> Remote:
>
> POST local graph to remote graph
>
> Local:
>
> Read remote graph into same model as local graph.
>
> Take a copy of the target first if you want 3 graphs: 2 originals and
> one which is the merge of the two.
>
>      Andy
>


Re: Merge from Remote named graph and local RDF file

Posted by Frank Lee <fr...@yahoo.com>.
Thanks a lot, Andy I'll try it shortly. 

This morning, I put new war at my server to deploy. Somehow, saw the following  exceptions when I tried to load one of named graph. 

Error code is 500.

What could be possible root cause then? Thanks,.

Cheers, 
Frank 

......
INFO  [33] Query = PREFIX  cim:  <http://iec.ch/TC57/2010/CIM-schema-cim15#> PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#> PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>  SELECT DISTINCT  ?id ?name ?transformer ?windingInfo ?grounded WHERE   { { GRAPH <http://dm360.nexant.com/graphs/HZhang/berkeley/6.0/20120820172059>         { ?id cim:IdentifiedObject.name ?name .           ?id rdf:type cim:DistributionTransformerWinding .           ?id cim:DistributionTransformerWinding.Transformer ?transformer .           ?id cim:DistributionTransformerWinding.WindingInfo ?windingInfo .           ?id cim:DistributionTransformerWinding.grounded ?grounded         }     }   }
WARN  [33] RC = 500 : Currently in a transaction (location:/home/hzhang/tdb/tdb2/)
com.hp.hpl.jena.sparql.JenaTransactionException: Currently in a transaction (location:/home/hzhang/tdb/tdb2/)
        at com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction.checkNotActive(DatasetGraphTransaction.java:94)
        at com.hp.hpl.jena.tdb.migrate.DatasetGraphTrackActive.begin(DatasetGraphTrackActive.java:51)
        at org.apache.jena.fuseki.servlets.HttpAction.beginRead(HttpAction.java:87)
        at org.apache.jena.fuseki.servlets.SPARQL_Query.execute(SPARQL_Query.java:228)
        at org.apache.jena.fuseki.servlets.SPARQL_Query.executeWithParameter(SPARQL_Query.java:197)
        at org.apache.jena.fuseki.servlets.SPARQL_Query.perform(SPARQL_Query.java:113)
        at org.apache.jena.fuseki.servlets.SPARQL_ServletBase.doCommon(SPARQL_ServletBase.java:92)
        at org.apache.jena.fuseki.servlets.SPARQL_Query.doGet(SPARQL_Query.java:93)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1359)
        at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:77)
        at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:181)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1330)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:941)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
        at org.eclipse.jetty.server.Server.handle(Server.java:349)
        at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
        at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:919)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
        at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:50)
        at org.eclipse.jetty.server.nio.BlockingChannelConnector$BlockingChannelEndPoint.run(BlockingChannelConnector.java:293)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
        at java.lang.Thread.run(Unknown Source)
INFO  [33] 500 Currently in a transaction (location:/home/hzhang/tdb/tdb2/)
INFO  [32] 200 OK



++++



________________________________
 From: Andy Seaborne <an...@apache.org>
To: users@jena.apache.org 
Sent: Friday, August 31, 2012 2:36 AM
Subject: Re: Merge from Remote named graph and local RDF file
 
On 30/08/12 19:34, Frank Lee wrote:
> One more question:
>
> What will be the best way to merge tow endpoints, one is the namedGraph at remote server and one is the local RDF file.
> For example, the graph does not have status value, but the local rdf file has.  Thanks.
>
> Cheers,
> Frank.

Just add the contents of one graph into another

Remote:

POST local graph to remote graph

Local:

Read remote graph into same model as local graph.

Take a copy of the target first if you want 3 graphs: 2 originals and 
one which is the merge of the two.

    Andy

Re: Merge from Remote named graph and local RDF file

Posted by Andy Seaborne <an...@apache.org>.
On 30/08/12 19:34, Frank Lee wrote:
> One more question:
>
> What will be the best way to merge tow endpoints, one is the namedGraph at remote server and one is the local RDF file.
> For example, the graph does not have status value, but the local rdf file has.  Thanks.
>
> Cheers,
> Frank.

Just add the contents of one graph into another

Remote:

POST local graph to remote graph

Local:

Read remote graph into same model as local graph.

Take a copy of the target first if you want 3 graphs: 2 originals and 
one which is the merge of the two.

	Andy

Re: Merge from Remote named graph and local RDF file

Posted by Frank Lee <fr...@yahoo.com>.
Hi, Andy, 

Again, many thanks for your help. It works perfectly. 

I come up with my own method that returns a namedGraphList --- List<String>. Basically, QueryEngineHTTP is used to create service request like:

String queryString = "SELECT ?ng { GRAPH ?ng {} }";
Query query = QueryFactory.create(queryString);

String service = getDatasetUri() + PropNameValue.query.getName();
QueryEngineHTTP qexec = (QueryEngineHTTP)QueryExecutionFactory.createServiceRequest(service, query);
ResultSet results = qexec.execSelect();

 
One more question:

What will be the best way to merge tow endpoints, one is the namedGraph at remote server and one is the local RDF file.
For example, the graph does not have status value, but the local rdf file has.  Thanks.

Cheers, 
Frank. 

+++




________________________________
 From: Andy Seaborne <an...@apache.org>
To: users@jena.apache.org 
Sent: Wednesday, August 29, 2012 1:32 AM
Subject: Re: Remote named graph
 
On 28/08/12 23:19, Frank Lee wrote:
> Hi, Andy.
>
> Thanks so much for your warm help.
>
> Obtaining the handle of  DatasetAccessor what I really wanted. Thanks.
>
> BTW, how can we get the list/interator of namedGraphs from DatasetAccessor or ARQ?

You can use:

SELECT ?g { GRAPH ?g {} }

the interface DatasetAccessor does not provide such an operation and you 
need to get it from elsewhere - the interface could be used to a thing 
that stores graphs as a distributed map without ability to enumerate all 
keys ... like a very large key-value store providing just the SPARQL 
Graph Store Protocol (which despite the name, is not a query protocol).

    Andy

>
> Thanks.
> Frank
>
>
>
> ________________________________
>   From: Andy Seaborne <an...@apache.org>
> To: users@jena.apache.org
> Sent: Tuesday, August 28, 2012 2:05 AM
> Subject: Remote named graph
>
>> Hi, Andy,
>>
>> It's easy to get the model for a named graph from local TDB dataset
>>
>> tdb_dir = "c:\\tdb";
>>
>> ds = TDBFactory.createDataset(tdb_dir);
>>
>>
>> String ngUri = "http://xxx .."
>> Model model = ds.getNamedModel(ngUri);
>>
>> However, if we run fuseki server with TDB remotely,  how can we get the model for the specified named graph?
>> For instance, the fuseki server run at remote server with IP address: 172.25.19.233 and tdb directory is /home/tdb at linux machine.
>>
>> Thanks.
>>
>> Frank
>>
>>
>> +++
>
> Frank,
>
> I'm not sure what you mean: access the remote named graph or pull its
> contents to the local machine.
>
> 1/ Access:
>
> Use GRAPH in a SPARQL query.
>
> 2/ The remote graph has a name using the SPARQL Graph store protocol:
>
> http://host/datasets/data?graph=http://xxx ..
>
> You can simple GET this although there is some code to present that
> nicely in Fuseki (DatasetAccessor).
>
> This is a local copy.
>
> (this code will move from Fuseki into ARQ sometime with a consequent
> package renaming)
>
>      Andy
>

Re: Remote named graph

Posted by Andy Seaborne <an...@apache.org>.
On 28/08/12 23:19, Frank Lee wrote:
> Hi, Andy.
>
> Thanks so much for your warm help.
>
> Obtaining the handle of  DatasetAccessor what I really wanted. Thanks.
>
> BTW, how can we get the list/interator of namedGraphs from DatasetAccessor or ARQ?

You can use:

SELECT ?g { GRAPH ?g {} }

the interface DatasetAccessor does not provide such an operation and you 
need to get it from elsewhere - the interface could be used to a thing 
that stores graphs as a distributed map without ability to enumerate all 
keys ... like a very large key-value store providing just the SPARQL 
Graph Store Protocol (which despite the name, is not a query protocol).

	Andy

>
> Thanks.
> Frank
>
>
>
> ________________________________
>   From: Andy Seaborne <an...@apache.org>
> To: users@jena.apache.org
> Sent: Tuesday, August 28, 2012 2:05 AM
> Subject: Remote named graph
>
>> Hi, Andy,
>>
>> It's easy to get the model for a named graph from local TDB dataset
>>
>> tdb_dir = "c:\\tdb";
>>
>> ds = TDBFactory.createDataset(tdb_dir);
>>
>>
>> String ngUri = "http://xxx .."
>> Model model = ds.getNamedModel(ngUri);
>>
>> However, if we run fuseki server with TDB remotely,  how can we get the model for the specified named graph?
>> For instance, the fuseki server run at remote server with IP address: 172.25.19.233 and tdb directory is /home/tdb at linux machine.
>>
>> Thanks.
>>
>> Frank
>>
>>
>> +++
>
> Frank,
>
> I'm not sure what you mean: access the remote named graph or pull its
> contents to the local machine.
>
> 1/ Access:
>
> Use GRAPH in a SPARQL query.
>
> 2/ The remote graph has a name using the SPARQL Graph store protocol:
>
> http://host/datasets/data?graph=http://xxx ..
>
> You can simple GET this although there is some code to present that
> nicely in Fuseki (DatasetAccessor).
>
> This is a local copy.
>
> (this code will move from Fuseki into ARQ sometime with a consequent
> package renaming)
>
>      Andy
>


Re: Remote named graph

Posted by Frank Lee <fr...@yahoo.com>.
Hi, Andy. 

Thanks so much for your warm help. 

Obtaining the handle of  DatasetAccessor what I really wanted. Thanks.

BTW, how can we get the list/interator of namedGraphs from DatasetAccessor or ARQ?

Thanks.
Frank



________________________________
 From: Andy Seaborne <an...@apache.org>
To: users@jena.apache.org 
Sent: Tuesday, August 28, 2012 2:05 AM
Subject: Remote named graph
 
> Hi, Andy,
>
> It's easy to get the model for a named graph from local TDB dataset
>
> tdb_dir = "c:\\tdb";
>
> ds = TDBFactory.createDataset(tdb_dir);
>
>
> String ngUri = "http://xxx .."
> Model model = ds.getNamedModel(ngUri);
>
> However, if we run fuseki server with TDB remotely,  how can we get the model for the specified named graph?
> For instance, the fuseki server run at remote server with IP address: 172.25.19.233 and tdb directory is /home/tdb at linux machine.
>
> Thanks.
>
> Frank
>
>
> +++

Frank,

I'm not sure what you mean: access the remote named graph or pull its 
contents to the local machine.

1/ Access:

Use GRAPH in a SPARQL query.

2/ The remote graph has a name using the SPARQL Graph store protocol:

http://host/datasets/data?graph=http://xxx ..

You can simple GET this although there is some code to present that 
nicely in Fuseki (DatasetAccessor).

This is a local copy.

(this code will move from Fuseki into ARQ sometime with a consequent 
package renaming)

    Andy