The RDF Jena Library is a library for parsing, serializing and processing RDF models. It is based on the Apache Jena library.
This library provides a toolset for working with RDF models. It consists of utility services for parsing and serializing the RDF serializations including XML/RDF, JSONLD, N3, Turtle and N-Triple syntax. Once parsed the RDF models are represented as Jena Models wrapped by with an ROC-safe immutable NetKernel representation IRepJenaModel. A range of tools are provide for manipulating models - these are divided into Set operations and Query/update operations.
There are at least four serialized forms of RDF, this library provides parsers for XML/RDF, N3, Turtle and N-Triple syntaxes.
If the RDF representation is already known then each parser can be used explicitly...
Each parser produces an in-memory Jena Model contained in a IRepJenaModel.
The library provides serializers which can serialize a resource with aIRepJenaModel to XML/RDF, N3, TURTLE and N-Triple syntaxes.
Internally the active:jRDFXXXX accessors use IRepJenaModel as the representation.
By default the RDF binary stream parser (transreptor) will attempt to do type inferencing on an RDF resource to determine the serialisation format.
The inference first attempts to identify the type from the MimeType/ContentType of the resource. If this is not known then file extension matching will be attempted. If both of these cannot resolve the type then it will be assumed to be XML/RDF.
If an IRepJenaModel is to be serialized then the library will default to an XML/RDF serialization. Defaults can be avoided by using the appropriate parse/serialize accessors discussed above.
The library provides a set of accessors for performing set operations on Jena models. The results of a set operation is another Jena Model resource.
Set comparisons are provided by the following accessors which each return a boolean aspect.
We have created a simple accessor jRDFUpdateModel which enables declarative updates, both additions and deletions, to be applied to a model. Updates can add new triples or simply add new properties to an existing resource as well as removing from the model.
An alternative approach to using this accessor is to perform separate additions or deletions using the union and difference set operations. In this case simply create a new model containing the changes and perform the Union or Difference operation to modify the model.
Queries can be performed on a model using the SPARQL query language.
As an alternative a simple query accessor is provided which takes a declarative XML query syntax to perform queries to the model. See the jRDFSelectFromModel accessor.
Our thanks go to the Los Alamos National Laboratories Digital Library team for inspiration and feedback whilst developing this library. Thanks also to our former colleagues in the HP Semantic Web team for their work in producing the Jena library.