org.openanzo.model
Interface IContainer

All Known Subinterfaces:
IDataset
All Known Implementing Classes:
ADataset, ClosableDatasetServiceDataset, ContainerDataset, Dataset, DynamicDataset, NamedGraphContainer, NotificationContainerProxy, RDBConnection, RDBNamedGraphContainer, ReplicaDataset, StoredDatasetProxy, StoredDatasetserviceDatasetProxy, TransactionContainerProxy

public interface IContainer

An IContainer is an object that holds Statement quads, where a quad is a statement that has a Subject,Predicate,Object and Context(NamedGraph URI). You can add and delete statements, run SPARQL queries against, do basic finds and contains operations. The IContainer also provides and event manager which facilitates notifying listeners when data in IContainer changes.

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Method Summary
 void add(java.util.Iterator<org.openrdf.model.Statement> statements)
          Add a set of statements from container
 void add(org.openrdf.model.Resource subj, org.openrdf.model.URI pred, org.openrdf.model.Value obj, org.openrdf.model.Resource context)
          Add a new statement with given subj,pred,obj,context
 void add(org.openrdf.model.Statement... statements)
          Add one or more statements to container
 void clear()
          Delete all statements in container
 void clear(org.openrdf.model.Resource... context)
          Delete all statements in container for given contexts
 void close()
          Disconnect container from its source and close the container Note: Once a container is closed, it is based on the source of the container's data whether or not subsequent calls to connect will return the same data
 void connect()
          Connect container to its source
 boolean contains(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj, org.openrdf.model.Resource... context)
          Return true if the container contains atleast 1 statement that matches the pattern of subj,prop,obj,context
 boolean contains(org.openrdf.model.Statement statement)
          Return true if the container contains atleast 1 statement that matches the statement provided
 void delete(java.util.Iterator<org.openrdf.model.Statement> statements)
          Delete a set of statements from container
 void delete(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj, org.openrdf.model.Resource context)
          Delete a statement from container
 void delete(org.openrdf.model.Statement... statements)
          Delete a set of statements from container
 QueryResult executeQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs, java.util.Set<org.openrdf.model.URI> namedGraphs, java.lang.String query)
          Execute a SPARQL query against the data within this container
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> find(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj, org.openrdf.model.Resource... context)
          Return an iterator over all statements that match the pattern of subj,prop,obj
 java.util.Collection<org.openrdf.model.URI> getContexts()
          Get the set of Context URIs that are container within this Container
 INamedGraphEventManager getEventManager()
          Return INamedGraphEventManager for this container
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> getStatements()
          Get an iterator over all statements within this container
 ITransactionManager getTransactionManager()
          Return ITransactionManager for this container
 org.openrdf.model.URI getURI()
          Get URI of IContainer
 boolean isClosed()
          Return if container is closed
 boolean isConnected()
          Return if the container is connected to its source
 boolean isEmpty()
          Return if container is empty
 boolean isEmpty(org.openrdf.model.Resource... context)
          Return if container is empty for given contexts
 void setEventManager(INamedGraphEventManager eventManager)
          Set INamedGraphEventManager for this container
 void setTransactionManager(ITransactionManager transactionManager)
          Set ITransactionManager for this container
 int size()
          Return number of statements in container
 int size(org.openrdf.model.Resource... context)
          Return number of statements in container
 

Method Detail

getURI

org.openrdf.model.URI getURI()
Get URI of IContainer

Returns:
URI for this container

getStatements

info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> getStatements()
Get an iterator over all statements within this container

Returns:
CloseableIterator of all statements within this container

find

info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> find(org.openrdf.model.Resource subj,
                                                                                     org.openrdf.model.URI prop,
                                                                                     org.openrdf.model.Value obj,
                                                                                     org.openrdf.model.Resource... context)
Return an iterator over all statements that match the pattern of subj,prop,obj

Parameters:
subj - Subject resource to match, or wildcard if null
prop - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
context - Context values to match, or wildcard if null
Returns:
an iterator of all statements that match the pattern of subj,prop,obj,context

contains

boolean contains(org.openrdf.model.Resource subj,
                 org.openrdf.model.URI prop,
                 org.openrdf.model.Value obj,
                 org.openrdf.model.Resource... context)
Return true if the container contains atleast 1 statement that matches the pattern of subj,prop,obj,context

Parameters:
subj - Subject resource to match, or wildcard if null
prop - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
context - Context values to match, or wildcard if null
Returns:
true if the container contains atleast 1 statement that matches the pattern of subj,prop,obj

contains

boolean contains(org.openrdf.model.Statement statement)
Return true if the container contains atleast 1 statement that matches the statement provided

Parameters:
statement - Statement to check for existence in container
Returns:
true if the container contains atleast 1 statement that matches the statement provided

add

void add(org.openrdf.model.Resource subj,
         org.openrdf.model.URI pred,
         org.openrdf.model.Value obj,
         org.openrdf.model.Resource context)
Add a new statement with given subj,pred,obj,context

Parameters:
subj - Subject of statement
pred - Predicate of statement
obj - Object of statement
context - Context of statement

add

void add(java.util.Iterator<org.openrdf.model.Statement> statements)
Add a set of statements from container

Parameters:
statements - statements to add to container

add

void add(org.openrdf.model.Statement... statements)
Add one or more statements to container

Parameters:
statements - statements to add to container

delete

void delete(org.openrdf.model.Resource subj,
            org.openrdf.model.URI prop,
            org.openrdf.model.Value obj,
            org.openrdf.model.Resource context)
Delete a statement from container

Parameters:
subj - Subject resource to match, or wildcard if null
prop - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
context - Context values to match, or wildcard if null

delete

void delete(org.openrdf.model.Statement... statements)
Delete a set of statements from container

Parameters:
statements - statements to delete from container

delete

void delete(java.util.Iterator<org.openrdf.model.Statement> statements)
Delete a set of statements from container

Parameters:
statements - statements to delete from container

clear

void clear()
Delete all statements in container


clear

void clear(org.openrdf.model.Resource... context)
Delete all statements in container for given contexts

Parameters:
context - Contexts to clear from container

size

int size()
Return number of statements in container

Returns:
number of statements in container

size

int size(org.openrdf.model.Resource... context)
Return number of statements in container

Parameters:
context - Contexts of statements to count
Returns:
number of statements in container for given contexts

isEmpty

boolean isEmpty()
Return if container is empty

Returns:
true if container is empty

isEmpty

boolean isEmpty(org.openrdf.model.Resource... context)
Return if container is empty for given contexts

Parameters:
context - Contexts of statements to count
Returns:
true if container is empty

isConnected

boolean isConnected()
Return if the container is connected to its source

Returns:
if the container is connected to its source

connect

void connect()
Connect container to its source


close

void close()
Disconnect container from its source and close the container Note: Once a container is closed, it is based on the source of the container's data whether or not subsequent calls to connect will return the same data


isClosed

boolean isClosed()
Return if container is closed

Returns:
true if container is closed

getEventManager

INamedGraphEventManager getEventManager()
Return INamedGraphEventManager for this container

Returns:
INamedGraphEventManager for this container

setEventManager

void setEventManager(INamedGraphEventManager eventManager)
Set INamedGraphEventManager for this container

Parameters:
eventManager - set the Containers eventManaget

getTransactionManager

ITransactionManager getTransactionManager()
Return ITransactionManager for this container

Returns:
ITransactionManager for this container

setTransactionManager

void setTransactionManager(ITransactionManager transactionManager)
Set ITransactionManager for this container

Parameters:
transactionManager - set ITransactionManager for this container

executeQuery

QueryResult executeQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
                         java.util.Set<org.openrdf.model.URI> namedGraphs,
                         java.lang.String query)
                         throws AnzoException
Execute a SPARQL query against the data within this container

Parameters:
defaultNamedGraphs - Set<URI> of URIs for NamedGraphs that will make up the default graph for this query
namedGraphs - Set<URI> of URIs for NamedGraphs that will make up the NamedGraphs for this query
query - SPARQL query string
Returns:
Results of running query
Throws:
AnzoException

getContexts

java.util.Collection<org.openrdf.model.URI> getContexts()
Get the set of Context URIs that are container within this Container

Returns:
the set of Context URIs that are container within this Container


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.