Interface DatabaseBuilder


  • 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, they are 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:
    6.0
    Author:
    Michael Grove
    • Method Detail

      • copyServerSide

        DatabaseBuilder copyServerSide()
        Specify that any files which are to be bulk loaded should be first copied to the remote server.
      • reporter

        DatabaseBuilder reporter​(java.io.PrintStream theStream)
        Sets the output used to print information messages during the bulk load process
        Parameters:
        theStream - the output stream to use
        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​(java.nio.file.Path... 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 configuration 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​(java.util.function.Function<java.nio.file.Path,​Resource> theContexts,
                                       java.nio.file.Path... 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