Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update RDF in Triplestore

I'm experimenting with Sesame and Virtuoso Triplestores. At the Moment I use the Sesame Java API to add RDF Data to both Triplestores.

My RDF Data represents different things like Videodata, Userdata etc. At the moment I can add a RDF of a Video (title, description, location etc.) to the Triplestore

But How can I update a RDF in the store ?

For Example if I use the REST Interface of sesame and make a PUT Request with the updated RDF, everything in the store is removed first.

When I use POST with the updated Data (for example the title of the video has changed), both title (old and new) are stored.

How do you work with triplestores? Maybe I miss here something essential.


EDIT:

I use now Context in Sesame and Graphs in Virtuoso for every RDF entry. This way for update I can clear the context first and add it again. As I use the Sesame API for both Triplestores (we still don't know which one we are going to use), the code looks exactly the same.

ValueFactory f = rep.getValueFactory();
URI uri = f.createURI(urn);
con.clear(uri);
con.add(reader,this.baseURI, RDFFormat.RDFXML,uri);

thanks for the help

like image 711
mjspier Avatar asked Jun 20 '11 11:06

mjspier


People also ask

Is RDF a graph database?

The RDF triplestore is a type of graph database that stores semantic facts. RDF, which stands for Resource Description Framework, is a model for data publishing and interchange on the Web standardized by W3C. Being a graph database, triplestores store data as a network of objects with materialized links between them.

Does Neo4j use RDF?

It is widely known that Neo4j is able to load and write RDF.

Which graph update operations can be performed with Sparql?

SPARQL 1.1 Update supports two categories of update operations on a Graph Store: Graph Update - addition and removal of triples from some graphs within the Graph Store.

How does RDF store its data?

RDFStore implements a generic hashed data storage that allows to serialise RDF models, resources, properties and property values either to disk or in-memory data structures. It does support several different persistent storage models such as SDBM, BerkeleyDB (standard and Sleepycat) and DBMS.


1 Answers

I assume you're working with SPARQL. If you don't, then you probably should :-)

Many triple stores support SPARQL Update, a language for modifying RDF triples in a SPARQL store. It's like SQL's INSERT, UPDATE, DELETE and so on. I'm not sure whether Sesame supports it yet—SPARQL Update is still a very new spec that isn't even quite finalised yet.

Another useful thing to be aware of, especially if you want to work in a RESTful way, is Named Graphs. This allows managing triples in different graphs, so you can keep data separate. You could, for example, keep the triples about each video in a separate Named Graph, and then update only that Named Graph on a PUT request. You can still use SPARQL to query the entire store across all Named Graphs. Again I'm not entirely sure if Sesame's REST API provides access to Named Graphs. (I'm pretty sure that the Java API does; I think they call it something different though. Contexts?)

like image 198
cygri Avatar answered Nov 16 '22 04:11

cygri