org.openanzo.model.impl
Class ADataset

java.lang.Object
  extended by org.openanzo.model.impl.ADataset
All Implemented Interfaces:
IContainer, IDataset
Direct Known Subclasses:
ClosableDatasetServiceDataset, Dataset

public abstract class ADataset
extends java.lang.Object
implements IDataset

Abstract base implementation of IDataset. Contains 2 sets of URIs, one for the default graphs, and one for the namedGraphs.

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Constructor Summary
ADataset()
           
 
Method Summary
 void add(java.util.Iterator<org.openrdf.model.Statement> statements)
          Add statements to their given NamedGraph.
 void add(org.openrdf.model.Resource subj, org.openrdf.model.URI pred, org.openrdf.model.Value obj, org.openrdf.model.Resource namedGraphUri)
          Add a statement to the given NamedGraph if said NamedGraph is contained within this dataset.
 void add(org.openrdf.model.Statement... statements)
          Add statements to the given NamedGraph if said NamedGraph is contained within this dataset.
 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... namedGraphUris)
          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 statements from their given NamedGraph.
 void delete(org.openrdf.model.Resource subj, org.openrdf.model.URI pred, org.openrdf.model.Value obj, org.openrdf.model.Resource namedGraphUri)
          Delete statements from the given NamedGraph if said NamedGraph is contained within this dataset.
 void delete(org.openrdf.model.Statement... statements)
          Delete statements from the given NamedGraph if said NamedGraph is contained within this dataset.
 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.
 java.util.Collection<org.openrdf.model.URI> getContexts()
          Get the set of Context URIs that are container within this Container
 info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> getStatements()
          Get an iterator over all statements within this container
 org.openrdf.model.URI getURI()
          Get the URI for the dataset
 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 setDatasetURI(org.openrdf.model.URI datasetURI)
          Set the URI for the dataset
 int size()
          Return number of statements in container
 int size(org.openrdf.model.Resource... context)
          Return number of statements in container
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openanzo.model.IDataset
addDefaultGraphUri, addDefaultNamedGraph, addNamedGraph, addNamedGraphUri, containsDefaultNamedGraph, containsNamedGraph, executeQuery, getDefaulNamedGraphsSize, getDefaultNamedGraph, getDefaultNamedGraphs, getNamedGraph, getNamedGraphs, getNamedGraphsSize, removeDefaultGraphUri, removeNamedGraphUri
 
Methods inherited from interface org.openanzo.model.IContainer
executeQuery, getEventManager, getTransactionManager, setEventManager, setTransactionManager
 

Constructor Detail

ADataset

public ADataset()
Method Detail

add

public void add(org.openrdf.model.Resource subj,
                org.openrdf.model.URI pred,
                org.openrdf.model.Value obj,
                org.openrdf.model.Resource namedGraphUri)
Add a statement to the given NamedGraph if said NamedGraph is contained within this dataset. No exception is thrown if NamedGraph is not contained within dataset, statement is simple ignored.

Specified by:
add in interface IContainer
Parameters:
subj - Subject of statement
pred - Property of statement
obj - Object of statement
namedGraphUri - URI of NamedGraph to which statement is to be added
Throws:
AnzoRuntimeException - if any of the 4 arguments is null

add

public void add(org.openrdf.model.Statement... statements)
Add statements to the given NamedGraph if said NamedGraph is contained within this dataset. No exception is thrown if NamedGraph is not contained within dataset, statement is simple ignored.

Specified by:
add in interface IContainer
Parameters:
statements - to add
Throws:
AnzoRuntimeException - if any of the 4 arguments is null

add

public void add(java.util.Iterator<org.openrdf.model.Statement> statements)
Add statements to their given NamedGraph. Context of each statement is used to determine which NamedGraph statement is to be added.

Specified by:
add in interface IContainer
Parameters:
statements - Iterator of statement to add

delete

public void delete(java.util.Iterator<org.openrdf.model.Statement> statements)
Delete statements from their given NamedGraph. Context of each statement is used to determine which NamedGraph statement is to be removed.

Specified by:
delete in interface IContainer
Parameters:
statements - Iterator of statement to delete

delete

public void delete(org.openrdf.model.Resource subj,
                   org.openrdf.model.URI pred,
                   org.openrdf.model.Value obj,
                   org.openrdf.model.Resource namedGraphUri)
Delete statements from the given NamedGraph if said NamedGraph is contained within this dataset. No exception is thrown if NamedGraph is not contained within dataset, statement is simple ignored.

Specified by:
delete in interface IContainer
Parameters:
subj - Subject of statement
pred - Property of statement
obj - Object of statement
namedGraphUri - URI of NamedGraph to which statement is to be deleted
Throws:
AnzoRuntimeException - if any of the 4 arguments is null

delete

public void delete(org.openrdf.model.Statement... statements)
Delete statements from the given NamedGraph if said NamedGraph is contained within this dataset. No exception is thrown if NamedGraph is not contained within dataset, statement is simple ignored.

Specified by:
delete in interface IContainer
Parameters:
statements - statements to remove
Throws:
AnzoRuntimeException - if any of the 4 arguments is null

clear

public void clear()
Description copied from interface: IContainer
Delete all statements in container

Specified by:
clear in interface IContainer

contains

public boolean contains(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 true if the container contains atleast 1 statement that matches the pattern of subj,prop,obj,context

Specified by:
contains in interface IContainer
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:
true if the container contains atleast 1 statement that matches the pattern of subj,prop,obj

contains

public boolean contains(org.openrdf.model.Statement statement)
Description copied from interface: IContainer
Return true if the container contains atleast 1 statement that matches the statement provided

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

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
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

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
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

getStatements

public info.aduna.collections.iterators.CloseableIterator<org.openrdf.model.Statement> getStatements()
Description copied from interface: IContainer
Get an iterator over all statements within this container

Specified by:
getStatements in interface IContainer
Returns:
CloseableIterator of all statements within this container

isClosed

public boolean isClosed()
Description copied from interface: IContainer
Return if container is closed

Specified by:
isClosed in interface IContainer
Returns:
true if container is closed

size

public int size()
Description copied from interface: IContainer
Return number of statements in container

Specified by:
size in interface IContainer
Returns:
number of statements in container

getURI

public org.openrdf.model.URI getURI()
Get the URI for the dataset

Specified by:
getURI in interface IContainer
Returns:
the dataset's URI

setDatasetURI

public void setDatasetURI(org.openrdf.model.URI datasetURI)
Set the URI for the dataset

Parameters:
datasetURI - the value to set dataset's URI

clear

public void clear(org.openrdf.model.Resource... context)
Description copied from interface: IContainer
Delete all statements in container for given contexts

Specified by:
clear in interface IContainer
Parameters:
context - Contexts to clear from container

close

public void close()
Description copied from interface: IContainer
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

Specified by:
close in interface IContainer

connect

public void connect()
Description copied from interface: IContainer
Connect container to its source

Specified by:
connect in interface IContainer

isConnected

public boolean isConnected()
Description copied from interface: IContainer
Return if the container is connected to its source

Specified by:
isConnected in interface IContainer
Returns:
if the container is connected to its source

isEmpty

public boolean isEmpty()
Description copied from interface: IContainer
Return if container is empty

Specified by:
isEmpty in interface IContainer
Returns:
true if container is empty

isEmpty

public boolean isEmpty(org.openrdf.model.Resource... context)
Description copied from interface: IContainer
Return if container is empty for given contexts

Specified by:
isEmpty in interface IContainer
Parameters:
context - Contexts of statements to count
Returns:
true if container is empty

size

public int size(org.openrdf.model.Resource... context)
Description copied from interface: IContainer
Return number of statements in container

Specified by:
size in interface IContainer
Parameters:
context - Contexts of statements to count
Returns:
number of statements in container for given contexts

getContexts

public java.util.Collection<org.openrdf.model.URI> getContexts()
Description copied from interface: IContainer
Get the set of Context URIs that are container within this Container

Specified by:
getContexts in interface IContainer
Returns:
the set of Context URIs that are container within this Container


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