Class AGRepositoryConnection

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

public class AGRepositoryConnection extends AbstractRepositoryConnection implements 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