Author: Hasan - clerezza.org
Date: November 10, 2008
Contributor: Reto Bachmann-Gmür - clerezza.org
Smart Content Binding (SCB) is an open source framework developed by clerezza.org aiming primarily at providing a java implementation of the graph data model specified by W3C RDF [1] and functionalities to operate on that data model. SCB offers a service interface to access multiple named graphs and it can use various providers to manage RDF graphs in a technology specific manner, e.g., using Jena [2] (TBD) or Sesame [3]. It also provides façades that allow an application to use Jena or Sesame (TBD) APIs to process RDF graphs (note that the choice of a façade is independent of the chosen backend; you can for example use the Jena façade to write your code against the Jena API while using the Sesame provider to store your data in a Sesame store). Furthermore, SCB offers a serialization and a parsing service to convert a graph into a certain representation (format) and vice versa. In order to support ontologies usage, SCB provides a tool to convert ontologies defined in various formats including RDF/XML into Java classes.
SCB comprises the following architectural components as depicted in Fig. 1:
Figure 1: SCB Architecture
The Core contains interface definitions of the RDF graph data model and its
implementation. The three main classes are Graph
, MGraph
,
and TripleCollection
. The class Graph
represents an
immutable RDF Graph, as such its identity criterion is defined in terms of
graph-isomorphism. The class MGraph
represents a mutable RDF Graph,
which enables triples to be added to or removed from a graph. The class
TripleCollection
is the super class of both the class Graph
and MGraph
.
SCB Core provides three services: TcManager
[4] allows access to
the various TripleCollection
s, Parser
[5] and
Serializer
[6] to allow reading and writing graphs from and to
various formats. In an OSGi environment these services are accessed using the
service registry or injected using OSGi Declarative Services. In a non OSGi environment
static factory methods are used to return an instance.
The TcManager
delegates actual processing tasks to a specific Storage Provider
chosen from a set of Storage Providers based on their priority number (weight).
Storage Providers can be dynamically bound to or unbound from the Core.
The functionality required by the Parser and Serializer is delegated to registered
Parsing and Serializing Providers respectively, according to their capability
(supported formats). Later registered providers shadow previous ones for the same format.
The current implementation of SCB includes a Jena Façade. The Jena Façade allows an application to use Jena API to manipulate a TC.
In order to ease operations on a resource in a TC, the Utilities component provides a class with a set of useful methods, e.g., to delete all triples (statements) with the resource as subject and a specified predicate.
Finally, the Ontologies Tool contains a standalone application called SchemaGen to generate the Java source code with constants from an ontology description.
Each architectural component described above comprises one or more artifacts as
listed in Table 1.
Table 1: Artifacts of each architectural components
Architectural Component | Artifact | Artifact Type |
---|---|---|
Core | org.clerezza.rdf.core | Jar and OSGi bundle |
org.clerezza.rdf.core.test | Jar and OSGi bundle | |
Façades | org.clerezza.rdf.jena.facade | Jar and OSGi bundle |
Utilities | org.clerezza.rdf.utils | Jar and OSGi bundle |
Storage Providers | org.clerezza.rdf.sesame.storage | Jar and OSGi bundle |
org.clerezza.rdf.jena.storage | Jar and OSGi bundle | |
Parsing Providers | org.clerezza.rdf.jena.parser | Jar and OSGi bundle |
Serializing Providers | org.clerezza.rdf.jena.serializer | Jar and OSGi bundle |
Ontologies Tool | org.clerezza.rdf.tool.schemagen | Executable jar |
If you want to build SCB from its sources, you need JDK version 1.6 to compile. Maven version 2.0.9 has been used to build SCB.
To develop an application on top of SCB, you need to have the Core and optionally Utilities and Façades.
To deploy an application which uses SCB, Java(TM) SE Runtime Environment 6 or higher is needed. If the application does not use OSGi, then the SCB Core, the jars required for compilation, as well as the needed implementations (typically one provider for storage, serialization, and parsing) must be in the classpath. If the application uses OSGi, these jars are loaded as bundles, and to run in OSGi, Declarative Services must be enabled (see the documentation of your OSGi container).
The use of SCB in an OSGi environment has been tested with Apache Felix [7] and Eclipse Equinox [8].
Since SCB applies a Service Oriented Architecture approach, following components can be easily extended: Storage Providers, Parsing Providers, and Serializing Providers. Using OSGi, new bundles just need to implement the required service interfaces. To be located outside an OSGi environment, they should also provide files in "META-INF/services" for the services they expose. Consult the SCB JavaDoc for more information [9].
[1] W3C: Resource Description Framework (RDF): Concepts and Abstract Syntax; 2004, http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/
[2] http://jena.sourceforge.net/
[7] http://felix.apache.org/site/index.html
[8] http://www.eclipse.org/equinox/
[9] http://clerezza.org/projects/org.clerezza.rdf.core/apidocs/index.html