8.3 Programming with Jena


Programming with Jena includes the following concepts.
Establishing the Jena Development Environment
The Jena download (found at http://jena.sourceforge.net/downloads .html) contains a wealth of valuable information beyond the necessary Jena .jar files. It contains dozens of examples, major ontologies, an FAQ section, and extensive documentation including the Jena Javadocs.
Establishing the Knowledgebase: Setting Up the Model
The first step in processing Semantic Web data is to find a place to refer to it. Without a location, actions such as a query cannot occur. This requires the naming and allocation of reference resources. For Jena, it all begins with the creation of a Model object.
Populating the Model with Semantic Web Data
Now that you have a reference to storage for your Semantic Web data, you need to populate it. There are several ways to populate the model. You can populate the model from a file, from a URL, and from adding statements directly.
Combining Semantic Web Data
You can also populate a model from other existing models. You can simply add all statements from one to the other or selectively add statements.

8.3 Programming with Jena


Interrogating Semantic Web Data
Now that we have a Jena model populated with Semantic Web data, we can interrogate the data. Jena allows three basic approaches: search, navigate, and query. Search finds identical matches within the data—a simple query really that merely matches a string without any semantics.
Reasoning across Semantic Web Data
Another important aspect beyond interrogating the Semantic Web data is reasoning across the data, realizing the full power of semantics. For that we need to integrate reasoners beyond what is already present in the model. The Jena framework offers several ways to integrate reasoners. The operation is similar to creating a more advanced model from a simpler one, such as going from an RDF file-backed model to an ontology model. We incorporate two major types of reasoners: inference reasoners and rule reasoners (although they are treated similarly within Jena).
Exporting Semantic Web Data
Now that we have useful Semantic Web data, we need to export it for others to use or maintain it for our future use.
De-allocating Semantic Web Data Resources
The last major step releases the references to the various resources used to manipulate your Semantic Web data. This requires only two methods: one to clear out the storage, which is optional, and one to close it down to release all resources and perform final actions.

8.3 Programming with Jena


Managing Semantic Web Data
We have demonstrated a complete life cycle of using the Jena Semantic Web Framework classes and methods in dealing with Semantic Web data. However, there are other areas to consider when managing and programming Semantic Web data. These include getting information regarding your Semantic Web data, event notification of changes in your Semantic Web data, dealing with concurrent operations on your Semantic Web data, and customizing the Jena Framework.