Interface Adder


  • public interface Adder

    Interface for adding RDF to a Stardog database via a connection.

    Usage:

    // some stuff from a file c.add().io().format(RDFFormat.TURTLE).file(new File("data.ttl")); // also add something from some input stream c.add().io().format(RDFFormat.RDFXML).stream(input); // or add a specific statement c.add().statement(s,p,o);

    The changes done through this class might not be sent immediately to the server. The client connection may batch the changes locally and delay sending those changes to the server to minimize the number of network calls. This is an implementation detail and will not change the execution order of read and write operations performed within the transaction.

    Since:
    0.3
    Version:
    6.0
    Author:
    Michael Grove
    • Method Detail

      • statement

        Adder statement​(Resource theSubj,
                        IRI thePred,
                        Value theObj,
                        Resource... theContext)
                 throws StardogException
        Add a single statement to the database. If contexts are specified, the statement will be added to each context.
        Parameters:
        theSubj - the subject
        thePred - the predicate
        theObj - the object
        theContext - the (optional) named graph to add the data to
        Returns:
        this object
        Throws:
        StardogException - if there is an error while adding the statement
      • statement

        Adder statement​(Statement theStmt)
                 throws StardogException
        Add a single statement to the database
        Parameters:
        theStmt - the statement to add
        Returns:
        this object
        Throws:
        StardogException - if there was an error while adding the statement
      • graph

        Adder graph​(java.util.Collection<Statement> theGraph,
                    Resource... theContext)
             throws StardogException
        Add the graph to the database. If any contexts are specified, they will override the context specified on statements within the graph. When multiple contexts are specified, the graph is added to each context.
        Parameters:
        theGraph - the graph to add
        theContext - the named graph to add the information to
        Returns:
        this object
        Throws:
        StardogException - if there is an error adding the data
      • io

        IO io()
        throws StardogException
        Add statements to the database from IO operations.
        Returns:
        an IO instance
        Throws:
        StardogException - if there is an error creating an IO adder
        See Also:
        IO