Jena for building Semantic Web Applications
Jena, a Java RDF API and toolkit is an open source Java framework for building Semantic Web applications. Semantic Web Framework, developed by W3C is elaborated in https://itknowledgeexchange.techtarget.com/enterprise-IT-tech-trends/w3c-semantic-web-framework/.
In Jena, the subject of a statement is always a Resource, the predicate is represented by a Property, and the object is either another Resource or a literal value. The different relationship types can be described using the properties siblingOf, spouseOf, parentOf, and childOf, taken from the “Relationship” vocabulary.
The list() methods on the Model and Resource interfaces can be used to obtain subjects, objects and statements matching certain conditions. They also return specializations of java.util.Iterator, which have extra methods to return specific object types. The most generic query method is Model.listStatements(Resource s, Property p, RDFNode o). Any of these parameters can be left null, in which case they act as wildcards, matching anything. RDF also has features that facilitate data merging even if the underlying schemas differ, and supports the evolution of schemas over time without requiring all the data consumers to be changed (NoSQL – especially the graph databases – thrives on this concept).
In Jena, ontology is treated as a special type of RDF model, OntModel which allows the ontology to be manipulated programmatically, with convenience methods to create classes, property restrictions, and so forth. An alternative approach is to treat the ontology as a regular RDF model, and simply add statements defining its semantic rules.
ARQ is a query engine for Jena that supports the SPARQL (pronounced “Sparkle”) RDF Query Language. Jena also offers an RDF Triple Store facility with SPARQL interface to be used on top of other database systems. The Jena GRDDL (pronounced “griddle”) Reader is an implementation of GRDDL.
Jena provides two subsystems for persisting RDF and OWL:
1. TDB provides a lightweight, scalable non-transactional storage and SPARQL query layer.
2. SDB is a SPARQL database subsystem for Jena that provides for large scale storage and query of RDF datasets using conventional SQL databases.
Applications need to be aware of the concurrency issues in accessing Jena models. API operations are not thread safe by default. A multithreaded application needs to be aware of these issues and correctly use the mechanisms that Jena provides (or manage its own concurrency itself).
Jena provides multiple-reader/single-writer concurrency support (MRSW). Applications are expected to obey the lock contract, that is, they must not do update operations if they have a read lock as there can be other application threads reading the model concurrently.
In effect, Jena provides a programmatic environment for RDF, RDFS and OWL, SPARQL, GRDDL and includes a rule-based inference engine enabling Semantic Web. With this, organizations can provide a single, unified view of data across applications, which allows for precise retrieval of information, simplifies enterprise and SOA integration, reduces data redundancy, and provides uniform semantic meaning across applications.