Prerequisites
The following prerequisites should be met before this JRDF tutorial can be run:
- JavaTM software, version 1.4 or higher. You can check the version you have installed by typing at a command line:
java -version
Something similar to the following should display:
java version "1.4.2_04" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
If the above does not display, add <JAVA_HOME>/bin , where <JAVA_HOME> is the location where J2SETM is installed, to your PATH (in the appropriate way for your shell).
For more information on installing and running Java software, read the J2SE 1.4 Installation guide.
- A valid installation of KowariTM. For information on installing Kowari, see the relevant sections in the Kowari documentation.
- Basic Java programming experience.
Obtaining a Session from a Kowari Server
The KowariTM 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 Kowari 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 Kowari 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 Kowari 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
|
|
|
|
Latest News
Kowari 1.1.0 Pre-release 1 Released
Kowari 1.0.5 Released
Kowari 1.0.4.1 Released
Kowari 1.0.4 Released
DAWG Evaluates iTQL
Kowari article in XML.com
Kowari mentioned on XML.com
Kowari 1.0.3 Released
Kowari Lite Introduced
Kowari 1.0.2 Released
Kowari 1.0.1 Released
View all news items
|