com.clarkparsia.stardog
Interface DatabaseBuilder

All Known Subinterfaces:
DatabaseBuilder.DiskDatabaseBuilder, DatabaseBuilder.MemDatabaseBuilder

public interface DatabaseBuilder

Builder class for creating new Stardog databases. Provides the ability to configure the variety of options provided by memory or disk databases at creation time and to bulk load data into the database.

Please note that while memory indexes can be persisted to disk, this scheme is only recommended for small databases or prototypes. If you want a scalable, persistent database, you really ought to be using the disk database.

Since:
0.7
Version:
0.8
Author:
Michael Grove

Nested Class Summary
static interface DatabaseBuilder.DiskDatabaseBuilder
          Disk database specific builder
static interface DatabaseBuilder.MemDatabaseBuilder
          In-Memory database specific builder
 
Method Summary
 ConnectionConfiguration create(File... theFiles)
          Create the database using the parameters specified by this builder.
 ConnectionConfiguration create(Function<File,Resource> theContexts, File... theFiles)
          Create the database using the parameters specified by this builder.
 DatabaseBuilder durableTransactions(boolean theDurable)
          Specify whether or not transactions for this database should be durable.
 DatabaseBuilder reporter(PrintStream theStream)
          Sets the output used to print information messages about
 DatabaseBuilder searchable(boolean theSearchable)
          Specify whether or not the database created by this builder should be searchable via Waldo.
<V> DatabaseBuilder
set(ConfigProperty<V> theOption, V theValue)
          Set the given option on this builder
 

Method Detail

reporter

DatabaseBuilder reporter(PrintStream theStream)
Sets the output used to print information messages about

Parameters:
theStream - the output stream to use
Returns:
this object

searchable

DatabaseBuilder searchable(boolean theSearchable)
Specify whether or not the database created by this builder should be searchable via Waldo. The default is 'false' -- search is not automatically enabled for a database.

Parameters:
theSearchable - true to be searchable, false otherwise
Returns:
this object

durableTransactions

DatabaseBuilder durableTransactions(boolean theDurable)
Specify whether or not transactions for this database should be durable. The default is 'false' -- non-durable transactions.

Parameters:
theDurable - true for durable transactions, false otherwise.
Returns:
this object.

set

<V> DatabaseBuilder set(ConfigProperty<V> theOption,
                        V theValue)
Set the given option on this builder

Type Parameters:
V - the option type
Parameters:
theOption - the option to set
theValue - the value
Returns:
this builder object

create

ConnectionConfiguration create(File... theFiles)
                               throws StardogException

Create the database using the parameters specified by this builder. Any files supplied to this function will be bulk loaded into the database as it is created. The data in the files will be loaded into the default graph unless the files are written in a format that supports named graphs such as Trig.

The connection context returned will contain the relevant information about database name and server URL to obtain a connection, but it will not contain any login credentials; they are not kept after login, so before connecting, you must add the proper credentials to the connection configuration before attempting to connect.

Parameters:
theFiles - optionally, the files to pre-load into the database
Returns:
a valid ConnectionConfiguration to connect to the new database
Throws:
StardogException - if the database could not be created or if there was an error while performing the bulk load

create

ConnectionConfiguration create(Function<File,Resource> theContexts,
                               File... theFiles)
                               throws StardogException

Create the database using the parameters specified by this builder. Any files supplied to this function will be bulk loaded into the database as it is created. The parameter theContexts can be used to specify a context (named graph) for the triples loaded from a file. When the contents of a file is being loaded into the database, if the file format supports named graphs (e.g. Trig) then the triples will be loaded into named graphs as specified in the file. If the file format does not support named graphs (e.g. RDF/XML, Turtle, etc.) then the theContexts mapping is used to find a target context for the triples loaded from that file. If the mapping returns a null value then those triples will be loaded into the default graph without a context.

The connection context returned will contain the relevant information about database name and server URL to obtain a connection, but it will not contain any login credentials; they are not kept after login, so before connecting, you must add the proper credentials to the connection configuration before attempting to connect.

Parameters:
theContexts - contains the mappings from a file to a context (named graph) that will be used as the target context for the triples read from that file
theFiles - optionally, the files to pre-load into the database
Returns:
a valid ConnectionConfiguration to connect to the new database
Throws:
StardogException - if the database could not be created or if there was an error while performing the bulk load


Copyright © 2010-2013 Clark & Parsia. All Rights Reserved.