1

How can Jena be used to save triples in a SPARQL endpoint?

I could use SPARQL RestFul API but I wonder if this is also doable using Jena classes.

bsz
  • 321
  • 1
  • 9

2 Answers2

4

For SPARQL Update you can do the following:

UpdateRequest update = UpdateFactory.create("# Your SPARQL Updates");
UpdateProcessor processor = UpdateExecutionFactory.createRemote(update, "http://your-domain/update");
processor.execute();

If you are talking about the graph store protocol i.e. uploading entire graphs at once then you can use the DatasetAccessor API e.g.

DatasetAccessor accessor = DatasetAccessorFactory.createHTTP("http://your-domain/ds");
accessor.putModel(m);
RobV
  • 28,022
  • 11
  • 77
  • 119
  • This way I need to write the SPARQL. I need something that automatically build and execute the needed SPARQL for the triples I want to insert. – bsz Oct 03 '15 at 07:28
  • 1
    @bsz That's a fairly major constraint and you should state such constraints in your question – RobV Oct 05 '15 at 08:19
2

If you are talking about MarkLogic specifically (you tagged the question with marklogic), then this github project will likely interest you:

https://github.com/marklogic/marklogic-jena

This library integrates MarkLogic Semantics feature into the Jena RDF Framework as a persistence and query layer.

Note: not officially released yet currently, but close. Might be worth a look..

HTH!

grtjn
  • 20,254
  • 1
  • 24
  • 35