RDF with Jena and Fuseki (Part 2 of 3): Validate and Store RDF data in Jena and Fuseki

See Part 1: Installing Fuseki (with TDB) server and Jena command-line tools on OS X.

Keep these in mind

Reading and writing RDF in Jena

Get Started

I hear the WWW may have some data about published research:

$ cd jena-fuseki-1.0.0
$ curl -o ./Data/bibapp_works.rdf 'http://experts.kumc.edu/search?utf8=%E2%9C%93&q=mass+spectrometry&commit=Search&format=rdf'

It’s supposed to be RDF/XML. Let’s validate that using Jena’s CLI. Fuseki’s web UI has a validator, but it doesn’t support RDF/XML:

$ rdfxml --validate ./Data/bibapp_works.rdf

We’re getting to the fun part. Let’s push some RDF into a Fuseki dataset.

Normally, we should be able to use the SPARQL HTTP support with s-put. With our TDB datastore:

$ ./s-put -v http://localhost:3030/ds/data default ./Data/bibapp_works.rdf

With the in-memory datastore, I kept getting NoMethod on ‘nil’ from Ruby. I suspect it has to do with a content-type or encoding declaration. If you run into the same problem, try using PUT with curl instead of s-put like this:

$curl -X PUT -H "Content-Type: application/rdf+xml" -d ./Data/bibapp_works.rdf http://localhost:3030/ds/data?default

Did it work? Retrieve the entire dataset serialized to RDF and paired with the graph IRI.

$ ./s-get http://localhost:3030/ds/data default

See Part 3: Query RDF data in Jena and Fuseki

RDF with Jena and Fuseki (Part 2 of 3): Validate and Store RDF data in Jena and Fuseki

2 thoughts on “RDF with Jena and Fuseki (Part 2 of 3): Validate and Store RDF data in Jena and Fuseki

Leave a comment