You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by jena melina <je...@gmail.com> on 2018/07/04 14:04:37 UTC
How we store date after shutdowning fuseki server
hello ,
I'm using fuseki server (in-memory ) to manipulate RDF data
And i don't use any TDB backend. My question is how to save modification
that i do using sparql update ?
1/ if I need to write the data back to disk , how can 'i do it ?
2/ if i need to connect my Fuseki to a TDB how can 'i do it ?
To upload tata into fuseki server i use :
public static void uploadRDF(String rdf, String serviceURI) {
Model m = ModelFactory.createDefaultModel();
m.read(Insert.class.getResource("/" + rdf).getFile(), "RDF/XML");
// upload the resulting model
DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
accessor.putModel(m);
}
and to query my Data i use :
public static ResultSet execSelectAndPrintquery(String serviceURI,
String query) {
QueryExecution q = QueryExecutionFactory.sparqlService(serviceURI,
Constants.SPARQL_PREFIX+query);
ResultSet results = q.execSelect();
ResultSetFormatter.out(System.out, results);
return results;
}
and to update data i use :
public static void performUpdate ( String updateCommand,String datasetUrl) {
String id = UUID.randomUUID().toString();
System.out.println(String.format("Adding %s", id));
UpdateProcessor upp =
UpdateExecutionFactory.createRemote(UpdateFactory.create(String.format(EngineConstants.SPARQL_PREFIX+updateCommand
, id)),datasetUrl );
upp.execute();
}
And i need to save all modifications , so ho can i do it ?
thanks for your help ..
Re: How we store date after shutdowning fuseki server
Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
For next time please, put the StackOverflow question link(s) [1], [2]
here to avoid redundancy
[1]
https://stackoverflow.com/questions/51032922/how-to-save-modification-creation-update-of-owl-file-into-fuseki-server
[2]
https://stackoverflow.com/questions/51172034/how-to-store-data-after-doing-modification-using-sparql-update-with-fuseki-serve
On 04.07.2018 16:04, jena melina wrote:
> hello ,
>
> I'm using fuseki server (in-memory ) to manipulate RDF data
> And i don't use any TDB backend. My question is how to save modification
> that i do using sparql update ?
>
> 1/ if I need to write the data back to disk , how can 'i do it ?
> 2/ if i need to connect my Fuseki to a TDB how can 'i do it ?
>
> To upload tata into fuseki server i use :
>
> public static void uploadRDF(String rdf, String serviceURI) {
>
> Model m = ModelFactory.createDefaultModel();
> m.read(Insert.class.getResource("/" + rdf).getFile(), "RDF/XML");
> // upload the resulting model
> DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
> accessor.putModel(m);
>
>
> }
>
> and to query my Data i use :
>
> public static ResultSet execSelectAndPrintquery(String serviceURI,
> String query) {
> QueryExecution q = QueryExecutionFactory.sparqlService(serviceURI,
> Constants.SPARQL_PREFIX+query);
>
> ResultSet results = q.execSelect();
> ResultSetFormatter.out(System.out, results);
> return results;
> }
>
> and to update data i use :
>
> public static void performUpdate ( String updateCommand,String datasetUrl) {
> String id = UUID.randomUUID().toString();
> System.out.println(String.format("Adding %s", id));
> UpdateProcessor upp =
> UpdateExecutionFactory.createRemote(UpdateFactory.create(String.format(EngineConstants.SPARQL_PREFIX+updateCommand
> , id)),datasetUrl );
> upp.execute();
> }
>
>
> And i need to save all modifications , so ho can i do it ?
>
> thanks for your help ..
>
Re: How we store date after shutdowning fuseki server
Posted by Andy Seaborne <an...@apache.org>.
On 04/07/18 17:23, Jean-Marc Vanel wrote:
> I would use a TDB baked Fuseki.
> The code to do this is not more complex than what you use.
>
> First, the data can resist to a power shudown.
> Second, it is easy to obtain a dump, by the utility program
> tdb.tdbdump
> or by an HTTP service that triggers the dump without having to stop the
> server.
>
>
> 2018-07-04 16:04 GMT+02:00 jena melina <je...@gmail.com>:
>
>> hello ,
>>
>> I'm using fuseki server (in-memory ) to manipulate RDF data
>> And i don't use any TDB backend. My question is how to save modification
>> that i do using sparql update ?
>>
>> 1/ if I need to write the data back to disk , how can 'i do it ?
>> 2/ if i need to connect my Fuseki to a TDB how can 'i do it ?
Start the server with "--loc-DATA" for a datbase in directory DATA which
is create if needed.
Or use the UI.
>>
>> To upload tata into fuseki server i use :
>>
>> public static void uploadRDF(String rdf, String serviceURI) {
>>
>> Model m = ModelFactory.createDefaultModel();
>> m.read(Insert.class.getResource("/" + rdf).getFile(), "RDF/XML");
>> // upload the resulting model
>> DatasetAccessor accessor = DatasetAccessorFactory.
>> createHTTP(serviceURI);
>> accessor.putModel(m);
>>
>>
>> }
>>
>> and to query my Data i use :
>>
>> public static ResultSet execSelectAndPrintquery(String serviceURI,
>> String query) {
>> QueryExecution q = QueryExecutionFactory.sparqlService(serviceURI,
>> Constants.SPARQL_PREFIX+query);
>>
>> ResultSet results = q.execSelect();
>> ResultSetFormatter.out(System.out, results);
>> return results;
>> }
>>
>> and to update data i use :
>>
>> public static void performUpdate ( String updateCommand,String
>> datasetUrl) {
>> String id = UUID.randomUUID().toString();
>> System.out.println(String.format("Adding %s", id));
>> UpdateProcessor upp =
>> UpdateExecutionFactory.createRemote(UpdateFactory.create(String.format(
>> EngineConstants.SPARQL_PREFIX+updateCommand
>> , id)),datasetUrl );
>> upp.execute();
>> }
>>
>>
>> And i need to save all modifications , so ho can i do it ?
>>
>> thanks for your help ..
>>
>
>
>
Re: How we store date after shutdowning fuseki server
Posted by Jean-Marc Vanel <je...@gmail.com>.
I would use a TDB baked Fuseki.
The code to do this is not more complex than what you use.
First, the data can resist to a power shudown.
Second, it is easy to obtain a dump, by the utility program
tdb.tdbdump
or by an HTTP service that triggers the dump without having to stop the
server.
2018-07-04 16:04 GMT+02:00 jena melina <je...@gmail.com>:
> hello ,
>
> I'm using fuseki server (in-memory ) to manipulate RDF data
> And i don't use any TDB backend. My question is how to save modification
> that i do using sparql update ?
>
> 1/ if I need to write the data back to disk , how can 'i do it ?
> 2/ if i need to connect my Fuseki to a TDB how can 'i do it ?
>
> To upload tata into fuseki server i use :
>
> public static void uploadRDF(String rdf, String serviceURI) {
>
> Model m = ModelFactory.createDefaultModel();
> m.read(Insert.class.getResource("/" + rdf).getFile(), "RDF/XML");
> // upload the resulting model
> DatasetAccessor accessor = DatasetAccessorFactory.
> createHTTP(serviceURI);
> accessor.putModel(m);
>
>
> }
>
> and to query my Data i use :
>
> public static ResultSet execSelectAndPrintquery(String serviceURI,
> String query) {
> QueryExecution q = QueryExecutionFactory.sparqlService(serviceURI,
> Constants.SPARQL_PREFIX+query);
>
> ResultSet results = q.execSelect();
> ResultSetFormatter.out(System.out, results);
> return results;
> }
>
> and to update data i use :
>
> public static void performUpdate ( String updateCommand,String
> datasetUrl) {
> String id = UUID.randomUUID().toString();
> System.out.println(String.format("Adding %s", id));
> UpdateProcessor upp =
> UpdateExecutionFactory.createRemote(UpdateFactory.create(String.format(
> EngineConstants.SPARQL_PREFIX+updateCommand
> , id)),datasetUrl );
> upp.execute();
> }
>
>
> And i need to save all modifications , so ho can i do it ?
>
> thanks for your help ..
>
--
Jean-Marc Vanel
http://www.semantic-forms.cc:9111/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me#subject
<http://www.semantic-forms.cc:9111/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me>
Rule-based programming, Semantic Web
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui