Overview

Introduction

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 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 (TBD) or Sesame . 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.

Architecture

SCB comprises the following architectural components as depicted in Fig. 1:

  • Core
  • Facades
  • Utilities
  • Storage Providers
  • Parsing Providers
  • Serializing Providers
  • Ontologies Tool

SCB Architecture
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 TripleCollections, 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.

Artifacts

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.apache.clerezza.rdf.core Jar and OSGi bundle
org.apache.clerezza.rdf.core.test Jar and OSGi bundle
Façades org.apache.clerezza.rdf.jena.facade Jar and OSGi bundle
Utilities org.apache.clerezza.rdf.utils Jar and OSGi bundle
Storage Providers org.apache.clerezza.rdf.sesame.storage Jar and OSGi bundle
org.apache.clerezza.rdf.jena.storage Jar and OSGi bundle
Parsing Providers org.apache.clerezza.rdf.jena.parser Jar and OSGi bundle
Serializing Providers org.apache.clerezza.rdf.jena.serializer Jar and OSGi bundle
Ontologies Tool org.apache.clerezza.rdf.tool.schemagen Executable jar

Building SCB

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.

Developing Applications using SCB

To develop an application on top of SCB, you need to have the Core and optionally Utilities and Façades.

Deploying an Application Requiring SCB

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].

Extending and Customizing SCB