Class AGRepositoryConnection

java.lang.Object
org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
com.franz.agraph.repository.AGRepositoryConnection
All Implemented Interfaces:
AutoCloseable, org.eclipse.rdf4j.repository.RepositoryConnection

public class AGRepositoryConnection extends org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection implements org.eclipse.rdf4j.repository.RepositoryConnection, AutoCloseable
Implements the Sesame RepositoryConnection interface for AllegroGraph.

By default, a connection is in autoCommit mode. Connections in this mode are said to be shared. Multiple shared connections may be serviced by the same server back-end process and they have no associated state, thus they do not support some functionality such as multi-step transactions and datatype mappings.

Full functionality is offered by dedicated sessions at the cost of higher server resource requirements.

Note that concurrent access to the same connection object of either kind is explicitly forbidden. The client must perform its own synchronization to ensure non-concurrent access. This is typically achieved by employing connection pooling (see AGConnPool) and having exactly one thread that uses each connection.

Dedicated Session Overview

Sessions with AllegroGraph server are used for ACID transactions and also for server code in InitFile and Scripts. See more documentation for Sessions in the AllegroGraph HTTP Protocol and ACID transactions in the AllegroGraph Server documentation.

Operations such as setAutoCommit, addRules, and registerSNAGenerator will spawn a dedicated session (simply session, from now on) in order to perform their duties. Adds and deletes during a session must be committed or rolled back.

To conserve resources, the server will drop a session when its idle lifetime is exceeded. To avoid this, the client periodically sends a ping message to the server. This automated behavior can be controlled by changing the executor used to schedule maintenance tasks. This can be done either in the AGServer.setExecutor(ScheduledExecutorService) server} object or when creating a new connection with AGRepository.getConnection(ScheduledExecutorService).

A session should be closed when finished.

InitFiles and Scripts are loaded into the server only for sessions. See Scripting in HTTP Protocol and search for "InitFile" in WebView for how to create initFiles.

Starting a session causes http requests to use a new port, which may cause an exception if the client can not access it. See Session Port Setup.

Methods that start a session if not already started:

Methods that affect a session in use:

Methods to configure a session before it is started:

Data-type and Predicate Mapping

For more details, see the HTTP Protocol docs for Type Mappings and the Lisp reference for Data-type and Predicate Mapping.

Methods for type mappings:

Since:
v4.0
  • Field Details

  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getRepository

      public AGAbstractRepository getRepository()
      Specified by:
      getRepository in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      getRepository in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
    • getServer

      public AGServer getServer()
      Returns:
      the AGServer object associated with this connection
    • prepareHttpRepoClient

      public AGHttpRepoClient prepareHttpRepoClient()
      This is the method to call, in this or other classes, if you want to do HTTP interaction with the repository. As a side effect (what the "prepare" stands for) any buffered statements are sent over.
      Returns:
      the AGHttpRepoclient used by this connection (after the addStatementBuffer is cleared)
    • isAddStatementBufferEnabled

      public boolean isAddStatementBufferEnabled()
      Returns:
      whether the addStatementBuffer is in principle enabled (by the PROP_USE_ADD_STATEMENT_BUFFER property or a call to setAddStatementBufferEnabled).
    • setAddStatementBufferEnabled

      public void setAddStatementBufferEnabled(boolean enabled)
      Enable or disable the use of the addStatementBuffer. This can be called within an active transaction and will affect (speed up) the rest of the transaction. When called in autocommit mode, it has no immediate effect, but in a subsequent transaction the buffer functionality will be used.

      The buffer can also be enabled by setting property PROP_USE_ADD_STATEMENT_BUFFER.

      Parameters:
      enabled - whether to enable buffering
    • isUseAddStatementBuffer

      public boolean isUseAddStatementBuffer()
      Returns:
      whether the addStatementBuffer is actually used right now for the connection.
    • getAddStatementBufferMaxSize

      public int getAddStatementBufferMaxSize()
    • setAddStatementBufferMaxSize

      public void setAddStatementBufferMaxSize(int size)
      Set the maximum size of the addStatementBuffer.

      This size can also be set by using property PROP_ADD_STATEMENT_BUFFER_MAX_SIZE.

      Parameters:
      size - new maximum buffer size
    • getNumBufferedAddStatements

      public int getNumBufferedAddStatements()
      Returns:
      the number of buffered statements to be added
    • getValueFactory

      public AGValueFactory getValueFactory()
      Specified by:
      getValueFactory in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      getValueFactory in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
    • add

      public void add(Iterable<? extends org.eclipse.rdf4j.model.Statement> statements, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      add in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      add in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • add

      public void add(Iterable<? extends org.eclipse.rdf4j.model.Statement> statements, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • add

      public void add(org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends org.eclipse.rdf4j.model.Statement> statementIter, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      add in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      add in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • add

      public void add(org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends org.eclipse.rdf4j.model.Statement> statementIter, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • add

      public void add(File file, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, org.eclipse.rdf4j.model.Resource... contexts) throws IOException, org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException
      Adds RDF data from the specified file to a specific contexts in the repository.
      Specified by:
      add in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      add in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Parameters:
      file - a file containing RDF data
      baseURI - the base URI against which any relative URIs in the data are resolved. This defaults to the value of file.toURI() if the value is set to null
      dataFormat - the serialization format of the data
      contexts - the contexts to add the data to. Note that this parameter is a vararg and as such is optional. If no contexts are specified, the data is added to any context specified in the actual data file, or if the data contains no context, it is added to the default context. If one or more contexts are specified the data is added to these contexts, ignoring any context information in the data itself
      Throws:
      IOException - if an I/O error occurred while reading from the file
      org.eclipse.rdf4j.rio.UnsupportedRDFormatException - if no parser is available for the specified RDF format
      org.eclipse.rdf4j.rio.RDFParseException - if an error occurred while parsing the RDF data
      org.eclipse.rdf4j.repository.RepositoryException - if the data could not be added to the repository, for example because the repository is not writable
    • add

      public void add(File file, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws IOException, org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException
      Adds RDF data from the specified file to a specific contexts in the repository.
      Parameters:
      file - a file containing RDF data
      baseURI - the base URI against which any relative URIs in the data are resolved. This defaults to the value of file.toURI() if the value is set to null
      dataFormat - the serialization format of the data
      attributes - a JSONObject of attribute bindings that will be added to each statement imported from `file'. For RDFFormats that support the specification of attributes (like NQX) these attributes will be applied to statements that do not already specify attributes
      contexts - the contexts to add the data to. Note that this parameter is a vararg and as such is optional. If no contexts are specified, the data is added to any context specified in the actual data file, or if the data contains no context, it is added to the default context. If one or more contexts are specified the data is added to these contexts, ignoring any context information in the data itself
      Throws:
      IOException - if an I/O error occurred while reading from the file
      org.eclipse.rdf4j.rio.UnsupportedRDFormatException - if no parser is available for the specified RDF format
      org.eclipse.rdf4j.rio.RDFParseException - if an error occurred while parsing the RDF data
      org.eclipse.rdf4j.repository.RepositoryException - if the data could not be added to the repository, for example because the repository is not writable
    • add

      public void add(URL url, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, org.eclipse.rdf4j.model.Resource... contexts) throws IOException, org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException
      Adds the RDF data that can be found at the specified URL to the repository, optionally to one or more named contexts.
      Specified by:
      add in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      add in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Parameters:
      url - the URL of the RDF data
      baseURI - the base URI against which any relative URIs in the data are resolved. This defaults to the value of url.toExternalForm() if the value is set to null
      dataFormat - the serialization format of the data
      contexts - the contexts to add the data to. If one or more contexts are specified the data is added to these contexts, ignoring any context information in the data itself
      Throws:
      IOException - if an I/O error occurred while reading from the URL
      org.eclipse.rdf4j.rio.UnsupportedRDFormatException - if no parser is available for the specified RDF format
      org.eclipse.rdf4j.rio.RDFParseException - if an error occurred while parsing the RDF data
      org.eclipse.rdf4j.repository.RepositoryException - if the data could not be added to the repository, for example because the repository is not writable
    • add

      public void add(URL url, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws IOException, org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException
      Adds the RDF data that can be found at the specified URL to the repository, optionally to one or more named contexts.
      Parameters:
      url - the URL of the RDF data
      baseURI - the base URI against which any relative URIs in the data are resolved. This defaults to the value of url.toExternalForm() if the value is set to null
      dataFormat - the serialization format of the data
      attributes - a JSONObject of attribute bindings that will be added to each statement imported from `url'. For RDFFormats that support the specification of attributes (like NQX) these attributes will be applied to statements that do not already specify attributes
      contexts - the contexts to add the data to. If one or more contexts are specified the data is added to these contexts, ignoring any context information in the data itself
      Throws:
      IOException - if an I/O error occurred while reading from the URL
      org.eclipse.rdf4j.rio.UnsupportedRDFormatException - if no parser is available for the specified RDF format
      org.eclipse.rdf4j.rio.RDFParseException - if an error occurred while parsing the RDF data
      org.eclipse.rdf4j.repository.RepositoryException - if the data could not be added to the repository, for example because the repository is not writable
    • add

      public void add(InputStream in, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, org.eclipse.rdf4j.model.Resource... contexts) throws IOException, org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException
      Adds RDF data from an InputStream to the repository, optionally to one or more named contexts.
      Specified by:
      add in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      add in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Parameters:
      in - an InputStream from which RDF data can be read
      baseURI - the base URI against which any relative URIs in the data are resolved
      dataFormat - the serialization format of the data
      contexts - the contexts to add the data to. If one or more contexts are supplied the method ignores contextual information in the actual data. If no contexts are supplied the contextual information in the input stream is used, if no context information is available the data is added without any context
      Throws:
      IOException - if an I/O error occurred while reading from the input stream
      org.eclipse.rdf4j.rio.UnsupportedRDFormatException - if no parser is available for the specified RDF format
      org.eclipse.rdf4j.rio.RDFParseException - if an error occurred while parsing the RDF data
      org.eclipse.rdf4j.repository.RepositoryException - if the data could not be added to the repository, for example because the repository is not writable
    • add

      public void add(InputStream in, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws IOException, org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException
      Adds RDF data from an InputStream to the repository, optionally to one or more named contexts.
      Parameters:
      in - an InputStream from which RDF data can be read
      baseURI - the base URI against which any relative URIs in the data are resolved
      dataFormat - the serialization format of the data
      attributes - a JSONObject of attribute bindings that will be added to each statement imported from `in'. For RDFFormats that support the specification of attributes (like NQX) these attributes will be applied to statements that do not already specify attributes
      contexts - the contexts to add the data to. If one or more contexts are supplied the method ignores contextual information in the actual data. If no contexts are supplied the contextual information in the input stream is used, if no context information is available the data is added without any context
      Throws:
      IOException - if an I/O error occurred while reading from the input stream
      org.eclipse.rdf4j.rio.UnsupportedRDFormatException - if no parser is available for the specified RDF format
      org.eclipse.rdf4j.rio.RDFParseException - if an error occurred while parsing the RDF data
      org.eclipse.rdf4j.repository.RepositoryException - if the data could not be added to the repository, for example because the repository is not writable
    • add

      public void add(Reader reader, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, org.eclipse.rdf4j.model.Resource... contexts) throws IOException, org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException
      Adds RDF data from a Reader to the repository, optionally to one or more named contexts. Note: using a Reader to upload byte-based data means that you have to be careful not to destroy the data's character encoding by enforcing a default character encoding upon the bytes. If possible, adding such data using an InputStream is to be preferred.
      Specified by:
      add in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      add in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Parameters:
      reader - a Reader from which RDF data can be read
      baseURI - the base URI against which any relative URIs in the data are resolved
      dataFormat - the serialization format of the data
      contexts - he contexts to add the data to. If one or more contexts are specified the data is added to these contexts, ignoring any context information in the data itself
      Throws:
      IOException - if an I/O error occurred while reading from the reader
      org.eclipse.rdf4j.rio.UnsupportedRDFormatException - if no parser is available for the specified RDF format
      org.eclipse.rdf4j.rio.RDFParseException - if an error occurred while parsing the RDF data
      org.eclipse.rdf4j.repository.RepositoryException - if the data could not be added to the repository, for example because the repository is not writable
    • add

      public void add(Reader reader, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws IOException, org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException
      Adds RDF data from a Reader to the repository, optionally to one or more named contexts. Note: using a Reader to upload byte-based data means that you have to be careful not to destroy the data's character encoding by enforcing a default character encoding upon the bytes. If possible, adding such data using an InputStream is to be preferred.
      Parameters:
      reader - a Reader from which RDF data can be read
      baseURI - the base URI against which any relative URIs in the data are resolved
      dataFormat - the serialization format of the data
      attributes - a JSONObject of attribute bindings that will be added to each statement imported from `reader'. For RDFFormats that support the specification of attributes (like NQX) these attributes will be applied to statements that do not already specify attributes
      contexts - the contexts to add the data to. If one or more contexts are specified the data is added to these contexts, ignoring any context information in the data itself
      Throws:
      IOException - if an I/O error occurred while reading from the reader
      org.eclipse.rdf4j.rio.UnsupportedRDFormatException - if no parser is available for the specified RDF format
      org.eclipse.rdf4j.rio.RDFParseException - if an error occurred while parsing the RDF data
      org.eclipse.rdf4j.repository.RepositoryException - if the data could not be added to the repository, for example because the repository is not writable
    • add

      public void add(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.Value object, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Adds a statement with the specified subject, predicate and object to this repository, optionally to one or more named contexts.
      Specified by:
      add in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      add in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Parameters:
      subject - the statement's subject
      predicate - the statement's predicate
      object - the statement's object
      contexts - the contexts to add the data to. Note that this parameter is a vararg and as such is optional. If the data contains no context, it is added to the default context. If one or more contexts are specified the data is added to these contexts, ignoring any context information in the data itself
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if the data could not be added to the repository, for example because the repository is not writable
    • add

      public void add(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.Value object, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • remove

      public void remove(org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.Value object, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Removes the statement(s) with the specified subject, predicate and object from the repository, optionally restricted to the specified contexts.
      Specified by:
      remove in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      remove in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Parameters:
      subject - the statement's subject, or null for a wildcard
      predicate - the statement's predicate, or null for a wildcard
      object - the statement's object, or null for a wildcard
      contexts - the context(s) to remove the data from. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on the entire repository
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if the statement(s) could not be removed from the repository, for example because the repository is not writable
    • remove

      public void remove(org.eclipse.rdf4j.model.Statement st, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      remove in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      remove in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • add

      public void add(org.eclipse.rdf4j.model.Statement st, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      add in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      add in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • add

      public void add(org.eclipse.rdf4j.model.Statement st, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • remove

      public void remove(Iterable<? extends org.eclipse.rdf4j.model.Statement> statements, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      remove in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      remove in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • remove

      public void remove(org.eclipse.rdf4j.common.iteration.CloseableIteration<? extends org.eclipse.rdf4j.model.Statement> statements, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      remove in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      remove in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • isAutoCommit

      @Deprecated public boolean isAutoCommit() throws org.eclipse.rdf4j.repository.RepositoryException
      Deprecated.
      since release 2.7.0. Use isActive() instead.
      Specified by:
      isAutoCommit in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      isAutoCommit in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
      See Also:
    • setAutoCommit

      @Deprecated public void setAutoCommit(boolean autoCommit) throws org.eclipse.rdf4j.repository.RepositoryException
      Deprecated.
      As of release 2.7.0, use begin() instead.
      Setting autoCommit to false creates a dedicated server session which supports ACID transactions. Setting to true will create a dedicated server session.

      See session overview and POST session for more details.

      Starting a session causes http requests to use a new port, which may cause an exception if the client can not access it. See Session Port Setup.

      Specified by:
      setAutoCommit in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      setAutoCommit in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • getXAResource

      public XAResource getXAResource()
      Returns:
      an XAResource suitable for passing to a transaction manager to allow this connection to participate in an XA/2PC distributed transaction.
    • prepareCommit

      public void prepareCommit(Xid xid)
      Asks the server to prepare a commit for later finalization/rollback.
      Parameters:
      xid - The transaction id to assign to the prepared commit
    • commit

      public void commit() throws org.eclipse.rdf4j.repository.RepositoryException
      Commit the current transaction. See session overview and POST commit for more details.
      Specified by:
      commit in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • commit

      public void commit(Xid xid)
      Finalize a previously prepared two phase commit (2PC).
      Parameters:
      xid - The XID of the prepared transaction to be finalized
    • commit

      public void commit(TransactionSettings transactionSettings) throws org.eclipse.rdf4j.repository.RepositoryException
      Commit the current transaction.

      See session overview and POST commit for more details.

      Parameters:
      transactionSettings - Distributed transaction settings to be used by this commit.
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • rollback

      public void rollback() throws org.eclipse.rdf4j.repository.RepositoryException
      Roll back the current transaction (discard all changes made since last commit). See session overview and POST rollback for more details.
      Specified by:
      rollback in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • rollback

      public void rollback(Xid xid)
      Aborts a previously prepared commit.
      Parameters:
      xid - The transaction id of the prepared commit to abort.
    • getPreparedTransactions

      public Xid[] getPreparedTransactions() throws DecoderException
      Returns:
      an array of Xids of commits that have been prepared on the server.
      Throws:
      DecoderException - if the response from the server is invalid.
    • isStreamResults

      public boolean isStreamResults()
      If true, automatically use AGStreamTupleQuery. Default is false.
      Returns:
      boolean the value of the streamResults parameter
      See Also:
    • setStreamResults

      public void setStreamResults(boolean streamResults)
      Parameters:
      streamResults - new setting for the streamResults parameter
      See Also:
    • clearNamespaces

      public void clearNamespaces() throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      clearNamespaces in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • close

      public void close() throws org.eclipse.rdf4j.repository.RepositoryException
      Closes the session if there is one started. See session overview and POST close for more details.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      close in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • exportStatements

      public void exportStatements(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.rio.RDFHandler handler, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.rio.RDFHandlerException, org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      exportStatements in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.rio.RDFHandlerException
      org.eclipse.rdf4j.repository.RepositoryException
    • exportStatements

      public void exportStatements(org.eclipse.rdf4j.rio.RDFHandler handler, String... ids) throws org.eclipse.rdf4j.rio.RDFHandlerException, org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.rio.RDFHandlerException
      org.eclipse.rdf4j.repository.RepositoryException
    • getContextIDs

      public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Resource> getContextIDs() throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      getContextIDs in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • createRepositoryResult

      public <E> org.eclipse.rdf4j.repository.RepositoryResult<E> createRepositoryResult(Iterable<? extends E> elements)
      Creates a RepositoryResult for the supplied element set.
      Type Parameters:
      E - the class of elements in the set
      Parameters:
      elements - the set of elements
      Returns:
      RepositoryResult the set of elements as a RepositoryResult
    • getNamespace

      public String getNamespace(String prefix) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      getNamespace in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Specified by:
      getNamespace in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • getNamespaces

      public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Namespace> getNamespaces() throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      getNamespaces in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • getQueryOption

      public String getQueryOption(String name) throws org.eclipse.rdf4j.repository.RepositoryException
      Gets the value of the query option.
      Parameters:
      name - a query option name
      Returns:
      the String value for the given query option or null if query option is not set
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if the query options API is not supported by the server or the query option name is unknown
    • getQueryOptions

      public Map<String,String> getQueryOptions() throws org.eclipse.rdf4j.repository.RepositoryException
      Gets a set of all currently set query options.
      Returns:
      a Map<String, String> from query option names to values
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if the query options API is not supported by the server
    • getStatements

      public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement> getStatements(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      getStatements in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • hasStatement

      public boolean hasStatement(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      hasStatement in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      hasStatement in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • downloadStatements

      public void downloadStatements(File file, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws AGHttpException
      Downloads statements matching given pattern to a file.

      The output format is determined by the server.

      Parameters:
      file - Output path.
      subj - Subject filter.
      pred - Predicate filter.
      obj - Object filter.
      includeInferred - If true, inferred triples will be included in the result.
      contexts - Optional list of graphs to export.
      Throws:
      AGHttpException - .
    • downloadStatements

      public void downloadStatements(String file, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws AGHttpException
      Downloads statements matching given pattern to a file.

      The output format is determined by the server.

      Parameters:
      file - Output path.
      subj - Subject filter.
      pred - Predicate filter.
      obj - Object filter.
      includeInferred - If true, inferred triples will be included in the result.
      contexts - Optional list of graphs to export.
      Throws:
      AGHttpException - .
    • downloadStatements

      public void downloadStatements(File file, org.eclipse.rdf4j.rio.RDFFormat format, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws AGHttpException
      Downloads statements matching given pattern to a file.
      Parameters:
      file - Output path.
      format - Format to export the data in.
      subj - Subject filter.
      pred - Predicate filter.
      obj - Object filter.
      includeInferred - If true, inferred triples will be included in the result.
      contexts - Optional list of graphs to export.
      Throws:
      AGHttpException - .
    • downloadStatements

      public void downloadStatements(String file, org.eclipse.rdf4j.rio.RDFFormat format, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws AGHttpException
      Downloads statements matching given pattern to a file.
      Parameters:
      file - Output path.
      format - Format to export the data in.
      subj - Subject filter.
      pred - Predicate filter.
      obj - Object filter.
      includeInferred - If true, inferred triples will be included in the result.
      contexts - Optional list of graphs to export.
      Throws:
      AGHttpException - .
    • downloadStatements

      public void downloadStatements(File file, String mimeType, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws AGHttpException
      Downloads statements matching given pattern to a file.
      Parameters:
      file - Output path.
      mimeType - MIME type that will be requested from the server (output format).
      subj - Subject filter.
      pred - Predicate filter.
      obj - Object filter.
      includeInferred - If true, inferred triples will be included in the result.
      contexts - Optional list of graphs to export.
      Throws:
      AGHttpException - .
    • downloadStatements

      public void downloadStatements(String file, String mimeType, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws AGHttpException
      Downloads statements matching given pattern to a file.
      Parameters:
      file - Output path.
      mimeType - MIME type that will be requested from the server (output format).
      subj - Subject filter.
      pred - Predicate filter.
      obj - Object filter.
      includeInferred - If true, inferred triples will be included in the result.
      contexts - Optional list of graphs to export.
      Throws:
      AGHttpException - .
    • streamStatements

      public InputStream streamStatements(org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws AGHttpException
      Returns statements matching given pattern as an InputStream.

      The output format will be chosen by the server.

      Note that it is important to close the returned stream, to avoid resource leaks.

      Parameters:
      subj - Subject filter.
      pred - Predicate filter.
      obj - Object filter.
      includeInferred - If true, inferred triples will be included in the result.
      contexts - Optional list of graphs to export.
      Returns:
      An input stream containing response data. The caller MUST close this stream to release connection resources.
      Throws:
      AGHttpException - .
    • streamStatements

      public InputStream streamStatements(String mimeType, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws AGHttpException
      Returns statements matching given pattern as an InputStream.

      Note that it is important to close the returned stream, to avoid resource leaks.

      Parameters:
      mimeType - MIME type that will be requested from the server (output format).
      subj - Subject filter.
      pred - Predicate filter.
      obj - Object filter.
      includeInferred - If true, inferred triples will be included in the result.
      contexts - Optional list of graphs to export.
      Returns:
      An input stream containing response data. The caller MUST close this stream to release connection resources.
      Throws:
      AGHttpException - .
    • streamStatements

      public InputStream streamStatements(org.eclipse.rdf4j.rio.RDFFormat format, org.eclipse.rdf4j.model.Resource subj, org.eclipse.rdf4j.model.IRI pred, org.eclipse.rdf4j.model.Value obj, boolean includeInferred, org.eclipse.rdf4j.model.Resource... contexts) throws AGHttpException
      Returns statements matching given pattern as an InputStream.

      Note that it is important to close the returned stream, to avoid resource leaks.

      Parameters:
      format - Format to export the data in.
      subj - Subject filter.
      pred - Predicate filter.
      obj - Object filter.
      includeInferred - If true, inferred triples will be included in the result.
      contexts - Optional list of graphs to export.
      Returns:
      An input stream containing response data. The caller MUST close this stream to release connection resources.
      Throws:
      AGHttpException - .
    • getStatements

      public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement> getStatements(String... ids) throws org.eclipse.rdf4j.repository.RepositoryException
      Returns statements having the specified ids.

      This api is subject to change. There is currently no natural way to obtain a statement's triple id from the java client; when that is possible, this api may change.

      Parameters:
      ids - Strings representing statement ids
      Returns:
      the statements having the specified ids. The result object is a RepositoryResult object, a lazy Iterator-like object containing Statements and optionally throwing a RepositoryException when an error when a problem occurs during retrieval
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
    • downloadStatements

      public void downloadStatements(File file, org.eclipse.rdf4j.rio.RDFFormat format, String ids) throws AGHttpException
      Downloads statements with given ids to a file.
      Parameters:
      file - Output path.
      format - Format to export the data in.
      ids - Strings representing statement ids
      Throws:
      AGHttpException - .
    • downloadStatements

      public void downloadStatements(String file, org.eclipse.rdf4j.rio.RDFFormat format, String ids) throws AGHttpException
      Downloads statements with given ids to a file.
      Parameters:
      file - Output path.
      format - Format to export the data in.
      ids - Strings representing statement ids
      Throws:
      AGHttpException - .
    • downloadStatements

      public void downloadStatements(File file, String mimeType, String ids) throws AGHttpException
      Downloads statements with given ids to a file.
      Parameters:
      file - Output path.
      mimeType - MIME type to be requested from the server. Use "*&#47;*" to let the server choose the output format.
      ids - Strings representing statement ids
      Throws:
      AGHttpException - .
    • downloadStatements

      public void downloadStatements(String file, String mimeType, String ids) throws AGHttpException
      Downloads statements with given ids to a file.
      Parameters:
      file - Output path.
      mimeType - MIME type to be requested from the server. Use "*&#47;*" to let the server choose the output format.
      ids - Strings representing statement ids
      Throws:
      AGHttpException - .
    • streamStatements

      public InputStream streamStatements(org.eclipse.rdf4j.rio.RDFFormat format, String... ids) throws AGHttpException
      Returns statements with given ids as an InputStream.

      Note that it is important to close the returned stream, to avoid resource leaks.

      Parameters:
      format - Format to export the data in.
      ids - Strings representing statement ids
      Returns:
      An input stream containing response data. The caller MUST close this stream to release connection resources.
      Throws:
      AGHttpException - .
    • streamStatements

      public InputStream streamStatements(String mimeType, String... ids) throws AGHttpException
      Returns statements with given ids as an InputStream.

      Note that it is important to close the returned stream, to avoid resource leaks.

      Parameters:
      mimeType - MIME type to be requested from the server. Use "*&#47;*" to let the server choose the output format.
      ids - Strings representing statement ids
      Returns:
      An input stream containing response data. The caller MUST close this stream to release connection resources.
      Throws:
      AGHttpException - .
    • prepareQuery

      public AGQuery prepareQuery(org.eclipse.rdf4j.query.QueryLanguage ql, String queryString, String baseURI)
      Prepares a AGQuery for evaluation on this repository. Note that the preferred way of preparing queries is to use the more specific prepareTupleQuery(QueryLanguage, String, String), prepareBooleanQuery(QueryLanguage, String, String), or prepareGraphQuery(QueryLanguage, String, String) methods instead.
      Specified by:
      prepareQuery in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      UnsupportedOperationException - if the method is not supported for the supplied query language
      IllegalArgumentException - if the query type (Tuple, Graph, Boolean) cannot be determined
    • prepareTupleQuery

      public AGTupleQuery prepareTupleQuery(org.eclipse.rdf4j.query.QueryLanguage ql, String queryString)
      Specified by:
      prepareTupleQuery in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      prepareTupleQuery in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
    • prepareTupleQuery

      public AGTupleQuery prepareTupleQuery(org.eclipse.rdf4j.query.QueryLanguage ql, String queryString, String baseURI)
      Specified by:
      prepareTupleQuery in interface org.eclipse.rdf4j.repository.RepositoryConnection
    • prepareGraphQuery

      public AGGraphQuery prepareGraphQuery(org.eclipse.rdf4j.query.QueryLanguage ql, String queryString)
      Specified by:
      prepareGraphQuery in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      prepareGraphQuery in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
    • prepareGraphQuery

      public AGGraphQuery prepareGraphQuery(org.eclipse.rdf4j.query.QueryLanguage ql, String queryString, String baseURI)
      Specified by:
      prepareGraphQuery in interface org.eclipse.rdf4j.repository.RepositoryConnection
    • prepareBooleanQuery

      public AGBooleanQuery prepareBooleanQuery(org.eclipse.rdf4j.query.QueryLanguage ql, String queryString)
      Specified by:
      prepareBooleanQuery in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      prepareBooleanQuery in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
    • prepareBooleanQuery

      public AGBooleanQuery prepareBooleanQuery(org.eclipse.rdf4j.query.QueryLanguage ql, String queryString, String baseURI)
      Specified by:
      prepareBooleanQuery in interface org.eclipse.rdf4j.repository.RepositoryConnection
    • prepareUpdate

      public AGUpdate prepareUpdate(org.eclipse.rdf4j.query.QueryLanguage ql, String queryString, String baseURI)
      Specified by:
      prepareUpdate in interface org.eclipse.rdf4j.repository.RepositoryConnection
    • prepareUpdate

      public AGUpdate prepareUpdate(org.eclipse.rdf4j.query.QueryLanguage ql, String queryString)
      Specified by:
      prepareUpdate in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      prepareUpdate in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
    • removeNamespace

      public void removeNamespace(String prefix) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      removeNamespace in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • setNamespace

      public void setNamespace(String prefix, String name) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      setNamespace in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Specified by:
      setNamespace in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • removeQueryOption

      public void removeQueryOption(String name) throws org.eclipse.rdf4j.repository.RepositoryException
      Removes the given query option's value. Does not throw an exception if the query option name is unknown.
      Parameters:
      name - a query option name
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • setQueryOption

      public void setQueryOption(String name, String value) throws org.eclipse.rdf4j.repository.RepositoryException
      Sets query option given by name to the specified values.
      Parameters:
      name - a query option name
      value - a value for the given query option
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if the given query option name is unknown or the value didn't pass the validation
    • size

      public long size(org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Specified by:
      size in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • createFreetextIndex

      public void createFreetextIndex(String indexName, AGFreetextIndexConfig config) throws org.eclipse.rdf4j.repository.RepositoryException
      Creates a freetext index with the given name and configuration.

      See documentation for freetext index parameters.

      Parameters:
      indexName - the index name to create
      config - the index configuration
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
      See Also:
    • deleteFreetextIndex

      public void deleteFreetextIndex(String indexName) throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes the freetext index of the specified name.
      Parameters:
      indexName - the index to be deleted
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
      See Also:
    • createFreetextIndex

      @Deprecated public void createFreetextIndex(String name, org.eclipse.rdf4j.model.IRI[] predicates) throws org.eclipse.rdf4j.repository.RepositoryException
      Deprecated.
      Registers a predicate for free text indexing. Once registered, the objects of data added to the repository having this predicate will be text indexed and searchable.
      Parameters:
      name - of the index to create
      predicates - the predicates this index will operate on
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
      See Also:
    • getFreetextPredicates

      @Deprecated public String[] getFreetextPredicates(String index) throws org.eclipse.rdf4j.repository.RepositoryException
      Deprecated.
      Gets the predicates that have been registered for text indexing.
      Parameters:
      index - name of the index to lookup
      Returns:
      String[] the predicates this index operates on
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • getFreetextIndexConfig

      public AGFreetextIndexConfig getFreetextIndexConfig(String indexName) throws org.eclipse.rdf4j.repository.RepositoryException, JSONException
      Gets the configuration of the specified free text index.
      Parameters:
      indexName - name of the index
      Returns:
      AGFreetextIndexConfig the configuration of the specified index
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      JSONException - if there is a problem parsing the response to JSON
    • getFreetextIndices

      @Deprecated public String[] getFreetextIndices() throws org.eclipse.rdf4j.repository.RepositoryException
      Deprecated.
      Gets freetext indexes that have been created
      Returns:
      String[] a list of freetext index names
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • listFreetextIndices

      public List<String> listFreetextIndices() throws org.eclipse.rdf4j.repository.RepositoryException
      Lists the freetext indices that have been defined for this repository.
      Returns:
      List a list of freetext index names
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • registerPredicateMapping

      public void registerPredicateMapping(org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.IRI primtype) throws org.eclipse.rdf4j.repository.RepositoryException
      Registers a predicate mapping from the predicate to a primitive datatype. This can be useful in speeding up query performance and enabling range queries over datatypes.

      Once registered, the objects of any data added via this connection that have this predicate will be mapped to the primitive datatype.

      For example, registering that predicate <http://example.org/age> is mapped to XSD.INT and adding the triple: <http://example.org/Fred> <http://example.org/age> "24" will result in the object being treated as "24"^^xsd:int.

      See mapping overview and POST predicate mapping.

      Parameters:
      predicate - the predicate URI
      primtype - the datatype URI
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • deletePredicateMapping

      public void deletePredicateMapping(org.eclipse.rdf4j.model.IRI predicate) throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes any predicate mapping associated with the given predicate.

      See mapping overview and DELETE predicate mapping.

      Parameters:
      predicate - the predicate mapping to delete
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • getPredicateMappings

      public String[] getPredicateMappings() throws org.eclipse.rdf4j.repository.RepositoryException
      Gets the predicate mappings defined for this connection.

      See mapping overview and GET predicate mapping and the Lisp reference for the predicate-mapping function.

      Returns:
      String[] the predicate mappings that have been registered
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • registerDatatypeMapping

      public void registerDatatypeMapping(org.eclipse.rdf4j.model.IRI datatype, org.eclipse.rdf4j.model.IRI primtype) throws org.eclipse.rdf4j.repository.RepositoryException
      Registers a datatype mapping from the datatype to a primitive datatype. This can be useful in speeding up query performance and enabling range queries over user datatypes.

      Once registered, the objects of any data added via this connection that have this datatype will be mapped to the primitive datatype.

      For example, registering that datatype <http://example.org/usertype> is mapped to XSD.INT and adding the triple: <http://example.org/Fred> <http://example.org/age> "24"^^<http://example.org/usertype> will result in the object being treated as "24"^^xsd:int.

      See mapping overview and POST type mapping.

      Parameters:
      datatype - the name of the datatype mapping to register
      primtype - the primitive type of the new mapping
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • deleteDatatypeMapping

      public void deleteDatatypeMapping(org.eclipse.rdf4j.model.IRI datatype) throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes any datatype mapping associated with the given datatype.

      See mapping overview and DELETE type mapping.

      Parameters:
      datatype - the datatype mapping to delete
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • getDatatypeMappings

      public String[] getDatatypeMappings() throws org.eclipse.rdf4j.repository.RepositoryException
      Gets the datatype mappings defined for this connection.

      See mapping overview and GET type mapping and the Lisp reference for the datatype-mapping function.

      Returns:
      String[] the datatype mappings that have been registered
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • clearMappings

      public void clearMappings() throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes all user-defined predicate and datatype mappings for this connection, and reestablishes the automatic mappings for primitive datatypes.

      This is equivalent to clearMappings(false).

      See mapping overview and DELETE all mapping for more details.

      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • clearMappings

      public void clearMappings(boolean includeAutoEncodedPrimitiveTypes) throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes all predicate and user-defined datatype mappings for this connection.

      When includeAutoEncodedPrimitiveTypes is true, also deletes the automatic mappings for primitive datatypes; this is rarely what you want to do, as it will cause range queries to perform much less efficiently than when encodings are used; this option can be useful for ensuring literal forms are preserved in the store (there can be precision loss when encoding some literals).

      See mapping overview and DELETE all mapping for more details.

      Parameters:
      includeAutoEncodedPrimitiveTypes - true if auto-encoded primitive types should be cleared
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • clearAttributes

      public void clearAttributes() throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes all attribute definitions from the repository.
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • addRules

      public void addRules(String rules) throws org.eclipse.rdf4j.repository.RepositoryException
      Adds Prolog rules to be used on this connection.

      See Prolog Lisp documentation and Prolog functor registration.

      Starts a session if one is not already started. See session overview for more details. Starting a session causes http requests to use a new port, which may cause an exception if the client can not access it. See Session Port Setup.

      Parameters:
      rules - a string of rule text
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • addRules

      public void addRules(InputStream rulestream) throws org.eclipse.rdf4j.repository.RepositoryException
      Adds Prolog rules to be used on this connection.

      See Prolog Lisp documentation and Prolog functor registration.

      Starts a session if one is not already started. See session overview for more details. Starting a session causes http requests to use a new port, which may cause an exception if the client can not access it. See Session Port Setup.

      Parameters:
      rulestream - a stream of rule text
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • evalInServer

      public String evalInServer(String lispForm) throws org.eclipse.rdf4j.repository.RepositoryException
      Evaluates a Lisp form on the server, and returns the result as a String.

      See HTTP POST eval.

      Parameters:
      lispForm - the Lisp form to evaluate
      Returns:
      String the result of the evaluation
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • evalInServer

      public String evalInServer(InputStream stream) throws org.eclipse.rdf4j.repository.RepositoryException
      Evaluates a Lisp form on the server, and returns the result as a String.

      See HTTP POST eval.

      Parameters:
      stream - the Lisp form to evaluate
      Returns:
      the result in a String
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • load

      public void load(org.eclipse.rdf4j.model.IRI source, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Instructs the server to fetch and load data from the specified URI.
      Parameters:
      source - the URI to fetch and load
      baseURI - the base URI for the source document
      dataFormat - the RDF data format for the source document
      contexts - zero or more contexts into which data will be loaded
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • load

      public void load(org.eclipse.rdf4j.model.IRI source, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Instructs the server to fetch and load data from the specified URI.
      Parameters:
      source - the URI to fetch and load
      baseURI - the base URI for the source document
      dataFormat - the RDF data format for the source document
      attributes - a JSONObject of attribute bindings that will be added to each statement imported from `source'. For RDFFormats that support the specification of attributes (like NQX) these attributes will be applied to statements that do not already specify attributes
      contexts - zero or more contexts into which data will be loaded
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • load

      public void load(String absoluteServerPath, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Instructs the server to load data from the specified server-side path.
      Parameters:
      absoluteServerPath - the path to the server-side source file
      baseURI - the base URI for the source document
      dataFormat - the RDF data format for the source document
      contexts - zero or more contexts into which data will be loaded
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • load

      public void load(String absoluteServerPath, String baseURI, org.eclipse.rdf4j.rio.RDFFormat dataFormat, JSONObject attributes, org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Instructs the server to load data from the specified server-side path.
      Parameters:
      absoluteServerPath - the path to the server-side source file
      baseURI - the base URI for the source document
      dataFormat - the RDF data format for the source document
      attributes - a JSONObject of attribute bindings that will be added to each statement imported from `absoluteServerPath'. For RDFFormats that support the specification of attributes (like NQX) these attributes will be applied to statements that do not already specify attributes
      contexts - zero or more contexts into which data will be loaded
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • ping

      public void ping() throws org.eclipse.rdf4j.repository.RepositoryException
      Instructs the server to extend the life of this connection's dedicated session, if it is using one. Sessions that are idle for more than the session lifetime will be terminated by the server.

      Note that this method is called automatically before the timeout expires.

      See session overview and GET ping for more details.

      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • getGeoTypes

      public String[] getGeoTypes() throws org.eclipse.rdf4j.repository.RepositoryException
      Returns:
      String[] the geospatial types that have been registered
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • registerCartesianType

      public org.eclipse.rdf4j.model.IRI registerCartesianType(float stripWidth, float xmin, float xmax, float ymin, float ymax) throws org.eclipse.rdf4j.repository.RepositoryException
      Registers a cartesian geospatial subtype.
      Parameters:
      stripWidth - the strip width in some units
      xmin - the minimum x range
      xmax - the maximum x range
      ymin - the minimum y range
      ymax - the maximum y range
      Returns:
      URI the datatype encoding of this subtype
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • registerSphericalType

      public org.eclipse.rdf4j.model.IRI registerSphericalType(float stripWidth, String unit, float latmin, float lonmin, float latmax, float lonmax) throws org.eclipse.rdf4j.repository.RepositoryException
      Registers a spherical geospatial subtype.
      Parameters:
      stripWidth - the strip width in some units
      unit - the distance unit stripWidth is specified in
      latmin - the minimum latitude range
      lonmin - the minimum longitude range
      latmax - the maximum latitude range
      lonmax - the maximum longitude range
      Returns:
      URI the datatype encoding of this subtype
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • registerSphericalType

      public org.eclipse.rdf4j.model.IRI registerSphericalType(float stripWidth, String unit) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • registerPolygon

      public void registerPolygon(org.eclipse.rdf4j.model.IRI polygon, List<org.eclipse.rdf4j.model.Literal> points) throws org.eclipse.rdf4j.repository.RepositoryException
      Registers a polygon.
      Parameters:
      polygon - the name of this polygon
      points - a List of points describing the polygon
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • getStatementsInBox

      public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement> getStatementsInBox(org.eclipse.rdf4j.model.IRI type, org.eclipse.rdf4j.model.IRI predicate, float xmin, float xmax, float ymin, float ymax, int limit, boolean infer) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • getStatementsInCircle

      public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement> getStatementsInCircle(org.eclipse.rdf4j.model.IRI type, org.eclipse.rdf4j.model.IRI predicate, float x, float y, float radius, int limit, boolean infer) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • getGeoHaversine

      public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement> getGeoHaversine(org.eclipse.rdf4j.model.IRI type, org.eclipse.rdf4j.model.IRI predicate, float lat, float lon, float radius, String unit, int limit, boolean infer) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • getStatementsInPolygon

      public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement> getStatementsInPolygon(org.eclipse.rdf4j.model.IRI type, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.IRI polygon, int limit, boolean infer) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • registerSNAGenerator

      public void registerSNAGenerator(String generator, List<org.eclipse.rdf4j.model.IRI> objectOfs, List<org.eclipse.rdf4j.model.IRI> subjectOfs, List<org.eclipse.rdf4j.model.IRI> undirecteds, String query) throws org.eclipse.rdf4j.repository.RepositoryException
      See Social network analysis Lisp documentation and SNA generator registration.

      Starts a session if one is not already started. See session overview for more details. Starting a session causes http requests to use a new port, which may cause an exception if the client can not access it. See Session Port Setup.

      Parameters:
      generator - Generator name
      objectOfs - a list of predicates
      subjectOfs - a list of predicates
      undirecteds - a list of predicates
      query - a string representation of a select clause
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • registerSNANeighborMatrix

      public void registerSNANeighborMatrix(String matrix, String generator, List<org.eclipse.rdf4j.model.IRI> group, int depth) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • listIndices

      public List<String> listIndices()
      Returns:
      a list of actively managed indices for this repository
    • listValidIndices

      public List<String> listValidIndices()
      Returns:
      a list of valid index types
    • addIndex

      public void addIndex(String type) throws org.eclipse.rdf4j.repository.RepositoryException
      Adds the given index to the list of actively managed indices. This will take affect on the next commit.
      Parameters:
      type - a valid index type
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • dropIndex

      public void dropIndex(String type) throws org.eclipse.rdf4j.repository.RepositoryException
      Drops the given index from the list of actively managed indices. This will take affect on the next commit.
      Parameters:
      type - an actively managed index type
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • sendRDFTransaction

      public void sendRDFTransaction(InputStream rdftransaction) throws org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.rio.RDFParseException, IOException
      Executes an application/x-rdftransaction.

      This method is useful for bundling add/remove operations into a single request and minimizing round trips to the server.

      Changes are committed iff the connection is in autoCommit mode. For increased throughput when sending multiple rdftransaction requests, consider using autoCommit=false and committing less frequently .

      Parameters:
      rdftransaction - a stream in application/x-rdftransaction format
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      org.eclipse.rdf4j.rio.RDFParseException - if malformed data is encountered
      IOException - on errors reading from the rdftransaction stream
    • sendRDFTransaction

      public void sendRDFTransaction(InputStream rdftransaction, JSONObject attributes) throws org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.rio.RDFParseException, IOException
      send an RDFTransaction, including attributes.
      Parameters:
      rdftransaction - a stream in application/x-rdftransaction format
      attributes - a JSONObject of attribute bindings that will be added to each triple imported from `rdftransaction'.
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      org.eclipse.rdf4j.rio.RDFParseException - if malformed data is encountered
      IOException - on errors reading from the rdftransaction stream
    • registerEncodableNamespace

      public void registerEncodableNamespace(String namespace, String format) throws org.eclipse.rdf4j.repository.RepositoryException
      Registers an encodable namespace having the specified format.

      Registering an encodable namespace enables a more efficient encoding of URIs in a namespace, and generation of unique URIs for that namespace, because its URIs are declared to conform to a specified format; the namespace is thereby bounded in size, and encodable.

      The namespace is any valid URIref, e.g.: http://franz.com/ns0

      The format is a string using a simplified regular expression syntax supporting character ranges and counts specifying the suffix portion of the URIs in the namespace, e.g: [a-z][0-9]-[a-f]{3}

      Generation of unique URIs AGValueFactory.generateURI(String) for the above namespace and format might yield an ID such as:

      http://franz.com/ns0@@a0-aaa

      Note: "@@" is used to concatenate the namespace and id suffix to facilitate efficient recognition/encoding during parsing.

      The format can be ambiguous (e.g., "[A-Z]{1,2}[B-C}{0,1}"). We will not check for ambiguity in this first version but can add this checking at a later time.

      If the format corresponds to a namespace that is not encodable (it may be malformed, or perhaps it's too large to encode), an exception is thrown.

      For more details, see Encoded IDs.

      Parameters:
      namespace - a valid namespace, a URI ref
      format - a valid format for an encodable namespace
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • registerEncodableNamespaces

      public void registerEncodableNamespaces(Iterable<? extends AGFormattedNamespace> formattedNamespaces) throws org.eclipse.rdf4j.repository.RepositoryException
      Registers multiple formatted namespaces in a single request.
      Parameters:
      formattedNamespaces - an iterable collection of formatted namespaces
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • listEncodableNamespaces

      public List<AGFormattedNamespace> listEncodableNamespaces()
      Returns:
      List a list of the registered encodable namespaces
      See Also:
    • unregisterEncodableNamespace

      public void unregisterEncodableNamespace(String namespace) throws org.eclipse.rdf4j.repository.RepositoryException
      Unregisters the specified encodable namespace.
      Parameters:
      namespace - the namespace to unregister
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
      See Also:
    • callStoredProc

      @Deprecated public Object callStoredProc(String functionName, String moduleName, Object... args) throws org.eclipse.rdf4j.repository.RepositoryException
      Deprecated.
      The stored proc feature and API are experimental, and subject to change in a future release.
      Invoke a stored procedure on the AllegroGraph server.

      The input arguments and the return value can be: String, Integer, null, byte[], or Object[] or List of these (can be nested).

      See also prepareHttpRepoClient().callStoredProc(functionName, moduleName, args)

      Parameters:
      functionName - stored proc lisp function, for example "addTwo"
      moduleName - lisp FASL file name, for example "example.fasl"
      args - arguments to the stored proc
      Returns:
      return value of stored proc
      Throws:
      AGCustomStoredProcException - for errors from stored proc
      org.eclipse.rdf4j.repository.RepositoryException
      Since:
      v4.2
    • getSessionLifetime

      public int getSessionLifetime()
      Returns the lifetime for a dedicated session spawned by this connection.

      See also: Session overview.

      Returns:
      the session lifetime, in seconds
      See Also:
    • setSessionLifetime

      public void setSessionLifetime(int lifetimeInSeconds)
      Sets the 'lifetime' for a dedicated session spawned by this connection. Seconds a session can be idle before being collected. If unset, the lifetime defaults to the value of DefaultSessionTimeout. If set, the value must not be larger than MaximumSessionTimeout. See Session directives in Server Configuration and Control for more information.

      Also see session overview and POST session for more details.

      Parameters:
      lifetimeInSeconds - the session lifetime, in seconds
      See Also:
    • setSessionLoadInitFile

      public void setSessionLoadInitFile(boolean loadInitFile)
      Sets the 'loadInitFile' flag for a dedicated session spawned by this connection. This method does not create a session.

      See also: Session overview.

      Parameters:
      loadInitFile - boolean determining if the init file is loaded into this session
      See Also:
    • addSessionLoadScript

      public void addSessionLoadScript(String scriptName)
      Adds a 'script' for a dedicated session spawned by this connection. This method does not create a session. May be called multiple times for different scripts. The script text must already be uploaded to the user.

      Scripts are server code that may be loaded during a session.

      See also: Session overview.

      Parameters:
      scriptName - name of the script to be loaded
      See Also:
    • getStoreID

      public long getStoreID() throws org.eclipse.rdf4j.repository.RepositoryException
      Returns the store ID
      Returns:
      The store ID
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • enableTripleCache

      public void enableTripleCache(long size) throws org.eclipse.rdf4j.repository.RepositoryException
      Enables the spogi cache in this repository.

      Takes a size argument to set the size of the cache.

      Parameters:
      size - the size of the cache, in triples
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • getTripleCacheSize

      public long getTripleCacheSize() throws org.eclipse.rdf4j.repository.RepositoryException
      Returns the size of the spogi cache.
      Returns:
      the size of the spogi cache, in triples
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • disableTripleCache

      public void disableTripleCache() throws org.eclipse.rdf4j.repository.RepositoryException
      Disables the spogi triple cache.
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error during the request
    • getUploadCommitPeriod

      public int getUploadCommitPeriod() throws org.eclipse.rdf4j.repository.RepositoryException
      Gets the commit period used within large add/load operations.
      Returns:
      int the current upload commit period
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
      See Also:
    • setUploadCommitPeriod

      public void setUploadCommitPeriod(int period) throws org.eclipse.rdf4j.repository.RepositoryException
      Sets the commit period to use within large add/load operations.
      Parameters:
      period - commit after this many statements
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
      See Also:
    • optimizeIndices

      public void optimizeIndices(Boolean wait, int level) throws org.eclipse.rdf4j.repository.RepositoryException
      Instruct the server to optimize the indices for this store.
      Parameters:
      wait - a boolean, false for request to return immediately
      level - determines the work to be done. See the index documentation for an explanation of the different levels
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request See the Index documentation for more details.
    • optimizeIndices

      public void optimizeIndices(Boolean wait) throws org.eclipse.rdf4j.repository.RepositoryException
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException
    • getSpinFunction

      public String getSpinFunction(String uri)
      Parameters:
      uri - SPIN function identifier
      Returns:
      String the SPIN function query text
      Since:
      v4.4
      See Also:
    • listSpinFunctions

      public List<AGSpinFunction> listSpinFunctions()
      Returns:
      List currently defined SPIN functions
      Since:
      v4.4
      See Also:
    • putSpinFunction

      public void putSpinFunction(AGSpinFunction fn)
      Parameters:
      fn - the SPIN function to add
      Since:
      v4.4
      See Also:
    • deleteSpinFunction

      public void deleteSpinFunction(String uri)
      Parameters:
      uri - SPIN function identifier
      Since:
      v4.4
      See Also:
    • getSpinMagicProperty

      public String getSpinMagicProperty(String uri)
      Parameters:
      uri - SPIN magic property identifier
      Returns:
      String describing the SPIN magic property
      Since:
      v4.4
      See Also:
    • listSpinMagicProperties

      public List<AGSpinMagicProperty> listSpinMagicProperties()
      Returns:
      List all defined SPIN magic properties
      Since:
      v4.4
      See Also:
    • deleteSpinMagicProperty

      public void deleteSpinMagicProperty(String uri)
      Parameters:
      uri - SPIN magic property identifier
      Since:
      v4.4
      See Also:
    • putSpinMagicProperty

      public void putSpinMagicProperty(AGSpinMagicProperty fn)
      Parameters:
      fn - the SPIN magic property to add
      Since:
      v4.4
      See Also:
    • deleteDuplicates

      public void deleteDuplicates(String comparisonMode) throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes all duplicates from the store.

      The comparisonMode determines what will be deemed a "duplicate".

      If comparisonMode is "spog", quad parts (s,p,o,g) will all be compared when looking for duplicates.

      If comparisonMode is "spo", only the (s,p,o) parts will be compared; the same triple in different graphs will thus be deemed duplicates.

      See also the protocol documentation for deleting duplicates

      Parameters:
      comparisonMode - method to determine what is a duplicate
      Throws:
      AGHttpException - if there is an error with this request
      org.eclipse.rdf4j.repository.RepositoryException
    • getDuplicateStatements

      public org.eclipse.rdf4j.repository.RepositoryResult<org.eclipse.rdf4j.model.Statement> getDuplicateStatements(String comparisonMode) throws org.eclipse.rdf4j.repository.RepositoryException
      Returns all duplicates from the store.

      The comparisonMode determines what will be deemed a "duplicate".

      If comparisonMode is "spog", quad parts (s,p,o,g) will all be compared when looking for duplicates.

      If comparisonMode is "spo", only the (s,p,o) parts will be compared; the same triple in different graphs will thus be deemed duplicates.

      See also the protocol documentation for deleting duplicates

      Parameters:
      comparisonMode - method to determine what is a duplicate
      Returns:
      RepositoryResult the duplicates that exist in the store
      Throws:
      AGHttpException - if there is an error with this request
      org.eclipse.rdf4j.repository.RepositoryException
    • materialize

      public long materialize(AGMaterializer materializer) throws org.eclipse.rdf4j.repository.RepositoryException
      Materializes inferred statements (generates and adds them to the store).

      The materializer's configuration determines how statements are materialized.

      Parameters:
      materializer - the materializer to use
      Returns:
      long the number of statements added
      Throws:
      AGHttpException - if there is an error with this request
      org.eclipse.rdf4j.repository.RepositoryException
      See Also:
    • deleteMaterialized

      public long deleteMaterialized() throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes materialized statements from the default graph.
      Returns:
      the number of statements deleted
      Throws:
      AGHttpException - if there is an error with this request
      org.eclipse.rdf4j.repository.RepositoryException
      See Also:
    • deleteMaterialized

      public long deleteMaterialized(AGMaterializer materializer) throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes materialized statements.
      Parameters:
      materializer - Materializer parameters used to create the triples.
      Returns:
      the number of statements deleted
      Throws:
      AGHttpException - if there is an error with this request
      org.eclipse.rdf4j.repository.RepositoryException
      See Also:
    • deleteMaterialized

      public long deleteMaterialized(org.eclipse.rdf4j.model.Resource inferredGraph) throws org.eclipse.rdf4j.repository.RepositoryException
      Deletes materialized statements from given graph.
      Parameters:
      inferredGraph - Graph to delete the statements from. If null the default graph will be used.
      Returns:
      the number of statements deleted
      Throws:
      AGHttpException - if there is an error with this request
      org.eclipse.rdf4j.repository.RepositoryException
      See Also:
    • setMasqueradeAsUser

      public void setMasqueradeAsUser(String user) throws org.eclipse.rdf4j.repository.RepositoryException
      Sets the AG user for X-Masquerade-As-User requests.

      For AG superusers only. This allows AG superusers to run requests as another user in a dedicated session.

      Parameters:
      user - the user for X-Masquerade-As-User requests
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
    • begin

      public void begin() throws org.eclipse.rdf4j.repository.RepositoryException
      Begins a transaction requiring commit() or rollback() to be called to end the transaction.
      Specified by:
      begin in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
      Since:
      2.7.0
      See Also:
    • isActive

      public boolean isActive()
      Indicates if a transaction is currently active on the connection. A transaction is active if begin() has been called, and becomes inactive after commit() or rollback() has been called.
      Specified by:
      isActive in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Returns:
      true iff a transaction is active, false iff no transaction is active.
      Throws:
      org.eclipse.rdf4j.repository.UnknownTransactionStateException - if the transaction state can not be determined. This can happen for instance when communication with a repository fails or times out.
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
      Since:
      2.7.0
    • clear

      public void clear(org.eclipse.rdf4j.model.Resource... contexts) throws org.eclipse.rdf4j.repository.RepositoryException
      Removes all statement(s) within the specified contexts.
      Specified by:
      clear in interface org.eclipse.rdf4j.repository.RepositoryConnection
      Overrides:
      clear in class org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection
      Parameters:
      contexts - the context(s) to remove the data from. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on the entire repository
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if the statement(s) could not be removed from the repository, for example because the repository is not writable
    • deleteAttributeDefinition

      public void deleteAttributeDefinition(String name) throws org.eclipse.rdf4j.repository.RepositoryException
      Delete an existing triple attribute definition.
      Parameters:
      name - The name of the defined attribute to delete
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
    • getAttributeDefinitions

      public JSONArray getAttributeDefinitions() throws org.eclipse.rdf4j.repository.RepositoryException, JSONException
      Return a list of all attributes defined for the current connection.
      Returns:
      JSONArray of Triple Attribute definitions
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
      JSONException - if there is an error parsing the response to JSON
    • getAttributeDefinition

      public JSONArray getAttributeDefinition(String name) throws org.eclipse.rdf4j.repository.RepositoryException, JSONException
      Return the definition of the attribute named by NAME.
      Parameters:
      name - the attribute definition to lookup
      Returns:
      JSONArray of all found definitions
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
      JSONException - if there is an error parsing the response to JSON
    • getStaticAttributeFilter

      public String getStaticAttributeFilter() throws org.eclipse.rdf4j.repository.RepositoryException
      Fetch the string representation of the static attribute filter defined on this repository
      Returns:
      String, or null if no static filter is defined
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
    • setStaticAttributeFilter

      public void setStaticAttributeFilter(String filter) throws org.eclipse.rdf4j.repository.RepositoryException
      Establish a static attribute filter on the current repository.
      Parameters:
      filter - a String representing a static attribute filter definition
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
    • deleteStaticAttributeFilter

      public void deleteStaticAttributeFilter() throws org.eclipse.rdf4j.repository.RepositoryException
      Delete the static attribute filter defined on this repository.
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
    • getNDGeospatialDatatypeAutomation

      public boolean getNDGeospatialDatatypeAutomation() throws org.eclipse.rdf4j.repository.RepositoryException
      Fetch the status of nD Geospatical Datatype Automation on this repository.
      Returns:
      boolean, true if enabled, false if disabled
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
    • enableNDGeospatialDatatypeAutomation

      public void enableNDGeospatialDatatypeAutomation() throws org.eclipse.rdf4j.repository.RepositoryException
      Enable nD Geospatical Datatype Automation on this repository.
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
    • disableNDGeospatialDatatypeAutomation

      public void disableNDGeospatialDatatypeAutomation() throws org.eclipse.rdf4j.repository.RepositoryException
      Disable nD Geospatical Datatype Automation on this repository.
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if there is an error with this request
    • getUserAttributes

      public String getUserAttributes()
    • setUserAttributes

      public void setUserAttributes(String value)
    • setUserAttributes

      public void setUserAttributes(JSONObject value)
    • setTransactionSettings

      public void setTransactionSettings(TransactionSettings transactionSettings)
      Configure distributed transaction behavior.
      Parameters:
      transactionSettings - Distributed transaction settings.
    • transactionSettingsCtx

      public Ctx transactionSettingsCtx(TransactionSettings transactionSettings)
      A 'context manager' for temporarily changing transaction settings.

      Use it in a try-with-resources block, like this:

      
       try (Ctx ignored = conn.transactionSettingsCtx(newSettings)) {
           // Any explicit or implicit commits here will use new settings
       }
       
      Parameters:
      transactionSettings - New distributed transaction settings.
      Returns:
      A closeable object that can be used in try-with-resources statement. When closed the object will restore old transaction settings.
    • setPool

      public void setPool(AGConnPool pool)
      Sets the connection pool this object will be returned to on close.

      Set to null to make close really shutdown the connection.

      Parameters:
      pool - Connection pool.
    • defineAttribute

      public AGRepositoryConnection.AttributeDefinition defineAttribute(String name)
    • warmup

      public void warmup()
      Asks the server to read store's internal data structures into memory. Use warmup(WarmupConfig) to specify which structures should be read.
    • warmup

      public void warmup(WarmupConfig config)
      Asks the server to read store's internal data structures into memory.
      Parameters:
      config - Config object that can be used to specify which structures should be read into memory. If this parameter is null then the choice will be left to the server.