xsmeral.semnet.sink
Class SesameWriter

java.lang.Object
  extended by xsmeral.pipe.AbstractObjectProcessor
      extended by xsmeral.pipe.LocalObjectSink<Statement>
          extended by xsmeral.semnet.sink.SesameWriter
All Implemented Interfaces:
Runnable, xsmeral.pipe.context.ContextAware, xsmeral.pipe.interfaces.ObjectProcessor, xsmeral.pipe.interfaces.ObjectSink<Statement>

@ObjectProcessorInterface(in=org.openrdf.model.Statement.class)
public class SesameWriter
extends xsmeral.pipe.LocalObjectSink<Statement>

Writes Statements to a Sesame database. The connection to database is configured using a configured RepositoryFactory implementation.
The configuration is read from a Properties file that should contain fields:

In the Properties, a field with a name equal to RepositoryFactory.PROP_WORKING_DIR is set to the value of current working directory (used by implementations that use file system to resolve relative file names).

Bootstrapping

There is an option to bootstrap the database with statements from a file. The file names and types have to be specified in the bootstrap initialization parameter, like in the following example:
     <processor ...bootstrap="file1.rdf:RDFXML,file2.n3:N3"...>...
 
or more generally
     file[:type][,file[:type]...]
 
where type refers to a constant defined in Sesame's RDFFormat. If the type is not specified, it is guessed from the file name extension.

See Also:
RepositoryFactory
Initialization parameters
conf - Name of Properties file containing configuration of Repository
bootstrap - (Optional) Names of files (comma-separated) containing statements that should be added to the database prior to running. Format for the parameter specified in description of this class.
bootBase - (Optional) Only applies if bootstrap is used; specifies the base URI for any relative URIs in the bootstrapped files. Default is a reference to runtime directory.

Nested Class Summary
 
Nested classes/interfaces inherited from interface xsmeral.pipe.interfaces.ObjectProcessor
xsmeral.pipe.interfaces.ObjectProcessor.Status
 
Field Summary
static String BOOTSTRAP_OLD_SUFFIX
           
 
Fields inherited from class xsmeral.pipe.LocalObjectSink
prev
 
Fields inherited from class xsmeral.pipe.AbstractObjectProcessor
canStart, context, status
 
Constructor Summary
SesameWriter()
           
SesameWriter(RepositoryConnection conn)
          Initializes with the specified connection.
 
Method Summary
protected  void initPostContext()
          Reads the supplied configuration (Properties) file, sets working directory, initializes repository factory.
protected  void postRun()
          Closes the connection.
protected  void process()
          Adds a read statement to the database.
 
Methods inherited from class xsmeral.pipe.LocalObjectSink
getPrev, handleStoppedSource, prev, read, requestStop
 
Methods inherited from class xsmeral.pipe.AbstractObjectProcessor
canStart, failStart, failStart, failStart, getContext, getInType, getOutType, getParams, getStatus, initContext, initContextSet, initialize, initializeInternal, initWithContext, preRun, run, setContext, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface xsmeral.pipe.interfaces.ObjectSink
getInType
 

Field Detail

BOOTSTRAP_OLD_SUFFIX

public static final String BOOTSTRAP_OLD_SUFFIX
See Also:
Constant Field Values
Constructor Detail

SesameWriter

public SesameWriter()

SesameWriter

public SesameWriter(RepositoryConnection conn)
Initializes with the specified connection.

Method Detail

initPostContext

protected void initPostContext()
Reads the supplied configuration (Properties) file, sets working directory, initializes repository factory.

Overrides:
initPostContext in class xsmeral.pipe.AbstractObjectProcessor
See Also:
RepositoryFactory

process

protected void process()
                throws xsmeral.pipe.ProcessorStoppedException
Adds a read statement to the database.

Overrides:
process in class xsmeral.pipe.LocalObjectSink<Statement>
Throws:
xsmeral.pipe.ProcessorStoppedException

postRun

protected void postRun()
Closes the connection.

Overrides:
postRun in class xsmeral.pipe.AbstractObjectProcessor