org.openanzo.client.jena
Class CloseableDatasetServiceDataset

java.lang.Object
  extended by org.openanzo.client.jena.CloseableDatasetServiceDataset
All Implemented Interfaces:
com.hp.hpl.jena.query.Dataset, IClosableDataset

public class CloseableDatasetServiceDataset
extends java.lang.Object
implements IClosableDataset

The CloseableDatasetServiceDataset is the implementation of IClosableDataset 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 )

Constructor Summary
CloseableDatasetServiceDataset(JenaDatasetService service, boolean local, boolean createGraphs, boolean createImmediately, boolean addNamedGraphTrackers, java.util.Set<java.lang.String> defaultModelUris, java.util.Set<java.lang.String> uris)
          Create a new CloseableDatasetServiceDataset with a set of URIs to union together to form the defaultGraph and a set of uris for the NamedGraphs.
 
Method Summary
 void addDefaultModelUri(java.lang.String uri)
          Add the URI of a NamedGraph to the default model for the dataset.
 void addNamedModelUri(java.lang.String uri)
          Add the URI of a NamedGraph to the set of NamedGraphs.
 void close()
          Close all named graphs instantiated thew this dataset.
 boolean containsNamedModel(java.lang.String uri)
           
 com.hp.hpl.jena.rdf.model.Model getDefaultModel()
          If a defaultModel was passed in threw constructor, or if it was already created, return model.
 com.hp.hpl.jena.shared.Lock getLock()
           
 com.hp.hpl.jena.rdf.model.Model getNamedModel(java.lang.String uri)
          Get the NamedModel with given uri.
 java.util.Iterator<java.lang.String> listNames()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloseableDatasetServiceDataset

public CloseableDatasetServiceDataset(JenaDatasetService service,
                                      boolean local,
                                      boolean createGraphs,
                                      boolean createImmediately,
                                      boolean addNamedGraphTrackers,
                                      java.util.Set<java.lang.String> defaultModelUris,
                                      java.util.Set<java.lang.String> uris)
Create a new CloseableDatasetServiceDataset with a set of URIs to union together to form the defaultGraph and a set of uris for the NamedGraphs.

Parameters:
service - Parent DatasetService that created this dataset
local - Signifies if the dataset contains local or remote NamedGraphs
createGraphs - Create a new NamedGraph for graphs requested that don't exist.
createImmediately - NamedGraphs should be instantiated immediately when the dataset is created
addNamedGraphTrackers - Add a NamedGraphTracker for each LocalNamedGraph instantiated threw the Dataset
defaultModelUris - Set of NamedGraph uris to union as DefaultModel.
uris - Set of NamedGraph uris within dataset.
Method Detail

close

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

Specified by:
close in interface IClosableDataset

containsNamedModel

public boolean containsNamedModel(java.lang.String uri)
Specified by:
containsNamedModel in interface com.hp.hpl.jena.query.Dataset

getDefaultModel

public com.hp.hpl.jena.rdf.model.Model getDefaultModel()
If a defaultModel was passed in threw constructor, or if it was already created, return model. If not created yet, and defaultModelUris is not null, create a MultiUnion model made up of NamedGraphs of each uri in the defaultModelUris set.

Specified by:
getDefaultModel in interface com.hp.hpl.jena.query.Dataset
Returns:
defaultModel
See Also:
Dataset.getDefaultModel()

getLock

public com.hp.hpl.jena.shared.Lock getLock()
Specified by:
getLock in interface com.hp.hpl.jena.query.Dataset

getNamedModel

public com.hp.hpl.jena.rdf.model.Model getNamedModel(java.lang.String uri)
Get the NamedModel with given uri. If NamedGraph does not exist on server, one will be created if the createGraphs flag is set.

Specified by:
getNamedModel in interface com.hp.hpl.jena.query.Dataset
Returns:
model for uri. Will be null if createGraphs is false, and NamedGraph does not exist.
See Also:
Dataset.getNamedModel(String)

listNames

public java.util.Iterator<java.lang.String> listNames()
Specified by:
listNames in interface com.hp.hpl.jena.query.Dataset

addDefaultModelUri

public void addDefaultModelUri(java.lang.String uri)
Description copied from interface: IClosableDataset
Add the URI of a NamedGraph to the default model for the dataset.

Specified by:
addDefaultModelUri in interface IClosableDataset

addNamedModelUri

public void addNamedModelUri(java.lang.String uri)
Description copied from interface: IClosableDataset
Add the URI of a NamedGraph to the set of NamedGraphs.

Specified by:
addNamedModelUri in interface IClosableDataset


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