How we store date after shutdowning fuseki server

2018-07-04 Thread jena melina
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: Fuseki / Java

2018-06-22 Thread jena melina
thanks for your answer ,
but i don't understand what you want to explain ... could you please
explain to me what I should I do ?

2018-06-22 7:37 GMT+02:00 Lorenz Buehmann <
buehm...@informatik.uni-leipzig.de>:

> To extend my answer, for SPARQL I'd prefer the RDFConnection way [1]
>
>
> [1] https://jena.apache.org/documentation/rdfconnection/
>
>
> On 22.06.2018 07:35, Lorenz Buehmann wrote:
> > Fuseki is an HTTP SPARQL server - but what is the backend? If it's TDB,
> > you can use the code from the TDB examples with the corresponding TDB
> > location.
> >
> > If enabled, you could also use SPARQL Update protocol, i.e. write
> > queries instead of Java code.
> >
> > The documentation:
> > https://jena.apache.org/documentation/serving_data/#use-from-java
> >
> >
> > On 21.06.2018 22:53, jena melina wrote:
> >> hello ,
> >>
> >> I'm have  a java program that manipulate my  ontology ( create activity
> ,
> >> tag , user ...)
> >>
> >>
> >>
> >>
> >> public TEST() {
> >> onto = ModelFactory.*createOntologyModel*(OntModelSpec.*OWL_MEM*);
> >> OntDocumentManager manager = onto.getDocumentManager();
> >>
> >>
> >> manager.addAltEntry("https://www.w3.org/ns/test;,
> "ontologies/test.owl")
> >> ;
> >> manager.addAltEntry("https://www.w3.org/ns/test2;,
> >> "ontologies/test2.owl");
> >>
> >> this.synchronize();
> >>
> >>
> >> }
> >>
> >>
> >>
> >> For example to create Activity I use this method :
> >>
> >> public Resource createEntity(String uri) throws
> >> AlreadyExistingRdfResourceException {
> >>
> >> Resource res = onto.getIndividual(uri);
> >> if (res != null) throw new AlreadyExistingRdfResourceExce
> ption(uri);
> >> res = onto.createResource(uri);
> >> return res;
> >> }
> >>
> >>
> >>
> >> Now I need to use Fuseki server to save all modification that I do ,
> but I
> >> don’t want to do many modification on my code , so I don’t know if I can
> >> found help here ..
> >>
> >> I know how to connect to Fuseki server , but I don’t found how I can
> save
> >> the owl into fuseki server , and how I can request   or modify my
> ontology
> >> using (my code + Fuseki server ).
> >>
> >>
> >> thanks for your help
> >>
>
>


Fuseki / Java

2018-06-21 Thread jena melina
hello ,

I'm have  a java program that manipulate my  ontology ( create activity ,
tag , user ...)




public TEST() {
onto = ModelFactory.*createOntologyModel*(OntModelSpec.*OWL_MEM*);
OntDocumentManager manager = onto.getDocumentManager();


manager.addAltEntry("https://www.w3.org/ns/test;, "ontologies/test.owl")
;
manager.addAltEntry("https://www.w3.org/ns/test2;,
"ontologies/test2.owl");

this.synchronize();


}



For example to create Activity I use this method :

public Resource createEntity(String uri) throws
AlreadyExistingRdfResourceException {

Resource res = onto.getIndividual(uri);
if (res != null) throw new AlreadyExistingRdfResourceException(uri);
res = onto.createResource(uri);
return res;
}



Now I need to use Fuseki server to save all modification that I do , but I
don’t want to do many modification on my code , so I don’t know if I can
found help here ..

I know how to connect to Fuseki server , but I don’t found how I can save
the owl into fuseki server , and how I can request   or modify my ontology
using (my code + Fuseki server ).


thanks for your help