Franz Inc, AllegroGraph

com.franz.agraph.repository
Class AGRepositoryConnection

java.lang.Object
  extended by org.openrdf.repository.base.RepositoryConnectionBase
      extended by com.franz.agraph.repository.AGRepositoryConnection
All Implemented Interfaces:
Closeable, org.openrdf.repository.RepositoryConnection

public class AGRepositoryConnection
extends org.openrdf.repository.base.RepositoryConnectionBase
implements org.openrdf.repository.RepositoryConnection, Closeable

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.

A session expires when its idle lifetime is exceeded, freeing up server resources. A session lifetime may be extended by calling ping. 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

Constructor Summary
AGRepositoryConnection(AGRepository repository, com.franz.agraph.http.AGHttpRepoClient client)
           
AGRepositoryConnection(AGVirtualRepository repository, com.franz.agraph.http.AGHttpRepoClient client)
           
 
Method Summary
 void add(File file, String baseURI, org.openrdf.rio.RDFFormat dataFormat, org.openrdf.model.Resource... contexts)
          Adds RDF data from the specified file to a specific contexts in the repository.
 void add(InputStream in, String baseURI, org.openrdf.rio.RDFFormat dataFormat, org.openrdf.model.Resource... contexts)
          Adds RDF data from an InputStream to the repository, optionally to one or more named contexts.
 void add(Iterable<? extends org.openrdf.model.Statement> statements, org.openrdf.model.Resource... contexts)
           
<E extends Exception>
void
add(info.aduna.iteration.Iteration<? extends org.openrdf.model.Statement,E> statementIter, org.openrdf.model.Resource... contexts)
           
 void add(Reader reader, String baseURI, org.openrdf.rio.RDFFormat dataFormat, org.openrdf.model.Resource... contexts)
          Adds RDF data from a Reader to the repository, optionally to one or more named contexts.
 void add(org.openrdf.model.Resource subject, org.openrdf.model.URI predicate, org.openrdf.model.Value object, org.openrdf.model.Resource... contexts)
          Adds a statement with the specified subject, predicate and object to this repository, optionally to one or more named contexts.
 void add(org.openrdf.model.Statement st, org.openrdf.model.Resource... contexts)
           
 void add(URL url, String baseURI, org.openrdf.rio.RDFFormat dataFormat, org.openrdf.model.Resource... contexts)
          Adds the RDF data that can be found at the specified URL to the repository, optionally to one or more named contexts.
 void addIndex(String type)
          Adds the given index to the list of actively managed indices.
 void addRules(InputStream rulestream)
          Adds Prolog rules to be used on this connection.
 void addRules(String rules)
          Adds Prolog rules to be used on this connection.
 void addSessionLoadScript(String scriptName)
          Adds a 'script' for a dedicated session spawned by this connection.
 void begin()
          Begins a transaction requiring commit() or rollback() to be called to end the transaction.
 Object callStoredProc(String functionName, String moduleName, Object... args)
          Deprecated. The stored proc feature and API are experimental, and subject to change in a future release.
 void clear(org.openrdf.model.Resource... contexts)
          Removes all statement(s) within the specified contexts.
 void clearMappings()
          Deletes all user-defined predicate and datatype mappings for this connection, and reestablishes the automatic mappings for primitive datatypes.
 void clearMappings(boolean includeAutoEncodedPrimitiveTypes)
          Deletes all predicate and user-defined datatype mappings for this connection.
 void clearNamespaces()
           
 void close()
          Closes the session if there is one started.
 void commit()
          Commit the current transaction.
 void createFreetextIndex(String indexName, AGFreetextIndexConfig config)
          Creates a freetext index with the given name and configuration.
 void createFreetextIndex(String name, org.openrdf.model.URI[] predicates)
          Deprecated.  
<E> org.openrdf.repository.RepositoryResult<E>
createRepositoryResult(Iterable<? extends E> elements)
          Creates a RepositoryResult for the supplied element set.
 void deleteDatatypeMapping(org.openrdf.model.URI datatype)
          Deletes any datatype mapping associated with the given datatype.
 void deleteDuplicates(String comparisonMode)
          Deletes all duplicates from the store.
 void deleteFreetextIndex(String indexName)
          Deletes the freetext index of the specified name.
 long deleteMaterialized()
          Deletes materialized statements.
 void deletePredicateMapping(org.openrdf.model.URI predicate)
          Deletes any predicate mapping associated with the given predicate.
 void deleteSpinFunction(String uri)
           
 void deleteSpinMagicProperty(String uri)
           
 void disableTripleCache()
          Disables the spogi triple cache.
 void dropIndex(String type)
          Drops the given index from the list of actively managed indices.
 void enableTripleCache(long size)
          Enables the spogi cache in this repository.
 String evalInServer(InputStream stream)
          Evaluates a Lisp form on the server, and returns the result as a String.
 String evalInServer(String lispForm)
          Evaluates a Lisp form on the server, and returns the result as a String.
 void exportStatements(org.openrdf.rio.RDFHandler handler, String... ids)
           
 void exportStatements(org.openrdf.model.Resource subj, org.openrdf.model.URI pred, org.openrdf.model.Value obj, boolean includeInferred, org.openrdf.rio.RDFHandler handler, org.openrdf.model.Resource... contexts)
           
 org.openrdf.repository.RepositoryResult<org.openrdf.model.Resource> getContextIDs()
           
 String[] getDatatypeMappings()
          Gets the datatype mappings defined for this connection.
 org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getDuplicateStatements(String comparisonMode)
          Returns all duplicates from the store.
 AGFreetextIndexConfig getFreetextIndexConfig(String indexName)
          Gets the configuration of the specified free text index.
 String[] getFreetextIndices()
          Deprecated.  
 String[] getFreetextPredicates(String index)
          Deprecated.  
 org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getGeoHaversine(org.openrdf.model.URI type, org.openrdf.model.URI predicate, float lat, float lon, float radius, String unit, int limit, boolean infer)
           
 String[] getGeoTypes()
          Gets the Geospatial types that have been registered.
 com.franz.agraph.http.AGHttpRepoClient getHttpRepoClient()
          Returns the lower level HTTP layer for this connection.
 String getNamespace(String prefix)
           
 org.openrdf.repository.RepositoryResult<org.openrdf.model.Namespace> getNamespaces()
           
 String[] getPredicateMappings()
          Gets the predicate mappings defined for this connection.
 AGAbstractRepository getRepository()
           
 int getSessionLifetime()
          Returns the lifetime for a dedicated session spawned by this connection.
 String getSpinFunction(String uri)
           
 String getSpinMagicProperty(String uri)
           
 org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getStatements(org.openrdf.model.Resource subj, org.openrdf.model.URI pred, org.openrdf.model.Value obj, boolean includeInferred, org.openrdf.model.Resource... contexts)
           
 org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getStatements(String... ids)
          Returns statements having the specified ids.
 org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getStatementsInBox(org.openrdf.model.URI type, org.openrdf.model.URI predicate, float xmin, float xmax, float ymin, float ymax, int limit, boolean infer)
           
 org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getStatementsInCircle(org.openrdf.model.URI type, org.openrdf.model.URI predicate, float x, float y, float radius, int limit, boolean infer)
           
 org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getStatementsInPolygon(org.openrdf.model.URI type, org.openrdf.model.URI predicate, org.openrdf.model.URI polygon, int limit, boolean infer)
           
 long getTripleCacheSize()
          Returns the size of the spogi cache.
 int getUploadCommitPeriod()
          Gets the commit period used within large add/load operations.
 AGValueFactory getValueFactory()
           
 boolean isActive()
          Indicates if a transaction is currently active on the connection.
 boolean isAutoCommit()
          Deprecated. since release 2.7.0. Use isActive() instead.
 boolean isStreamResults()
          If true, automatically use AGStreamTupleQuery.
 List<AGFormattedNamespace> listEncodableNamespaces()
          Returns a list of the registered encodable namespaces.
 List<String> listFreetextIndices()
          Lists the freetext indices that have been defined for this repository.
 List<String> listIndices()
          Returns a list of actively managed indices for this repository.
 List<AGSpinFunction> listSpinFunctions()
           
 List<AGSpinMagicProperty> listSpinMagicProperties()
           
 List<String> listValidIndices()
          Returns a list of all possible index types for this repository.
 void load(String absoluteServerPath, String baseURI, org.openrdf.rio.RDFFormat dataFormat, org.openrdf.model.Resource... contexts)
          Instructs the server to load data from the specified server-side path.
 void load(org.openrdf.model.URI source, String baseURI, org.openrdf.rio.RDFFormat dataFormat, org.openrdf.model.Resource... contexts)
          Instructs the server to fetch and load data from the specified URI.
 long materialize(AGMaterializer materializer)
          Materializes inferred statements (generates and adds them to the store).
 void optimizeIndices(Boolean wait)
           
 void optimizeIndices(Boolean wait, int level)
          tells the server to try and optimize the indices for this store.
 void ping()
          Instructs the server to extend the life of this connection's dedicated session, if it is using one.
 AGBooleanQuery prepareBooleanQuery(org.openrdf.query.QueryLanguage ql, String queryString)
           
 AGBooleanQuery prepareBooleanQuery(org.openrdf.query.QueryLanguage ql, String queryString, String baseURI)
           
 AGGraphQuery prepareGraphQuery(org.openrdf.query.QueryLanguage ql, String queryString)
           
 AGGraphQuery prepareGraphQuery(org.openrdf.query.QueryLanguage ql, String queryString, String baseURI)
           
 AGQuery prepareQuery(org.openrdf.query.QueryLanguage ql, String queryString, String baseURI)
          Prepares a AGQuery for evaluation on this repository.
 AGTupleQuery prepareTupleQuery(org.openrdf.query.QueryLanguage ql, String queryString)
           
 AGTupleQuery prepareTupleQuery(org.openrdf.query.QueryLanguage ql, String queryString, String baseURI)
           
 AGUpdate prepareUpdate(org.openrdf.query.QueryLanguage ql, String queryString)
           
 AGUpdate prepareUpdate(org.openrdf.query.QueryLanguage ql, String queryString, String baseURI)
           
 void putSpinFunction(AGSpinFunction fn)
           
 void putSpinMagicProperty(AGSpinMagicProperty fn)
           
 org.openrdf.model.URI registerCartesianType(float stripWidth, float xmin, float xmax, float ymin, float ymax)
          Registers a cartesian type.
 void registerDatatypeMapping(org.openrdf.model.URI datatype, org.openrdf.model.URI primtype)
          Registers a datatype mapping from the datatype to a primitive datatype.
 void registerEncodableNamespace(String namespace, String format)
          Registers an encodable namespace having the specified format.
 void registerEncodableNamespaces(Iterable<? extends AGFormattedNamespace> formattedNamespaces)
          Registers multiple formatted namespaces in a single request.
 void registerPolygon(org.openrdf.model.URI polygon, List<org.openrdf.model.Literal> points)
          Registers a polygon.
 void registerPredicateMapping(org.openrdf.model.URI predicate, org.openrdf.model.URI primtype)
          Registers a predicate mapping from the predicate to a primitive datatype.
 void registerSNAGenerator(String generator, List<org.openrdf.model.URI> objectOfs, List<org.openrdf.model.URI> subjectOfs, List<org.openrdf.model.URI> undirecteds, String query)
          See Social network analysis Lisp documentation and SNA generator registration.
 void registerSNANeighborMatrix(String matrix, String generator, List<org.openrdf.model.URI> group, int depth)
           
 org.openrdf.model.URI registerSphericalType(float stripWidth, String unit)
           
 org.openrdf.model.URI registerSphericalType(float stripWidth, String unit, float latmin, float lonmin, float latmax, float lonmax)
          Registers a spherical type.
 void remove(Iterable<? extends org.openrdf.model.Statement> statements, org.openrdf.model.Resource... contexts)
           
<E extends Exception>
void
remove(info.aduna.iteration.Iteration<? extends org.openrdf.model.Statement,E> statements, org.openrdf.model.Resource... contexts)
           
 void remove(org.openrdf.model.Resource subject, org.openrdf.model.URI predicate, org.openrdf.model.Value object, org.openrdf.model.Resource... contexts)
          Removes the statement(s) with the specified subject, predicate and object from the repository, optionally restricted to the specified contexts.
 void remove(org.openrdf.model.Statement st, org.openrdf.model.Resource... contexts)
           
 void removeNamespace(String prefix)
           
 void rollback()
          Roll back the current transaction (discard all changes made since last commit).
 void sendRDFTransaction(InputStream rdftransaction)
          Executes an application/x-rdftransaction.
 void setAutoCommit(boolean autoCommit)
          Deprecated. As of release 2.7.0, use begin() instead.
 void setMasqueradeAsUser(String user)
          Sets the AG user for X-Masquerade-As-User requests.
 void setNamespace(String prefix, String name)
           
 void setSessionLifetime(int lifetimeInSeconds)
          Sets the 'lifetime' for a dedicated session spawned by this connection.
 void setSessionLoadInitFile(boolean loadInitFile)
          Sets the 'loadInitFile' for a dedicated session spawned by this connection.
 void setStreamResults(boolean streamResults)
          Set to true to automatically use AGStreamTupleQuery for prepareTupleQuery(QueryLanguage, String, String).
 void setUploadCommitPeriod(int period)
          Sets the commit period to use within large add/load operations.
 long size(org.openrdf.model.Resource... contexts)
           
 String toString()
           
 void unregisterEncodableNamespace(String namespace)
          Unregisters the specified encodable namespace.
 
Methods inherited from class org.openrdf.repository.base.RepositoryConnectionBase
export, getParserConfig, hasStatement, hasStatement, isEmpty, isOpen, prepareQuery, setParserConfig
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openrdf.repository.RepositoryConnection
export, getParserConfig, hasStatement, hasStatement, isEmpty, isOpen, prepareQuery, setParserConfig
 

Constructor Detail

AGRepositoryConnection

public AGRepositoryConnection(AGRepository repository,
                              com.franz.agraph.http.AGHttpRepoClient client)
See Also:
AGRepository.getConnection(), AGVirtualRepository.getConnection()

AGRepositoryConnection

public AGRepositoryConnection(AGVirtualRepository repository,
                              com.franz.agraph.http.AGHttpRepoClient client)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getRepository

public AGAbstractRepository getRepository()
Specified by:
getRepository in interface org.openrdf.repository.RepositoryConnection
Overrides:
getRepository in class org.openrdf.repository.base.RepositoryConnectionBase

getHttpRepoClient

public com.franz.agraph.http.AGHttpRepoClient getHttpRepoClient()
Returns the lower level HTTP layer for this connection.


getValueFactory

public AGValueFactory getValueFactory()
Specified by:
getValueFactory in interface org.openrdf.repository.RepositoryConnection
Overrides:
getValueFactory in class org.openrdf.repository.base.RepositoryConnectionBase

add

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

add

public <E extends Exception> void add(info.aduna.iteration.Iteration<? extends org.openrdf.model.Statement,E> statementIter,
                                      org.openrdf.model.Resource... contexts)
         throws org.openrdf.repository.RepositoryException,
                E extends Exception
Specified by:
add in interface org.openrdf.repository.RepositoryConnection
Overrides:
add in class org.openrdf.repository.base.RepositoryConnectionBase
Throws:
org.openrdf.repository.RepositoryException
E extends Exception

add

public void add(File file,
                String baseURI,
                org.openrdf.rio.RDFFormat dataFormat,
                org.openrdf.model.Resource... contexts)
         throws IOException,
                org.openrdf.rio.RDFParseException,
                org.openrdf.repository.RepositoryException
Adds RDF data from the specified file to a specific contexts in the repository.

Specified by:
add in interface org.openrdf.repository.RepositoryConnection
Overrides:
add in class org.openrdf.repository.base.RepositoryConnectionBase
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 without 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.openrdf.rio.UnsupportedRDFormatException - If no parser is available for the specified RDF format.
org.openrdf.rio.RDFParseException - If an error was found while parsing the RDF data.
org.openrdf.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.openrdf.rio.RDFFormat dataFormat,
                org.openrdf.model.Resource... contexts)
         throws IOException,
                org.openrdf.rio.RDFParseException,
                org.openrdf.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.openrdf.repository.RepositoryConnection
Overrides:
add in class org.openrdf.repository.base.RepositoryConnectionBase
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.openrdf.rio.UnsupportedRDFormatException - If no parser is available for the specified RDF format.
org.openrdf.rio.RDFParseException - If an error was found while parsing the RDF data.
org.openrdf.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.openrdf.rio.RDFFormat dataFormat,
                org.openrdf.model.Resource... contexts)
         throws IOException,
                org.openrdf.rio.RDFParseException,
                org.openrdf.repository.RepositoryException
Adds RDF data from an InputStream to the repository, optionally to one or more named contexts.

Specified by:
add in interface org.openrdf.repository.RepositoryConnection
Overrides:
add in class org.openrdf.repository.base.RepositoryConnectionBase
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.openrdf.rio.UnsupportedRDFormatException - If no parser is available for the specified RDF format.
org.openrdf.rio.RDFParseException - If an error was found while parsing the RDF data.
org.openrdf.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.openrdf.rio.RDFFormat dataFormat,
                org.openrdf.model.Resource... contexts)
         throws IOException,
                org.openrdf.rio.RDFParseException,
                org.openrdf.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.openrdf.repository.RepositoryConnection
Overrides:
add in class org.openrdf.repository.base.RepositoryConnectionBase
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 - 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.openrdf.rio.UnsupportedRDFormatException - If no parser is available for the specified RDF format.
org.openrdf.rio.RDFParseException - If an error was found while parsing the RDF data.
org.openrdf.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.openrdf.model.Resource subject,
                org.openrdf.model.URI predicate,
                org.openrdf.model.Value object,
                org.openrdf.model.Resource... contexts)
         throws org.openrdf.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.openrdf.repository.RepositoryConnection
Overrides:
add in class org.openrdf.repository.base.RepositoryConnectionBase
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 without 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.openrdf.repository.RepositoryException - If the data could not be added to the repository, for example because the repository is not writable.

remove

public void remove(org.openrdf.model.Resource subject,
                   org.openrdf.model.URI predicate,
                   org.openrdf.model.Value object,
                   org.openrdf.model.Resource... contexts)
            throws org.openrdf.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.openrdf.repository.RepositoryConnection
Overrides:
remove in class org.openrdf.repository.base.RepositoryConnectionBase
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.openrdf.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.openrdf.model.Statement st,
                   org.openrdf.model.Resource... contexts)
            throws org.openrdf.repository.RepositoryException
Specified by:
remove in interface org.openrdf.repository.RepositoryConnection
Overrides:
remove in class org.openrdf.repository.base.RepositoryConnectionBase
Throws:
org.openrdf.repository.RepositoryException

add

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

remove

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

remove

public <E extends Exception> void remove(info.aduna.iteration.Iteration<? extends org.openrdf.model.Statement,E> statements,
                                         org.openrdf.model.Resource... contexts)
            throws org.openrdf.repository.RepositoryException,
                   E extends Exception
Specified by:
remove in interface org.openrdf.repository.RepositoryConnection
Overrides:
remove in class org.openrdf.repository.base.RepositoryConnectionBase
Throws:
org.openrdf.repository.RepositoryException
E extends Exception

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws org.openrdf.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.openrdf.repository.RepositoryConnection
Overrides:
setAutoCommit in class org.openrdf.repository.base.RepositoryConnectionBase
Throws:
org.openrdf.repository.RepositoryException

isAutoCommit

public boolean isAutoCommit()
                     throws org.openrdf.repository.RepositoryException
Deprecated. since release 2.7.0. Use isActive() instead.

Specified by:
isAutoCommit in interface org.openrdf.repository.RepositoryConnection
Overrides:
isAutoCommit in class org.openrdf.repository.base.RepositoryConnectionBase
Throws:
org.openrdf.repository.RepositoryException
See Also:
setAutoCommit(boolean)

commit

public void commit()
            throws org.openrdf.repository.RepositoryException
Commit the current transaction. See session overview and POST commit for more details.

Specified by:
commit in interface org.openrdf.repository.RepositoryConnection
Throws:
org.openrdf.repository.RepositoryException

rollback

public void rollback()
              throws org.openrdf.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.openrdf.repository.RepositoryConnection
Throws:
org.openrdf.repository.RepositoryException

setStreamResults

public void setStreamResults(boolean streamResults)
Set to true to automatically use AGStreamTupleQuery for prepareTupleQuery(QueryLanguage, String, String).

See Also:
isStreamResults()

isStreamResults

public boolean isStreamResults()
If true, automatically use AGStreamTupleQuery. Default is false.

See Also:
setStreamResults(boolean)

clearNamespaces

public void clearNamespaces()
                     throws org.openrdf.repository.RepositoryException
Specified by:
clearNamespaces in interface org.openrdf.repository.RepositoryConnection
Throws:
org.openrdf.repository.RepositoryException

close

public void close()
           throws org.openrdf.repository.RepositoryException
Closes the session if there is one started. See session overview and POST close for more details.

Specified by:
close in interface Closeable
Specified by:
close in interface org.openrdf.repository.RepositoryConnection
Overrides:
close in class org.openrdf.repository.base.RepositoryConnectionBase
Throws:
org.openrdf.repository.RepositoryException
See Also:
Closeable.close()

exportStatements

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

exportStatements

public void exportStatements(org.openrdf.rio.RDFHandler handler,
                             String... ids)
                      throws org.openrdf.rio.RDFHandlerException,
                             org.openrdf.repository.RepositoryException
Throws:
org.openrdf.rio.RDFHandlerException
org.openrdf.repository.RepositoryException

getContextIDs

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

createRepositoryResult

public <E> org.openrdf.repository.RepositoryResult<E> createRepositoryResult(Iterable<? extends E> elements)
Creates a RepositoryResult for the supplied element set.


getNamespace

public String getNamespace(String prefix)
                    throws org.openrdf.repository.RepositoryException
Specified by:
getNamespace in interface org.openrdf.repository.RepositoryConnection
Throws:
org.openrdf.repository.RepositoryException

getNamespaces

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

getStatements

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

getStatements

public org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getStatements(String... ids)
                                                                                   throws org.openrdf.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.openrdf.repository.RepositoryException

prepareQuery

public AGQuery prepareQuery(org.openrdf.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.openrdf.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.openrdf.query.QueryLanguage ql,
                                      String queryString)
Specified by:
prepareTupleQuery in interface org.openrdf.repository.RepositoryConnection
Overrides:
prepareTupleQuery in class org.openrdf.repository.base.RepositoryConnectionBase

prepareTupleQuery

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

prepareGraphQuery

public AGGraphQuery prepareGraphQuery(org.openrdf.query.QueryLanguage ql,
                                      String queryString)
Specified by:
prepareGraphQuery in interface org.openrdf.repository.RepositoryConnection
Overrides:
prepareGraphQuery in class org.openrdf.repository.base.RepositoryConnectionBase

prepareGraphQuery

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

prepareBooleanQuery

public AGBooleanQuery prepareBooleanQuery(org.openrdf.query.QueryLanguage ql,
                                          String queryString)
Specified by:
prepareBooleanQuery in interface org.openrdf.repository.RepositoryConnection
Overrides:
prepareBooleanQuery in class org.openrdf.repository.base.RepositoryConnectionBase

prepareBooleanQuery

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

prepareUpdate

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

prepareUpdate

public AGUpdate prepareUpdate(org.openrdf.query.QueryLanguage ql,
                              String queryString)
Specified by:
prepareUpdate in interface org.openrdf.repository.RepositoryConnection
Overrides:
prepareUpdate in class org.openrdf.repository.base.RepositoryConnectionBase

removeNamespace

public void removeNamespace(String prefix)
                     throws org.openrdf.repository.RepositoryException
Specified by:
removeNamespace in interface org.openrdf.repository.RepositoryConnection
Throws:
org.openrdf.repository.RepositoryException

setNamespace

public void setNamespace(String prefix,
                         String name)
                  throws org.openrdf.repository.RepositoryException
Specified by:
setNamespace in interface org.openrdf.repository.RepositoryConnection
Throws:
org.openrdf.repository.RepositoryException

size

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

createFreetextIndex

public void createFreetextIndex(String indexName,
                                AGFreetextIndexConfig config)
                         throws org.openrdf.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.openrdf.repository.RepositoryException
See Also:
AGFreetextIndexConfig.newInstance()

deleteFreetextIndex

public void deleteFreetextIndex(String indexName)
                         throws org.openrdf.repository.RepositoryException
Deletes the freetext index of the specified name.

Throws:
org.openrdf.repository.RepositoryException
See Also:
createFreetextIndex(String, AGFreetextIndexConfig)

createFreetextIndex

public void createFreetextIndex(String name,
                                org.openrdf.model.URI[] predicates)
                         throws org.openrdf.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.

Throws:
org.openrdf.repository.RepositoryException
See Also:
createFreetextIndex(String, AGFreetextIndexConfig)

getFreetextPredicates

public String[] getFreetextPredicates(String index)
                               throws org.openrdf.repository.RepositoryException
Deprecated. 

Gets the predicates that have been registered for text indexing.

Throws:
org.openrdf.repository.RepositoryException
See Also:
getFreetextIndexConfig(String)

getFreetextIndexConfig

public AGFreetextIndexConfig getFreetextIndexConfig(String indexName)
                                             throws org.openrdf.repository.RepositoryException
Gets the configuration of the specified free text index.

Throws:
org.openrdf.repository.RepositoryException

getFreetextIndices

public String[] getFreetextIndices()
                            throws org.openrdf.repository.RepositoryException
Deprecated. 

Gets freetext indexes that have been created

Throws:
org.openrdf.repository.RepositoryException
See Also:
listFreetextIndices()

listFreetextIndices

public List<String> listFreetextIndices()
                                 throws org.openrdf.repository.RepositoryException
Lists the freetext indices that have been defined for this repository.

Returns:
a list of freetext index names
Throws:
org.openrdf.repository.RepositoryException

registerPredicateMapping

public void registerPredicateMapping(org.openrdf.model.URI predicate,
                                     org.openrdf.model.URI primtype)
                              throws org.openrdf.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 XMLSchema.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 - datatype URI
Throws:
org.openrdf.repository.RepositoryException
See Also:
getPredicateMappings()

deletePredicateMapping

public void deletePredicateMapping(org.openrdf.model.URI predicate)
                            throws org.openrdf.repository.RepositoryException
Deletes any predicate mapping associated with the given predicate.

See mapping overview and DELETE predicate mapping.

Parameters:
predicate - the predicate
Throws:
org.openrdf.repository.RepositoryException
See Also:
getPredicateMappings()

getPredicateMappings

public String[] getPredicateMappings()
                              throws org.openrdf.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.

Throws:
org.openrdf.repository.RepositoryException
See Also:
registerPredicateMapping(URI, URI), deletePredicateMapping(URI), getDatatypeMappings()

registerDatatypeMapping

public void registerDatatypeMapping(org.openrdf.model.URI datatype,
                                    org.openrdf.model.URI primtype)
                             throws org.openrdf.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 XMLSchema.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 user datatype
primtype - the primitive type
Throws:
org.openrdf.repository.RepositoryException
See Also:
getDatatypeMappings()

deleteDatatypeMapping

public void deleteDatatypeMapping(org.openrdf.model.URI datatype)
                           throws org.openrdf.repository.RepositoryException
Deletes any datatype mapping associated with the given datatype.

See mapping overview and DELETE type mapping.

Parameters:
datatype - the user datatype
Throws:
org.openrdf.repository.RepositoryException
See Also:
getDatatypeMappings(), clearMappings()

getDatatypeMappings

public String[] getDatatypeMappings()
                             throws org.openrdf.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.

Throws:
org.openrdf.repository.RepositoryException
See Also:
deleteDatatypeMapping(URI), clearMappings(), registerDatatypeMapping(URI, URI), getPredicateMappings()

clearMappings

public void clearMappings()
                   throws org.openrdf.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.openrdf.repository.RepositoryException
See Also:
getDatatypeMappings(), getPredicateMappings()

clearMappings

public void clearMappings(boolean includeAutoEncodedPrimitiveTypes)
                   throws org.openrdf.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.

Throws:
org.openrdf.repository.RepositoryException
See Also:
getDatatypeMappings(), getPredicateMappings()

addRules

public void addRules(String rules)
              throws org.openrdf.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.openrdf.repository.RepositoryException
See Also:
addRules(InputStream)

addRules

public void addRules(InputStream rulestream)
              throws org.openrdf.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.openrdf.repository.RepositoryException
See Also:
addRules(String)

evalInServer

public String evalInServer(String lispForm)
                    throws org.openrdf.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:
the result in a String
Throws:
org.openrdf.repository.RepositoryException
See Also:
evalInServer(String)

evalInServer

public String evalInServer(InputStream stream)
                    throws org.openrdf.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.openrdf.repository.RepositoryException
See Also:
evalInServer(String)

load

public void load(org.openrdf.model.URI source,
                 String baseURI,
                 org.openrdf.rio.RDFFormat dataFormat,
                 org.openrdf.model.Resource... contexts)
          throws org.openrdf.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.openrdf.repository.RepositoryException

load

public void load(String absoluteServerPath,
                 String baseURI,
                 org.openrdf.rio.RDFFormat dataFormat,
                 org.openrdf.model.Resource... contexts)
          throws org.openrdf.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.openrdf.repository.RepositoryException

ping

public void ping()
          throws org.openrdf.repository.RepositoryException
Instructs the server to extend the life of this connection's dedicated session, if it is using one. Such connections that are idle for its session lifetime will be closed by the server.

See session overview and GET ping for more details.

Throws:
org.openrdf.repository.RepositoryException
See Also:
setSessionLifetime(int)

getGeoTypes

public String[] getGeoTypes()
                     throws org.openrdf.repository.RepositoryException
Gets the Geospatial types that have been registered.

Throws:
org.openrdf.repository.RepositoryException

registerCartesianType

public org.openrdf.model.URI registerCartesianType(float stripWidth,
                                                   float xmin,
                                                   float xmax,
                                                   float ymin,
                                                   float ymax)
                                            throws org.openrdf.repository.RepositoryException
Registers a cartesian type.

Throws:
org.openrdf.repository.RepositoryException

registerSphericalType

public org.openrdf.model.URI registerSphericalType(float stripWidth,
                                                   String unit,
                                                   float latmin,
                                                   float lonmin,
                                                   float latmax,
                                                   float lonmax)
                                            throws org.openrdf.repository.RepositoryException
Registers a spherical type.

Throws:
org.openrdf.repository.RepositoryException

registerSphericalType

public org.openrdf.model.URI registerSphericalType(float stripWidth,
                                                   String unit)
                                            throws org.openrdf.repository.RepositoryException
Throws:
org.openrdf.repository.RepositoryException

registerPolygon

public void registerPolygon(org.openrdf.model.URI polygon,
                            List<org.openrdf.model.Literal> points)
                     throws org.openrdf.repository.RepositoryException
Registers a polygon.

Throws:
org.openrdf.repository.RepositoryException

getStatementsInBox

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

getStatementsInCircle

public org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getStatementsInCircle(org.openrdf.model.URI type,
                                                                                                  org.openrdf.model.URI predicate,
                                                                                                  float x,
                                                                                                  float y,
                                                                                                  float radius,
                                                                                                  int limit,
                                                                                                  boolean infer)
                                                                                           throws org.openrdf.repository.RepositoryException
Throws:
org.openrdf.repository.RepositoryException

getGeoHaversine

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

getStatementsInPolygon

public org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getStatementsInPolygon(org.openrdf.model.URI type,
                                                                                                   org.openrdf.model.URI predicate,
                                                                                                   org.openrdf.model.URI polygon,
                                                                                                   int limit,
                                                                                                   boolean infer)
                                                                                            throws org.openrdf.repository.RepositoryException
Throws:
org.openrdf.repository.RepositoryException

registerSNAGenerator

public void registerSNAGenerator(String generator,
                                 List<org.openrdf.model.URI> objectOfs,
                                 List<org.openrdf.model.URI> subjectOfs,
                                 List<org.openrdf.model.URI> undirecteds,
                                 String query)
                          throws org.openrdf.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 -
objectOfs -
subjectOfs -
undirecteds -
query -
Throws:
org.openrdf.repository.RepositoryException

registerSNANeighborMatrix

public void registerSNANeighborMatrix(String matrix,
                                      String generator,
                                      List<org.openrdf.model.URI> group,
                                      int depth)
                               throws org.openrdf.repository.RepositoryException
Throws:
org.openrdf.repository.RepositoryException

listIndices

public List<String> listIndices()
                         throws org.openrdf.OpenRDFException
Returns a list of actively managed indices for this repository.

Returns:
a list of actively managed indices for this repository.
Throws:
org.openrdf.OpenRDFException

listValidIndices

public List<String> listValidIndices()
                              throws org.openrdf.OpenRDFException
Returns a list of all possible index types for this repository.

Returns:
a list of valid index types
Throws:
org.openrdf.OpenRDFException

addIndex

public void addIndex(String type)
              throws org.openrdf.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.openrdf.repository.RepositoryException
See Also:
listValidIndices()

dropIndex

public void dropIndex(String type)
               throws org.openrdf.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.openrdf.repository.RepositoryException
See Also:
listValidIndices()

sendRDFTransaction

public void sendRDFTransaction(InputStream rdftransaction)
                        throws org.openrdf.repository.RepositoryException,
                               org.openrdf.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.openrdf.repository.RepositoryException
org.openrdf.rio.RDFParseException
IOException

registerEncodableNamespace

public void registerEncodableNamespace(String namespace,
                                       String format)
                                throws org.openrdf.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.openrdf.repository.RepositoryException
See Also:
registerEncodableNamespaces(Iterable), listEncodableNamespaces(), unregisterEncodableNamespace(String), AGValueFactory.generateURI(String), AGValueFactory.generateURIs(String, int)

registerEncodableNamespaces

public void registerEncodableNamespaces(Iterable<? extends AGFormattedNamespace> formattedNamespaces)
                                 throws org.openrdf.repository.RepositoryException
Registers multiple formatted namespaces in a single request.

Throws:
org.openrdf.repository.RepositoryException
See Also:
registerEncodableNamespace(String, String)

listEncodableNamespaces

public List<AGFormattedNamespace> listEncodableNamespaces()
                                                   throws org.openrdf.OpenRDFException
Returns a list of the registered encodable namespaces.

Returns:
a list of the registered encodable namespaces
Throws:
org.openrdf.OpenRDFException
See Also:
registerEncodableNamespace(String, String)

unregisterEncodableNamespace

public void unregisterEncodableNamespace(String namespace)
                                  throws org.openrdf.repository.RepositoryException
Unregisters the specified encodable namespace.

Parameters:
namespace - the namespace to unregister
Throws:
org.openrdf.repository.RepositoryException
See Also:
registerEncodableNamespace(String, String)

callStoredProc

public Object callStoredProc(String functionName,
                             String moduleName,
                             Object... args)
                      throws org.openrdf.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 getHttpRepoClient().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:
com.franz.agraph.http.exception.AGCustomStoredProcException - for errors from stored proc
org.openrdf.repository.RepositoryException
Since:
v4.2

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. This method does not create a session.

See session overview and POST session for more details.

Parameters:
lifetimeInSeconds - the session lifetime, in seconds.
See Also:
getSessionLifetime(), ping()

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(int), ping()

setSessionLoadInitFile

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

loadInitFile is a boolean, defaulting to false, which determines whether the initfile is loaded into this session.

See also: Session overview.

See Also:
addSessionLoadScript(String)

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.

See Also:
setSessionLoadInitFile(boolean)

enableTripleCache

public void enableTripleCache(long size)
                       throws org.openrdf.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.openrdf.repository.RepositoryException

getTripleCacheSize

public long getTripleCacheSize()
                        throws org.openrdf.repository.RepositoryException
Returns the size of the spogi cache.

Returns:
the size of the spogi cache, in triples.
Throws:
org.openrdf.repository.RepositoryException

disableTripleCache

public void disableTripleCache()
                        throws org.openrdf.repository.RepositoryException
Disables the spogi triple cache.

Throws:
org.openrdf.repository.RepositoryException

setUploadCommitPeriod

public void setUploadCommitPeriod(int period)
                           throws org.openrdf.repository.RepositoryException
Sets the commit period to use within large add/load operations.

Parameters:
period - commit after this many statements
Throws:
org.openrdf.repository.RepositoryException
See Also:
AGHttpRepoClient.setUploadCommitPeriod(int)

getUploadCommitPeriod

public int getUploadCommitPeriod()
                          throws org.openrdf.repository.RepositoryException
Gets the commit period used within large add/load operations.

Throws:
org.openrdf.repository.RepositoryException
See Also:
AGHttpRepoClient.getUploadCommitPeriod()

optimizeIndices

public void optimizeIndices(Boolean wait,
                            int level)
                     throws org.openrdf.repository.RepositoryException
tells the server to try and optimize the indices for this store.

Parameters:
wait - is 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.openrdf.repository.RepositoryException

optimizeIndices

public void optimizeIndices(Boolean wait)
                     throws org.openrdf.repository.RepositoryException
Throws:
org.openrdf.repository.RepositoryException

getSpinFunction

public String getSpinFunction(String uri)
                       throws org.openrdf.OpenRDFException
Parameters:
uri - spin function identifier
Returns:
spin function query text
Throws:
org.openrdf.OpenRDFException
Since:
v4.4
See Also:
putSpinFunction(AGSpinFunction), deleteSpinFunction(String), listSpinFunctions(), getSpinMagicProperty(String)

listSpinFunctions

public List<AGSpinFunction> listSpinFunctions()
                                       throws org.openrdf.OpenRDFException
Throws:
org.openrdf.OpenRDFException
Since:
v4.4
See Also:
getSpinFunction(String), putSpinFunction(AGSpinFunction), deleteSpinFunction(String), listSpinMagicProperties()

putSpinFunction

public void putSpinFunction(AGSpinFunction fn)
                     throws org.openrdf.OpenRDFException
Throws:
org.openrdf.OpenRDFException
Since:
v4.4
See Also:
getSpinFunction(String), deleteSpinFunction(String), putSpinMagicProperty(AGSpinMagicProperty)

deleteSpinFunction

public void deleteSpinFunction(String uri)
                        throws org.openrdf.OpenRDFException
Parameters:
uri - spin function identifier
Throws:
org.openrdf.OpenRDFException
Since:
v4.4
See Also:
putSpinFunction(AGSpinFunction), getSpinFunction(String)

getSpinMagicProperty

public String getSpinMagicProperty(String uri)
                            throws org.openrdf.OpenRDFException
Parameters:
uri - spin magic property identifier
Returns:
sparqlQuery
Throws:
org.openrdf.OpenRDFException
Since:
v4.4
See Also:
putSpinMagicProperty(AGSpinMagicProperty), deleteSpinMagicProperty(String)

listSpinMagicProperties

public List<AGSpinMagicProperty> listSpinMagicProperties()
                                                  throws org.openrdf.OpenRDFException
Throws:
org.openrdf.OpenRDFException
Since:
v4.4
See Also:
getSpinMagicProperty(String), putSpinMagicProperty(AGSpinMagicProperty), deleteSpinMagicProperty(String), listSpinFunctions()

deleteSpinMagicProperty

public void deleteSpinMagicProperty(String uri)
                             throws org.openrdf.OpenRDFException
Parameters:
uri - spin magic property identifier
Throws:
org.openrdf.OpenRDFException
Since:
v4.4
See Also:
putSpinMagicProperty(AGSpinMagicProperty), getSpinMagicProperty(String)

putSpinMagicProperty

public void putSpinMagicProperty(AGSpinMagicProperty fn)
                          throws org.openrdf.OpenRDFException
Throws:
org.openrdf.OpenRDFException
Since:
v4.4
See Also:
getSpinMagicProperty(String), deleteSpinMagicProperty(String), putSpinFunction(AGSpinFunction)

deleteDuplicates

public void deleteDuplicates(String comparisonMode)
                      throws org.openrdf.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 - determines what is a duplicate
Throws:
com.franz.agraph.http.exception.AGHttpException
org.openrdf.repository.RepositoryException

getDuplicateStatements

public org.openrdf.repository.RepositoryResult<org.openrdf.model.Statement> getDuplicateStatements(String comparisonMode)
                                                                                            throws org.openrdf.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 - determines what is a duplicate
Throws:
com.franz.agraph.http.exception.AGHttpException
org.openrdf.repository.RepositoryException

materialize

public long materialize(AGMaterializer materializer)
                 throws org.openrdf.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:
the number of statements added.
Throws:
com.franz.agraph.http.exception.AGHttpException
org.openrdf.repository.RepositoryException
See Also:
AGMaterializer.newInstance()

deleteMaterialized

public long deleteMaterialized()
                        throws org.openrdf.repository.RepositoryException
Deletes materialized statements.

Returns:
the number of statements deleted.
Throws:
com.franz.agraph.http.exception.AGHttpException
org.openrdf.repository.RepositoryException
See Also:
materialize(AGMaterializer)

setMasqueradeAsUser

public void setMasqueradeAsUser(String user)
                         throws org.openrdf.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.openrdf.repository.RepositoryException

begin

public void begin()
           throws org.openrdf.repository.RepositoryException
Begins a transaction requiring commit() or rollback() to be called to end the transaction.

Specified by:
begin in interface org.openrdf.repository.RepositoryConnection
Throws:
org.openrdf.repository.RepositoryException
Since:
2.7.0
See Also:
isActive(), commit(), rollback()

isActive

public boolean isActive()
                 throws org.openrdf.repository.UnknownTransactionStateException,
                        org.openrdf.repository.RepositoryException
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.openrdf.repository.RepositoryConnection
Returns:
true iff a transaction is active, false iff no transaction is active.
Throws:
org.openrdf.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.openrdf.repository.RepositoryException
Since:
2.7.0

clear

public void clear(org.openrdf.model.Resource... contexts)
           throws org.openrdf.repository.RepositoryException
Removes all statement(s) within the specified contexts.

Specified by:
clear in interface org.openrdf.repository.RepositoryConnection
Overrides:
clear in class org.openrdf.repository.base.RepositoryConnectionBase
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.openrdf.repository.RepositoryException - If the statement(s) could not be removed from the repository, for example because the repository is not writable.

Copyright © 2008-2012 Franz Inc.