org.openrdf.jena
Class GraphSesame

java.lang.Object
  extended by com.hp.hpl.jena.graph.impl.GraphBase
      extended by org.openrdf.jena.GraphSesame
All Implemented Interfaces:
Graph, GraphAdd, com.hp.hpl.jena.graph.impl.GraphWithPerform
Direct Known Subclasses:
DataSourceSesame, NamedGraphSesame

public class GraphSesame
extends com.hp.hpl.jena.graph.impl.GraphBase

This class wraps a Sesame repository and presents it as a Jena Graph NOTE: This class does NOT support remove'ing triples from the iterators returned by find! This means essentially everything, removing can only be done by performRemove call!

Author:
wf, grimnes TODO: Think about and check if re-ification works.

Field Summary
protected  Logger logger
           
protected  Repository repository
           
private static ValueFactory sesameFactory
           
 
Fields inherited from class com.hp.hpl.jena.graph.impl.GraphBase
bulkHandler, capabilities, closed, gem, pm, queryHandler, reifier, style
 
Fields inherited from interface com.hp.hpl.jena.graph.Graph
emptyGraph
 
Constructor Summary
GraphSesame()
          Create a Jena Graph, which represents a Sesame in-memory local repository that does not have persistent support, synchroinzation support and inference capability.
GraphSesame(boolean inferencing, boolean sync, String fileName, String format)
          Create a Jena Graph, which represents a Sesame in-memory local repository that has the following customizable features.
GraphSesame(boolean sync, String dir)
          Create a Jena Graph, which represents a Sesame native local repository.
GraphSesame(boolean sync, String driver, String url, String user, String password)
          Create a Jena Graph, which represents a Sesame rdbms local repository.
GraphSesame(Repository repository)
          Create a Jena graph from an existing repository
 
Method Summary
private  Repository _createRepository(RepositoryConfig rc)
          Copied from sesame org.openrdf.sesame.server.Server
private  void addSyncLayer(RepositoryConfig repConfig)
           
 void close()
           
private  void createOnConfig(RepositoryConfig repConfig)
           
 BulkUpdateHandler getBulkUpdateHandler()
           
 Repository getRepository()
           
static ValueFactory getValueFactory()
          Get a Sesame ValueFactory used to create Sesame URI, blank node, literal, etc.
protected  ExtendedIterator graphBaseFind(TripleMatch tm)
           
protected  int graphBaseSize()
          We override this, maybe Sesame's version is more efficient.
 Statement jena2sesame(Triple t)
           
 void performAdd(Triple t)
           
 void performDelete(Triple t)
           
private  void setCapabilities()
           
 
Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase
add, checkOpen, contains, contains, containsByFind, delete, dependsOn, find, find, forTestingOnly_graphBaseFind, getCapabilities, getEventManager, getPrefixMapping, getReifier, getTransactionHandler, graphBaseContains, graphBaseFind, isEmpty, isIsomorphicWith, notifyAdd, notifyDelete, queryHandler, reifierContains, reifierSize, reifierTriples, size, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

repository

protected Repository repository

logger

protected Logger logger

sesameFactory

private static ValueFactory sesameFactory
Constructor Detail

GraphSesame

public GraphSesame(Repository repository)
Create a Jena graph from an existing repository


GraphSesame

public GraphSesame()
Create a Jena Graph, which represents a Sesame in-memory local repository that does not have persistent support, synchroinzation support and inference capability.


GraphSesame

public GraphSesame(boolean inferencing,
                   boolean sync,
                   String fileName,
                   String format)
Create a Jena Graph, which represents a Sesame in-memory local repository that has the following customizable features. It will firstly create a Sesame repository, then create a Sesame graph from the repository.

Parameters:
inferencing - the Sesame repository supports inference or not.
sync - the the Sesame repository is synchronized or not.
fileName - the name of the file provides the persistent storage. Null means no persistent support required.
format - the RDF data format in the persistent storage.

GraphSesame

public GraphSesame(boolean sync,
                   String dir)
Create a Jena Graph, which represents a Sesame native local repository.

Parameters:
sync - the the Sesame repository is synchronized or not.
dir - specifies the directory that can be used by the native sail to store its files.

GraphSesame

public GraphSesame(boolean sync,
                   String driver,
                   String url,
                   String user,
                   String password)
Create a Jena Graph, which represents a Sesame rdbms local repository.

Parameters:
sync - true: the model is synchronized; false: not.
driver - identifies the JDBC (Java Data Base Connectivity) driver that is to be used to access the database.
url - identifies the location of the database through a URL.
user - identifies a username with which Sesame can access the database.
password - identifies a password with which Sesame can access the database.
Method Detail

getValueFactory

public static ValueFactory getValueFactory()
Get a Sesame ValueFactory used to create Sesame URI, blank node, literal, etc.

Returns:
Sesame ValueFactory

setCapabilities

private void setCapabilities()

addSyncLayer

private void addSyncLayer(RepositoryConfig repConfig)

createOnConfig

private void createOnConfig(RepositoryConfig repConfig)

_createRepository

private Repository _createRepository(RepositoryConfig rc)
                              throws ServerConfigException
Copied from sesame org.openrdf.sesame.server.Server

Parameters:
rc -
Returns:
a new repository configured as specified.
Throws:
ServerConfigException

jena2sesame

public Statement jena2sesame(Triple t)

graphBaseFind

protected ExtendedIterator graphBaseFind(TripleMatch tm)
Specified by:
graphBaseFind in class com.hp.hpl.jena.graph.impl.GraphBase
See Also:
GraphBase.graphBaseFind(com.hp.hpl.jena.graph.TripleMatch)

performAdd

public void performAdd(Triple t)
Specified by:
performAdd in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
Overrides:
performAdd in class com.hp.hpl.jena.graph.impl.GraphBase
See Also:
GraphWithPerform.performAdd(com.hp.hpl.jena.graph.Triple)

performDelete

public void performDelete(Triple t)
Specified by:
performDelete in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
Overrides:
performDelete in class com.hp.hpl.jena.graph.impl.GraphBase
See Also:
GraphWithPerform.performDelete(com.hp.hpl.jena.graph.Triple)

getRepository

public Repository getRepository()
See Also:
Graph.queryHandler()

close

public void close()
Specified by:
close in interface Graph
Overrides:
close in class com.hp.hpl.jena.graph.impl.GraphBase

graphBaseSize

protected int graphBaseSize()
We override this, maybe Sesame's version is more efficient.

Overrides:
graphBaseSize in class com.hp.hpl.jena.graph.impl.GraphBase

getBulkUpdateHandler

public BulkUpdateHandler getBulkUpdateHandler()
Specified by:
getBulkUpdateHandler in interface Graph
Overrides:
getBulkUpdateHandler in class com.hp.hpl.jena.graph.impl.GraphBase