org.openanzo.client
Class ClosableDatasetServiceDataset

java.lang.Object
  extended by org.openanzo.model.impl.ADataset
      extended by org.openanzo.client.ClosableDatasetServiceDataset
All Implemented Interfaces:
IContainer, IDataset

public class ClosableDatasetServiceDataset
extends ADataset

The ClosableDatasetServiceDataset is the implementation of IDataset returned by the DatasetService's getLocalDataset or getRemoteDataset methods. This ensures that the underlying NamedGraphs' reference counters are incremented and decremented correctly.

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Method Summary
 void addDefaultGraphUri(org.openrdf.model.URI uri)
          Add the URI of an INamedGraph to include within this dataset's default model
 void addDefaultGraphUri(org.openrdf.model.URI uri, org.openrdf.model.URI metadataURI)
          Add the NamedGraph with the given URI and metadataURI.
 void addDefaultNamedGraph(org.openrdf.model.URI uri, INamedGraph namedGraph)
          Add an INamedGraph with its URI to this dataset's default model
 void addNamedGraph(org.openrdf.model.URI uri, INamedGraph namedGraph)
          Add an INamedGraph with its URI to this dataset
 void addNamedGraphUri(org.openrdf.model.URI uri)
          Add the URI of an INamedGraph to include within this dataset
 void addNamedGraphUri(org.openrdf.model.URI uri, org.openrdf.model.URI metadataURI)
          Add the NamedGraph with the given URI and metadataURI.
 void close()
          Close all named graphs instantiated threw this dataset.
 boolean containsDefaultNamedGraph(org.openrdf.model.URI uri)
          Return if this dataset contains a INamedGraph with the given URI in the dataset's default model
 boolean containsNamedGraph(org.openrdf.model.URI uri)
          Return if this dataset contains a INamedGraph with the given URI
 QueryResult executeQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphsIn, java.util.Set<org.openrdf.model.URI> namedGraphsIn, java.lang.String query)
          Execute a SPARQL query against the data within this container
 QueryResult executeQuery(java.lang.String query)
          Execute a SPARQL query against the data within this dataset, using the dataset's DefaultGraph and NameGraph sets
 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... namedGraphUris)
          Return an iterator over all statements that match the pattern of subj,prop,obj
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findAll(org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj, org.openrdf.model.Resource... namedGraphUris)
          Return an iterator of all statements that match the pattern of subj,prop,obj Difference between find, and findall, is that with findAll, if contexts are provided, they are used to sort results, but not limit results, ie the results contains all statements that match the subj,prop,obj, with matching statements within the given contexts earlier in the iterator than statements not in the provided contexts.
 int getDefaulNamedGraphsSize()
          Return number of INamedGraphs within this dataset's default set
 INamedGraph getDefaultNamedGraph(org.openrdf.model.URI uri)
          Get the INamedGraph for the given URI if it is within this dataset's default model
 INamedGraph getDefaultNamedGraph(org.openrdf.model.URI uri, org.openrdf.model.URI metadataURI)
          Get the NamedGraph with the given URI and metadataURI.
 java.lang.Iterable<org.openrdf.model.URI> getDefaultNamedGraphs()
          Return an Iterable<URI> of the URIs for the INamedGraphs within this dataset's default model
 INamedGraphEventManager getEventManager()
          Return INamedGraphEventManager for this container
 NamedGraphBase getNamedGraph(org.openrdf.model.URI uri)
          Get the NamedGraph with given uri.
 NamedGraphBase getNamedGraph(org.openrdf.model.URI uri, org.openrdf.model.URI metadataURI)
          Get the NamedGraph with the given URI and metadataURI.
 java.lang.Iterable<org.openrdf.model.URI> getNamedGraphs()
          Return an Iterable<URI> of the URIs for the INamedGraphs within this dataset
 int getNamedGraphsSize()
          Return number of INamedGraphs within this dataset
 ITransactionManager getTransactionManager()
          Return ITransactionManager for this container
 void loadDefaultGraphs()
          If defaultGraphUris is not null, load the NamedGraphs that makeup the defaultGraphUris set.
 void removeDefaultGraphUri(org.openrdf.model.URI uri)
          Remove the URI of an INamedGraph to include within this dataset's default model
 void removeNamedGraphUri(org.openrdf.model.URI uri)
          Remove the URI of an INamedGraph to include within this dataset
 void setEventManager(INamedGraphEventManager eventManager)
          Set INamedGraphEventManager for this container
 void setTransactionManager(ITransactionManager transactionManager)
          Set ITransactionManager for this container
 
Methods inherited from class org.openanzo.model.impl.ADataset
add, add, add, clear, clear, connect, contains, contains, delete, delete, delete, getContexts, getStatements, getURI, isClosed, isConnected, isEmpty, isEmpty, setDatasetURI, size, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public void close()
Close all named graphs instantiated threw this dataset.

Specified by:
close in interface IContainer
Overrides:
close in class ADataset

containsNamedGraph

public boolean containsNamedGraph(org.openrdf.model.URI uri)
Description copied from interface: IDataset
Return if this dataset contains a INamedGraph with the given URI

Parameters:
uri - URI of INamedGraph
Returns:
true if this dataset contains a INamedGraph with the given URI

containsDefaultNamedGraph

public boolean containsDefaultNamedGraph(org.openrdf.model.URI uri)
Description copied from interface: IDataset
Return if this dataset contains a INamedGraph with the given URI in the dataset's default model

Parameters:
uri - URI of INamedGraph
Returns:
true if this dataset contains a INamedGraph with the given URI in the dataset's default model

loadDefaultGraphs

public void loadDefaultGraphs()
If defaultGraphUris is not null, load the NamedGraphs that makeup the defaultGraphUris set.


getNamedGraph

public NamedGraphBase getNamedGraph(org.openrdf.model.URI uri)
Get the NamedGraph with given uri. If NamedGraph does not exist on server, one will be created if the createGraphs flag is set.

Parameters:
uri - URI of INamedGraph
Returns:
graph for uri. Will be null if createGraphs is false, and NamedGraph does not exist.

getNamedGraph

public NamedGraphBase getNamedGraph(org.openrdf.model.URI uri,
                                    org.openrdf.model.URI metadataURI)
Get the NamedGraph with the given URI and metadataURI. If NamedGraph does not exist on server, one will be created if the createGraphs flag is set.

Parameters:
uri - for NamedGraph
metadataURI - NamedGraph's metadata URI
Returns:
graph for uri. Will be null if createGraphs is false, and NamedGraph does not exist.

getDefaultNamedGraph

public INamedGraph getDefaultNamedGraph(org.openrdf.model.URI uri)
Description copied from interface: IDataset
Get the INamedGraph for the given URI if it is within this dataset's default model

Parameters:
uri - URI of INamedGraph
Returns:
the INamedGraph for the given URI if it is within this dataset's default model

getDefaultNamedGraph

public INamedGraph getDefaultNamedGraph(org.openrdf.model.URI uri,
                                        org.openrdf.model.URI metadataURI)
Get the NamedGraph with the given URI and metadataURI. If NamedGraph does not exist on server, one will be created if the createGraphs flag is set.

Parameters:
uri - for NamedGraph
metadataURI - NamedGraph's metadata URI
Returns:
graph for uri. Will be null if createGraphs is false, and NamedGraph does not exist.

addDefaultGraphUri

public void addDefaultGraphUri(org.openrdf.model.URI uri)
Description copied from interface: IDataset
Add the URI of an INamedGraph to include within this dataset's default model

Parameters:
uri - URI of namedgraph to add to this dataset's default model

addDefaultGraphUri

public void addDefaultGraphUri(org.openrdf.model.URI uri,
                               org.openrdf.model.URI metadataURI)
Add the NamedGraph with the given URI and metadataURI.

Parameters:
uri - for NamedGraph
metadataURI - NamedGraph's metadata URI

addNamedGraphUri

public void addNamedGraphUri(org.openrdf.model.URI uri)
Description copied from interface: IDataset
Add the URI of an INamedGraph to include within this dataset

Parameters:
uri - URI of namedgraph to add to this dataset

addNamedGraphUri

public void addNamedGraphUri(org.openrdf.model.URI uri,
                             org.openrdf.model.URI metadataURI)
Add the NamedGraph with the given URI and metadataURI.

Parameters:
uri - for NamedGraph
metadataURI - NamedGraph's metadata URI

removeDefaultGraphUri

public void removeDefaultGraphUri(org.openrdf.model.URI uri)
Description copied from interface: IDataset
Remove the URI of an INamedGraph to include within this dataset's default model

Parameters:
uri - URI of namedgraph to add to this dataset's default model

removeNamedGraphUri

public void removeNamedGraphUri(org.openrdf.model.URI uri)
Description copied from interface: IDataset
Remove the URI of an INamedGraph to include within this dataset

Parameters:
uri - URI of namedgraph to add to this dataset

addDefaultNamedGraph

public void addDefaultNamedGraph(org.openrdf.model.URI uri,
                                 INamedGraph namedGraph)
Description copied from interface: IDataset
Add an INamedGraph with its URI to this dataset's default model

Parameters:
uri - URI of INamedGraph
namedGraph - INamedGraph to add to this dataset's default model

addNamedGraph

public void addNamedGraph(org.openrdf.model.URI uri,
                          INamedGraph namedGraph)
Description copied from interface: IDataset
Add an INamedGraph with its URI to this dataset

Parameters:
uri - URI of INamedGraph
namedGraph - INamedGraph to add

getDefaultNamedGraphs

public java.lang.Iterable<org.openrdf.model.URI> getDefaultNamedGraphs()
Description copied from interface: IDataset
Return an Iterable<URI> of the URIs for the INamedGraphs within this dataset's default model

Returns:
an Iterable<URI> of the URIs for the INamedGraphs within this dataset's default model

getNamedGraphs

public java.lang.Iterable<org.openrdf.model.URI> getNamedGraphs()
Description copied from interface: IDataset
Return an Iterable<URI> of the URIs for the INamedGraphs within this dataset

Returns:
an Iterable<URI> of the URIs for the INamedGraphs within this dataset

getDefaulNamedGraphsSize

public int getDefaulNamedGraphsSize()
Description copied from interface: IDataset
Return number of INamedGraphs within this dataset's default set

Returns:
number of INamedGraphs within this dataset's default set

getNamedGraphsSize

public int getNamedGraphsSize()
Description copied from interface: IDataset
Return number of INamedGraphs within this dataset

Returns:
number of INamedGraphs within this dataset

getEventManager

public INamedGraphEventManager getEventManager()
Description copied from interface: IContainer
Return INamedGraphEventManager for this container

Returns:
INamedGraphEventManager for this container

getTransactionManager

public ITransactionManager getTransactionManager()
Description copied from interface: IContainer
Return ITransactionManager for this container

Returns:
ITransactionManager for this container

setEventManager

public void setEventManager(INamedGraphEventManager eventManager)
Description copied from interface: IContainer
Set INamedGraphEventManager for this container

Parameters:
eventManager - set the Containers eventManaget

setTransactionManager

public void setTransactionManager(ITransactionManager transactionManager)
Description copied from interface: IContainer
Set ITransactionManager for this container

Parameters:
transactionManager - set ITransactionManager for this container

executeQuery

public QueryResult executeQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphsIn,
                                java.util.Set<org.openrdf.model.URI> namedGraphsIn,
                                java.lang.String query)
                         throws AnzoException
Description copied from interface: IContainer
Execute a SPARQL query against the data within this container

Parameters:
defaultNamedGraphsIn - Set<URI> of URIs for NamedGraphs that will make up the default graph for this query
namedGraphsIn - 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

executeQuery

public QueryResult executeQuery(java.lang.String query)
                         throws AnzoException
Description copied from interface: IDataset
Execute a SPARQL query against the data within this dataset, using the dataset's DefaultGraph and NameGraph sets

Parameters:
query - SPARQL query string
Returns:
Results of running query
Throws:
AnzoException

findAll

public info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> findAll(org.openrdf.model.Resource subj,
                                                                                               org.openrdf.model.URI prop,
                                                                                               org.openrdf.model.Value obj,
                                                                                               org.openrdf.model.Resource... namedGraphUris)
Description copied from interface: IDataset
Return an iterator of all statements that match the pattern of subj,prop,obj Difference between find, and findall, is that with findAll, if contexts are provided, they are used to sort results, but not limit results, ie the results contains all statements that match the subj,prop,obj, with matching statements within the given contexts earlier in the iterator than statements not in the provided contexts.

Specified by:
findAll in interface IDataset
Overrides:
findAll in class ADataset
Parameters:
subj - Subject resource to match, or null for any
prop - Predicate uri to match, or null for any
obj - Object value to match, or null for any
namedGraphUris - Set of contexts to search first, before searching the rest of the dataset
Returns:
an iterator of all statements that match the pattern of subj,prop,obj

find

public 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... namedGraphUris)
Description copied from interface: IContainer
Return an iterator over all statements that match the pattern of subj,prop,obj

Specified by:
find in interface IContainer
Overrides:
find in class ADataset
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
namedGraphUris - Context values to match, or wildcard if null
Returns:
an iterator of all statements that match the pattern of subj,prop,obj,context


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