mulgara - semantic store

skip navigation

SHOW SITE NAV
fixed
fluid
straight

Prerequisites

The following prerequisites should be met before this JRDF tutorial can be run:

 

Obtaining a Session from a Mulgara Server

The Mulgara server can be accessed using the the JRDF API using either a local connection (in the same Java Virtual Machine (JVM)) or via a client/server interface.

The local connection provides the ability to create a new server or start an existing one and access it through the JRDF API. The client/server interface connects to an existing server using RMI, if it exists, or failing this, falls back to creating a new local server. Falling back to local server does not start the RMI registry and other external clients cannot access it unless started manually.

The Mulgara server has a local implementation of the JRDF API that can be created using a LocalJRDFSession and a remote implementation that uses a JRDFSession. In order to use these APIs, you must first have the corresponding Session. These Sessions are obtained via a SessionFactory. To construct a new SessionFactory, the URI of the server is required as well as an optional boolean parameter indicating whether the server is remote or not. If this boolean parameter is not provided, the server is assumed to be local (in the same JVM). For example:

// Create the host name
String hostname = InetAddress.getLocalHost().getCanonicalHostName();

// Create the URI of the server
serverURI = new URI("rmi", hostname, "/" + SERVER_NAME, null);

// Create a new session factory, ensure that it's local
SessionFactory sessionFactory = SessionFactoryFinder.newSessionFactory(serverURI, false);

// Get a local JRDF Session (local)
LocalJRDFSession session = (LocalJRDFSession) sessionFactory.newJRDFSession();

If a local server is created, the server configuration file is used to determine which directory to place the server's files in.

If a remote SessionFactory is used, then the session can only be cast to a JRDFSession. For example:

// Create a new remote session factory
SessionFactory sessionFactory = SessionFactoryFinder.newSessionFactory(serverURI, true);

// Get a Remote JRDF Session (client/server)
JRDFSession session = (JRDFSession) sessionFactory.newJRDFSession();

 

Comparison of JRDF Graph Implementations

The following table outlines the advantages and disadvantages of the different JRDF graph implementations.

Memory Graph

Advantages

Disadvantages

Very fast

Not persisted to disk

Small footprint

Not scalable

 

 

Server Graph

Advantages

Disadvantages

No network overhead

Slower than memory graph, but faster than client graph

Persistent datastore

Must be run in the same JVM as the Mulgara server

Scalable

 

 

 

Client Graph

Advantages

Disadvantages

Client/server architecture means client can be on different machine to server

Slower than memory graph

Persistent datastore

 

Full Mulgara server advantages

 

Scalable

 

 

 

iTQL Graph

Advantages

Disadvantages

Client/server architecture means client can be on different machine to server

Slower than memory graph and client graph

Creates a graph from the results of an iTQL query

Read-only (cannot add or remove statements)

Persistent datastore

 

Scalable

 

Valid XHTML 1.0 TransitionalValid CSS 3.0!