RDF data management and processing

This session will be about managing RDF data. We will set up an RDF data base (also called a triplestore). We will convert existing, non-RDF data, into RDF, programmatically, then load it to the triplestore.

Setting up a triplestore

There are many triplestores. The simplest to set up is probably Fuseki.

Generate RDF with Apache Jena

These instructions assume that you are programming in Java, preferably with Eclipse, using the Apache Jena libraries. You may also use RDFlib in Python, or Redland RDF libary in C, or dotNetRDF in C♯, or EasyRDF for PHP, or N3.js for JavaScript, or Ruby RDF for Ruby, or SWI-Prolog Semantic Web Library, etc.

These operations should get you started with Apacha Jena and Eclipse. If you are using a different library, look at the documetation.

Now you will generate RDF data from non-RDF sources. Use the Jena tutorial to familiarise yourself with the API and learn how to generate an RDF graph programmatically.

You can generate all the data at once in a large Jena Model and serialise it as RDF, or you can fill in a triplestore little by little. If you want to add data to a triplestore such as Jena Fuseki, you can send update queries like this:

Model model = ModelFactory.createDefaultModel();
// ... build the model
String datasetURL = "http://localhost:3030/dataset";
String sparqlEndpoint = datasetURL + "/sparql";
String sparqlUpdate = datasetURL + "/update";
String graphStore = datasetURL + "/data";
RDFConnection conneg = RDFConnectionFactory.connect(sparqlEndpoint,sparqlUpdate,graphStore);
conneg.load(model); // add the content of model to the triplestore
conneg.update("INSERT DATA { <test> a <TestClass> }"); // add the triple to the triplestore

If you finish fast, you can then try to define a vocabulary for GTFS and transform all the SNCF data to RDF.