JRDF Tutorial
JRDF is a set of APIs that provide a concise implementation of the Resource Description Framework (RDF) using standard Java conventions. JRDF offers a highly modular and type safe interface allowing users to create, store and query RDF statements. It includes a default memory implementation that can be used in conjunction with MulgaraTM to provide a scalable RDF solution.
The example code provided in this tutorial is from the org.jrdf.mem.JRDFExample
class. The JRDFExample
class uses an in-memory JRDF graph implementation and can be run by typing at a command line:
java -cp <TKS installation directory>/driver-2.1.jar org.jrdf.mem.JRDFExample
The code for JRDFExample
is in the Resources
directory of your TKS installation. The JRDF API documentation is in <TKS install>/docs/api/jrdf
.
There are four JRDF graph implementations to choose from:
- JRDF graph (memory graph)
The JRDF jar provides a memory implementation under 60Kb and is available for download from
http://sourceforge.net/projects/jrdf/
. The memory graph is easy to create and is useful for small graphs and caching of results from larger graphs (subgraphs). The classes are in theorg.jrdf.graph.mem
package of the JRDF jar. - Server-side JRDF Graph (server graph)
Mulgara provides a server-side JRDF Graph interface for accessing a model. The graph must be created in the same JVM that the Mulgara server is running in.
Server graphs can be used for direct access to the database using a graph API. This is useful for applications that use Mulgara as an embedded component. The server graph classes are in the
org.mulgara.jrdf
package of the server jar. - Server backed JRDF graph (client graph)
Mulgara also provides a client-side JRDF graph interface for accessing a model. This provides a scalable RDF solution for remote client applications.
Client graphs can be used in conjunction with memory graphs. Memory implemented nodes and triples can be inserted into, removed from and used to query client graphs. Other JRDF implementations can also be used, but may not be supported. The client graph classes are in the
org.mulgara.client.jrdf
package of the Driver jar. - Read-only iTQL result JRDF graph (iTQL graph)
Mulgara also allows you to create read-only JRDF graphs from the results of an iTQL query. This provides a powerful mechanism for displaying search results as a subgraph. The classes are in the
org.mulgara.client.jrdf
package of the Driver jar.
Each of these JRDF graph implementations are outlined in the following sections.