Anzo Client Abstract API
This document provides a normative definition of the Anzo Client developer-facing API. The document is intended to be language and platform neutral, though certain notations and presentations may resemble a particular language. Complete implementation details are left out though certain points are important for understanding how the API works.
The document is seperated into rough sections of the API. Each section contains descriptions of each object's logical properties, methods and events. In certain platforms, these may be embodied as methods, event handlers, or seperate objects. For example, in Java, properties are typically accessed through accessor methods, and event handlers are implemented by registering an implementation of a specific interface with the object.
Anzo Node API
This is an abreviated description of the complete RDF node API, containing the importants parts that most users of the Anzo client API will use. The platform specific version of the API may contain additional members or vary slightly. For example, the Anzo.java RDF Node hierarcy contains additional members because of Glitter (our SPARQL query engine component).
Value - The top level object in the RDFNode hierarchy
Properties
Methods
toString - returns a string representation of this value
Events
Resource - a resource node in an RDF graph
Derived from Value
Properties
Methods
Events
URI - a uri resource
Derived from Resource
Properties
uri - the URI string
Methods
Events
BNode - a blank node in an RDF graph
Derived from Resource
Properties
nodeId - the id of the blank node
Methods
Events
Literal - a literal node in an RDF graph
Derived from Value
Properties
value - the value of the literal
Methods
Events
TypedLiteral - a typed literal node in an RDF graph
Derived from Literal
Properties
datatype - the datatype of the literal
Methods
Events
PlainLiteral - a plain literal node in an RDF graph
Derived from Literal
Properties
lang - the language of the literal
Methods
Events
Statement - The basic element of an RDF graph, contains four components
Properties
subject (Resource) - The subject of the statement
predicate (URI) - The predicate of the statement
object (Value) - The object of the statement
namedGraphUri (URI) - The uri of the named graph this statement belongs to
Methods
Events
Named Graphs and events
The named graph is object through which the developer accesses RDF data.
INamedGraph - A named graph of Statement's. Each Statement contained in the named graph must have the same namedGraphUri as the named graph.
Properties
uri (URI) - the uri of this named graph
Methods
getStatements - retrieve all the statements in this named graph
return - an unmodifiable collection or iterator of Statement
find - find statements in the graph by triple pattern
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
return - an unmodifiable collection or iterator of Statement
contains - determine if a statement or pattern of statments exists in the named graph
Form 1 - triple pattern
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
Form 2 - individual statement
statement (Statement) - the statement to check
return - boolean
add - add a statement or set of statements to the named graph
Form 1 - individual statement object
statement (Statement) - the statement to add
Form 2 - individual statement by component
subject (Resource) - may not be null
predicate (URI) - may not be null
object (Value) - may not be null
Form 3 - bulk add, this may expand to multiple forms as deemed convenient per platform
statements - (collection or iterator of Statement)
remove - remove a statement or set of statements from the named graph
Form 1 - individual statement object
statement (Statement) - the statement to remove
Form 2 - individual statement by component
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
Form 3 - bulk remove, this may expand to multiple forms as deemed convenient per platform
statements - (collection or iterator of Statement)
clear - remove all statements from the named graph
size - determine the number of statements in the graph
return - int the number of statements in the named graph
isEmpty - determine whether or not the named graph is empty (contains no statements)
return - boolean
close - close the graph. Once the named graph object is closed, no further operations may be performed on the graph
isClosed - determine whether or not the named graph has been closed
return - boolean
Events
StatementUpdateEvent - fired when the named graph is modified. The semantics and timing of when the event is fired depends on the implementation of INamedGraph as well as the contianer, such as AnzoClient managing the named graph.
IAnzoGraph - A simple extension of INamedGraph that contains a metadata graph.
Derived from INamedGraph
Properties
Methods'
getMetadataGraph (INamedGraph) - Return a graph containing the metadata for this named graph.
Events
IQuadStore - A quad store stores full quad statements much like the INamedGraph, however the corresponding operations such as add and find require a fourth parameter namedGraphUri. The IQuadStore interface is not directly exposed through the Anzo API, though it is used heavily internally, and surfaces from time to time on the fringe. In addition, platform specific, simple in-memory implementations of IQuadStore may be useful to the developer in manipulating RDF statements outside the scope of AnzoClient.
Properties
Methods
getNamedGraphUris - return the set of URIs for all named graphs within the quad store
getStatements - retrieve all the statements in this quad store
return - an unmodifiable collection or iterator of Statement
find - find statements in the quad store by quad pattern
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
namedGraphUri (Value) - may be null to indicate a wildcard
return - an unmodifiable collection or iterator of Statement
contains - determine if a statement or pattern of statments exists in the quad store
Form 1 - triple pattern
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
namedGraphUri (Value) - may be null to indicate a wildcard
Form 2 - individual statement
statement (Statement) - the statement to check
return - boolean
add - add a statement or set of statements to the quad store
Form 1 - individual statement object
statement (Statement) - the statement to add
Form 2 - individual statement by component
subject (Resource) - may not be null
predicate (URI) - may not be null
object (Value) - may not be null
namedGraphUri (URI) - may not be null
Form 3 - bulk add, this may expand to multiple forms as deemed convenient per platform
statements - (collection or iterator of Statement)
remove - remove a statement or set of statements from the quad store
Form 1 - individual statement object
statement (Statement) - the statement to remove
Form 2 - individual statement by component
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
namedGraphUri (URI) - may be null to indicate a wildcard
Form 3 - bulk remove, this may expand to multiple forms as deemed convenient per platform
statements - (collection or iterator of Statement)
clear - remove all statements from the named quad store
size - determine the number of statements in the quad store
Form 1 - determine the number of statements in the entire quad store
Form 2 - determine the number of statements in the quad store for a subset of named graphs within the store
namedGraphUris (collection of URI) - The collection of name graph URIs for the query.
return - int the number of statements in the named graph
isEmpty - determine whether or not the quad store is empty (contains no statements)
return - boolean
executeQuery -
defaultNamedGraphUris (collection of URI) - The collection of named graph URIs that make up the background graph for the query
namedGraphUris (collection of URI) - The collection of name graph URIs for the query.
namedDatasets (collection of URI) - The collection of URIs of named datasets whose named and default graphs should be included in the query. The datasets must be defined in this quad store itself, according to the Dataset ontology.
query (String) - The Sparql query string
baseUri (URI) - The base URI for URIs in the query.
return QueryResults
Events
IDataset - The dataset is a programming construct that closely models the Sparql dataset. The dataset contains a list of named graph URIs and a list of default graph URIs. In addition, the dataset exposes an INamedGraph instance for each such URI, sharing instances where the two sets overlap. The IDataset interface exposes methods for adding and removing named and default graph URIs, as well as accessing the INamedGraph instances. The dataset also offers the complete IQuadStore API for accessing, querying, and modifying the statements stored across all graphs within the dataset. IDataset implementations must also expose a graph containing the RDF serialization of the default and named graph URIs in the dataset, according to the Anzo dataset ontology.
Generally speaking, implementations of IDataset are responsible for creating and maintaining the lifecycle of INamedGraph instances. However, certain implementations may wish to allow additions of INamedGraph instances directly.
Derived from IQuadStore
Properties
datasetUri - the URI of the dataset.
Methods
getDatasetGraph - get the graph containing the RDF representation of the dataset, conforming to the Anzo dataset ontology.
return INamedGraph
addNamedGraph - Add a named graph to the dataset, given its URI.
namedGraphUri (URI) - the URI of the named graph
return INamedGraph - the instance of INamedGraph created for the named graph
setNamedGraphs - sets the named graphs of the dataset to the given collection of URIs. All existing named graphs will be removed. Each corresponding INamedGraph instance will be closed if no corresponding default graph exists in the dataset.
namedGraphUris (collection of URI) - the named graph URIs to set
getNamedGraph - get a named graph instance for the given named graph URI, Returns null if the name graph does not exist in the dataset
namedGraphUri (URI) - the URI of the named graph
return INamedGraph - the instance of INamedGraph created for the named graph
getNamedGraphUris - the URIs of all named graphs in the dataset
return collection of URI
containsNamedGraph - Determine if the given named graph exists in the dataset
namedGraphUri (URI) - the URI of the named graph
removeNamedGraph - remove the given named graph from the dataset. The implementation will close the corresponding INamedGraph if if no default graph exists for the given URI.
namedGraphUri (URI) - the URI of the named graph
addDefaultGraph - Add a default graph to the dataset, given its URI.
namedGraphUri (URI) - the URI of the default graph
return INamedGraph - the instance of INamedGraph created for the default graph
setDefaultGraphs - sets the default graphs of the dataset to the given collection of URIs. All existing default graphs will be removed. Each corresponding INamedGraph instance will be closed if no corresponding named graph exists in the dataset.
namedGraphUris (collection of URI) - the default graph URIs to set
getDefaultGraph - get a INamedGraph instance for the given default graph URI, Returns null if the default graph does not exist in the dataset
namedGraphUri (URI) - the URI of the default graph
return INamedGraph - the instance of INamedGraph created for the default graph
getDefaultGraphUris - the URIs of all default graphs in the dataset
return collection of URI
containsDefaultGraph - Determine if the given default graph exists in the dataset
namedGraphUri (URI) - the URI of the default graph
removeDefaultGraph - remove the given default graph from the dataset. The implementation will close the corresponding INamedGraph if if no named graph exists for the given URI.
namedGraphUri (URI) - the URI of the default graph
executeQuery - Execute a query against the statements stored in the dataset, using the set of named graphs and defaults graphs in the dataset as the named and default graphs for the query.
query (String) - The Sparql query string
return QueryResults
close - close all INamedGraph instances
clear - remove all statements from all INamedGraph instances, and remove all default and named graphs.
Events
StatementUpdateEvent - This object is an event fired when statements have been added or removed from a named graphs or dataset.
Properties
source (INamedGraph, IDataset, ITracker) - the object that fired this event.
additions (unmodifiable collection or iterator of Statement - the statements that were added during this update
deletions (unmodifiable collection or iterator of Statement - the statements that were removed during this update
The AnzoClient API
The AnzoClient API is completely encapsulated within the AnzoClient object, transaction preconditions (Precondition) and a couple simple connectivity events.
AnzoClient - The basic element of an RDF graph, contains four components
Static members
Properties
connected (boolean) (read-only) - Whether or not the client is connected.
updateRepositoryOnCommit (boolean) - whether or not updateRepository is automatically invoke on a commit, defaults to false.
Methods
connect - Finalize all connectivity components within the client. Implementations may peform certain connectivity operations during construction of the AnzoClient object.
getReplicaGraph - Acquire a name graph to maintain in the local replica.
uri (URI) - the uri of the named graph
create (Boolean) - true to create the graph if it does not already exist, false to only get the graph if it exists (true by default)
namedGraphInitializers (array of INamedGraphInitializer) - array of initializers that are to be run on this graph as it is created, in addition to those initializers configured for the client.
return - IAnzoGraph the named graph instance for reading and writing to the local replica. Writes are not immediately committed to the local replica until replication has completed, but are reflected in all read operations following the write. StatementUpdateEvents are not fired until the transaction(s) have been sent to the repository via updateRepository().
getReplicaGraphs - Acquire a name graph to maintain in the local replica.
uris (collection of URI) - the uri of the named graph
create (Boolean) - true to create the graphs that don't already exist, false to only get the graphs that exists (true by default)
namedGraphInitializers (array of INamedGraphInitializer) - array of initializers that are to be run on this graph as it is created, in addition to those initializers configured for the client.
return - IAnzoGraph the named graph instance for reading and writing to the local replica. Writes are not immediately committed to the local replica until replication has completed, but are reflected in all read operations following the write. StatementUpdateEvents are not fired until the transaction(s) have been sent to the repository via updateRepository().
getServerGraph - Acquire a name graph to access directly against the server
uri (URI) - the uri of the named graph
namedGraphInitializers (array of INamedGraphInitializer) - array of initializers that are to be run on this graph as it is created, in addition to those initializers configured for the client.
return - IAnzoGraph the named graph instance for reading and writing to the graph on the server. Writes are not immediately committed to the server until replication has completed, but are reflected in all read operations following the write. StatementUpdateEvents are not fired until the transaction(s) have been sent to the repository via updateRepository().
begin - Begin a new transaction or nest a transaction within the current transaction.
Form 1 - simple begin
Form 2 - specify one or more preconditions for the transaction. A precondition is Sparql ASK query that must hold true (or false) before the given transaction may be executed. Because of transactionality, if a precondition on a nested transaction fails, then the entire out transaction fails as well. The subtle semantics of preconditions on a nested transaction, is that the Sparql query is executed against of a view of the repository beforethe entire transaction began
preconditions - (collection or iterator of Precondition)
commit - Commit the current transaction or nested tranaction. If the current transaction is an outer transaction, then the transaction has been fully committed and will be sent to the server upon the next replicate. If the current transaction is a nested transaction, further operations will be performed on parent transaction.
abort - Abort the current transaction or nested transaction. If the current transaction is an outer transaction, then the entire transaction is aborted. If the current transaction is a nested transaction, then only the that transaction is aborted, further operations will be performed on parent transaction.
inTransaction - Determines whether or not a transaction has begun.
return - boolean
getTransactionContext - Returns a named graph that the application can write any statements to providing context about the current sub-transaction. The contents of the context are not stored in the repository, but are provided to other clients via transaction events. The transaction context generalizes and provides a vast improvement over the command type mechanism. The INamedGraph returned by this call should also be used to determine the current transaction URI for reacting to transaction events.
return - INamedGraph the graph for writing the context.
updateRepository - Sends all commmitted transactions in the transaction queue to the repository. This call does not return until either a failure has been detected or all updates have been fully saved in the repository and stored in the local replica.
replicate - Synchronizes this anzo client with the server by bringing down all changes to named graphs maintained in the replica. However, applications should not need to call replicate. The local replica is maintained automatically by the notification system. Internally, the client uses replicate as a fallback when notifications arrive out of order or in an inconsistent state. replicate is kept in the public API only as a last resort for applications in the most extreme failure cases.
reset - Reset the database, removing all named graphs and statements, and setting the system to a state determine by the given collection of metadata statements. Resest is an advanced feature, used primarily in integration testing. Reset will typically be disabled in production environments.
statements (collection or iterator of IStatement). The set of statements used here requires special treatment outside the scope of this document.
replicaFind - Performs a quad-pattern find against the local replica
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
namedGraphUri (URI) - may be null to indicate a wildcard
return - collection of Statement
serverFind - Performs a quad-pattern find against the server
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
namedGraphUri (URI) - may be null to indicate a wildcard
return - collection of Statement
serverQuery - Execute a Sparql query directly against the repository server.
defaultNamedGraphUris (collection of URI) - The collection of named graph URIs that make up the background graph for the query
namedGraphUris (collection of URI) - The collection of name graph URIs for the query.
namedDatasets (collection of URI) - The collection of URIs of named datasets whose named and default graphs should be included in the query.
query (String) - The Sparql query string
baseUri (URI) - The base URI for URIs in the query.
return QueryResults
replicaQuery - Execute a Sparql query against the local replica
defaultNamedGraphUris (collection of URI) - The collection of named graph URIs that make up the background graph for the query
namedGraphUris (collection of URI) - The collection of name graph URIs for the query.
namedDatasets (collection of URI) - The collection of URIs of named datasets whose named and default graphs should be included in the query.
query (String) - The Sparql query string
baseUri (URI) - The base URI for URIs in the query.
return QueryResults
getNamedGraphRevision - Return an in-memory copy of the given named graph at the given revision. The returned graph may be modified in memory, but these modifications have no effect on the named graph in neither the repository nor the local replica
namedGraphUri (URI) the uri of the named graph
revision (long) the revsion of the graph to retrieve. Passinging in 0 for the revision returns the initial version of the graph, and passing in -1 returns the current revision of the graph.
close - release all resources and connections associated with this AnzoClient instance.
Form 1 - simple close operation
Form 2 - optionally delete all persisted state.
deletePersistence - whether or not to delete persisted state (statements, trackers, transactions).
createReplicaDataset - Create a dataset of replica graphs using the given set of namedGraphUris. When the returned IDataset is closed, all the underlying ClientGraph instances will be closed in turn.
persitence - If true, the RDF serialized state of the dataset will be maintained in a replica graph.
datasetUri (URI) - the uri to assign the dataset
defaultGraphUris (collection of URI) - the set of uris that make up the default graph, must be a subset of the namedGraphUris.
namedGraphUris (collection of URI) - the set of named graphs. A replica graph will be created and stored in the dataset for each uri.
namedGraphInitializers (array of INamedGraphInitializer) - array of initializers that are to be run on this graph as it is created, in addition to those initializers configured for the client.
Return IDataset the dataset containing the replica graphs.
createServerDataset - Create a dataset of server graphs using the given set of namedGraphUris. When the returned IDataset is closed, all the underlying ClientGraph instances will be closed in turn.
persitence - If true, the RDF serialized state of the dataset will be maintained in a server graph.
datasetUri (URI) - the uri to assign the dataset
defaultGraphUris (collection of URI) - the set of uris that make up the default graph, must be a subset of the namedGraphUris.
namedGraphUris (collection of URI) - the set of named graphs. A server graph will be created and stored in the dataset for each uri.
namedGraphInitializers (array of INamedGraphInitializer) - array of initializers that are to be run on this graph as it is created, in addition to those initializers configured for the client.
Return IDataset a dataset containing the server graphs.
getAllReplicaGraphsDataset - Return a dataset containing all replica graphs created using this AnzoClient. Only a single instance of this dataset is handed out, and it changes as graphs are created and closed by the client.
return IDataset
getAllServerGraphsDataset - Return a dataset containing all server graphs created using this AnzoClient. Only a single instance of this dataset is handed out, and it changes as graphs are created and closed by the client.
return IDataset
dropQueuedTransactions - Removes all committed transactions from the transaction queue. This call does not drop or abort the current, top-most transaction or any of its sub-transactions.
namedGraphExists - Determine if a named graph exists on the server
namedGraphUri (URI) - the uri of the named graph to check
return boolean
getNamedGraphs - get a list of all named graphs stored on the server
return collection of URI - the list of named graphs.
canReadNamedGraph - determine if the current user has permission to read the given named graph
namedGraphUri (URI) - the named graph in question
return boolean
canAddToNamedGraph - determine if the current user has permission to add statements to the given named graph
namedGraphUri (URI) - the named graph in question
return boolean
canRemoveFromNamedGraph - determine if the current user has permission to remove statements from the given named graph
namedGraphUri (URI) - the named graph in question
return boolean
getRealtimeUpdates - return a configured instance of RealtimeUpdateManager to receive realtime updates for quad patterns and transactions outside the scope of the set of replica and server graphs.
addDefaultNamedGraphInitializer - register an INamedGraphInitializer to be run when each replica or server graph created.
namedGraphInitializer (INamedGraphInitializers)
removeDefaultNamedGraphInitializer - unregister an INamedGraphInitializer.
namedGraphInitializer (INamedGraphInitializers)
getStatementChannel - Open a statement channel, creating the corresponding named graph on the server if it doesn't already exist. If the graph did not exist prior to the call, then updateRepository must be called prior to publishing or subscribing to the channel.
uri (URI - the uri of the statment channel
initializers (Collection of INamedGraphInitializer) - initializers to use in creating the statement channel graph
importStatements - This operation submits a collection of statements to be stored in the server. The additions will not take place in a transaction, nor will the additions fire any statement or transaction events. This call is designed for inserting large sets of data into the repository.
statements (Collection of Statement) - The statements to import
initializers (Collection of INamedGraphInitializer) - initializers to use in creating new graphs contained in the statements. Since no transactions are involved, the any preconditions specifed in the initializers will not be enforced.
executeService - Execute a semantic service on the server. These services are lightweight and generally designed and configured per application or specific use case. For simplicity, each service, named by URI, exposes operations named by an operation URI of the form serviceURI#methodName. The input to each services is a collection of statements, and the response is collection of statements. Semantic service may be used to expose server-side running code (in Java or hosted Javascript) to the client, expose traditional Web Services in a semantic fashion to Anzo applications, and connect Anzo applications to SOA-based systems.
statements (Collection of Statement) - The request statements.
return (Collection of Statement)
Events
ClientConnectedEvent - The client has connected. Internally, all client connectivity components are connected.
ClientDisconnectedEvent - The client has disconnected. Internally, at least one client connectivity component has been disconnected.
TransactionCompleteEvent - Fired when a transaction involving at least one named graph for which the client has replica or server graphs has completed.
TransactionFailedEvent - Fired when a transaction committed from this client has failed.
IStatementChannel - Statement channels provide a way for to publish RDF statements to subscribed users in such a way that the statements need not reside in a named graph on the server. Each statement channel is anchored in the Anzo server by a named graph, providng access control and metadata storage for the channel. The URI of the statement channel is the URI of this named graph. User's may publish to a channel if and only if they have statement add access to the named graph, and may subscribe to the channel if they have read access.
Properties
uri (URI) (read-only) - The uri of the channel
namedGraph (IAnzoGraph) (read-only) - A graph (with metadata graph) for managing the channel
Methods
sendMessage - publish a collection of statements and message properties to the channel.
messageProperties (Map from URI to Object) - an arbitrary set of properties sent with the message.
statements (Collection of Statement) - a collection of statements. The named graph of each statement need not be the graph of the channel
close - close the channel, as well as the named graph instance.
Events
StatementChannelMessageEvent - This event is fired when a message is received on a statement channel.
messageProperties (Map from URI to Object) - an arbitrary set of properties sent with the message.
statements (Collection of Statement) - a collection of statements.
Precondition - Encapsulates a precondition that must hold true (or false) before a transaction or substransaction is executed.
Properties
expectTrue (boolean) - whether or not the query must return true for the transaction to proceed
query (String) - The query to execute
defaultGraphUris (collection of URI) - the uris that make up the default graph for the query
namedGraphUris (collection of URI) - the named graph uris for the query
Methods
Events
INamedGraphInitializer - Named graph intiailizers are simple pieces of code that applications may register with the client in order to add statements to named graphs and metadata graphs as the graph is created. These initializers may be specified at the creation of a particular name graph, or at the client level to be applied to all graphs created by that client. An example of initializer is one that adds the proper metadata statement to indicate a non-revisioned or revisioned graph. Initializers may have different behavior depending on whether or not the graph already exists on the server. If a revisioned-named graph already exists on the server for the named graph URI in question, the non-revisioned graph initializer will choose not to run. To help application developers assure the consistency of named graph creation across multiple clients, the name graph initializer may specify preconditions that must be hold at the time the graph is created on the server.
Methods
initializeNamedGraph - called on the graph to be initialized.
namedGraph (IAnzoGraph) - the graph to be initialized, and its metadata graph via namedGraph.getMetadataGrpah).
createNew' (boolean) - whether or not the client is creating a new graph or simply connecting to an existing graph on the server.
getPreconditions - call to retrieve preconditions.
return - Collection of IPrecondition
ClientConnectedEvent - indicates that the client has connected
Properties
ClientDisconnectedEvent - indicates that the client has disconnected, and that any attempts at reconnecting have failed. That is, this event will not be fired if a reconnect was successful.
Properties
TransactionCompleteEvent - fired when a transaction has completed. Transaction events are fired by the Anzo client when transaction affecting named graphs for which this client has replica or server graphs are completed on the server, as well as any transaction committed to the server by this client. The RealtimeUpdateManager also use the TransactionCompleteEvent to notify interested listeners of global transactions.
Properties
transactionURI (URI) - The uri of the completed transactions. This uri can be matched up with AnzoClient.getTransactionContext().getNamedGraphUri()
transactionTimestamp (long))) - The timestamp of when the transaction was committed to the server
transactionGraphs (Collection of URI) - The graph affected by the transaction
transactionContext (IDataset) - A dataset containing the context graphs of the outer transaction and all sub-transactions.
TransactionFailedEvent - fired when a transaction has failed. Transaction events are fired by the Anzo client any transaction committed to the server by this client has failed on the server.
Properties
transactionURI (URI) - The uri of the completed transactions. This uri can be matched up with AnzoClient.getTransactionContext().getNamedGraphUri()
transactionGraphs (Collection of URI) - The graph affected by the transaction
transactionContext (IDataset) - A dataset containing the context graphs of the outer transaction and all sub-transactions.
errors (Collection of AnzoException) - the list of errors causing the failure.
AnzoException - The basic container for errors in the Anzo system. Each exception contains a set of error tags logically-or'ed together, as well as a specific error code.
Properties
errorTags (int) - all error tags that apply to this exception, or'ed together
errorCode (int) - the specific error code.
errorMessage (String) - a readable description of the error.
Realtime Update Manager
RealtimeUpdateManager - As a preamble, the Anzo client notification system has 2 main components. The named graph update system that works without any interaction from the application to keep named graphs in the local replica up to date, fire StatementUpdateEvents events on both server and replica graphs, and fire TransactionEvents for those graphs via the AnzoClient. The limitation,however, is that it requires knowledge of particular named graphs for notification.
The realtime update system, exposed to the application via the RealtimeUpdateManager allows the user to specify interest in statements across the system via statement patterns. Updates to matching statements that the user has permission to see are exposed via StatementUpdateEvents. Events for all transactions across the system are exposed as well, via TransactionEvents. Statements received via realtime updates are not stored in the local replica.
Methods
addTracker - Register for realtime updates to statements matching a particular statement pattern. If a tracker already exists, then this call has no effect.
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
namedGraphUri (URI) - may be null to indicate a wildcard
removeTracker - remove a tracker for the supplied pattern. If a tracker does not exist for the given pattern, then this call has no effect.
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
namedGraphUri (URI) - may be null to indicate a wildcard
containsTracker - Determines whether a tracker exists with the given pattern
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
namedGraphUri (URI) - may be null to indicate a wildcard
return - boolean
Events
TransactionEvent - Fired when a transaction in the system has completed.
ITracker - Encapsulates information about a realtime update tracker. This object is only exposed to the application via StatementUpdateEvent events fired by the RealtimeUpdateManager. These object are used by application to determine the source of such a realtime statement update
Properties
subject (Resource) - may be null to indicate a wildcard
predicate (URI) - may be null to indicate a wildcard
object (Value) - may be null to indicate a wildcard
namedGraphUri (URI) - may be null to indicate a wildcard
Methods
Events
Sparql Query API
The numerous points in the Anzo API where Sparql queries can be executed AnzoClient, IQuadStore, and IDataset have already been discussed in detail. What has been omitted is a description of the QueryResults object that each of these Sparql query execution methods returns. The specific structure of QueryResults varies greatly between platforms, and we will defer to platform specific documentation. In Java and .NET, the results are provided through similar APIs involving iterators and variable/value maps. In Javascript, we leave the results as they are from the server, in the standard Sparql JSON serialization http://www.w3.org/TR/rdf-sparql-json-res/.


