org.dftproject.genesis.core.data.nodes
Class ResourceSet

java.lang.Object
  extended by org.dftproject.genesis.core.data.nodes.ResourceSet

public class ResourceSet
extends java.lang.Object

A ResourceSet is used to retrieve all resource nodes matching certain criteria. It also returns all the named "fields" so that you don't have to do a second look up for them.


Constructor Summary
ResourceSet(DataView view)
          Creates a resource set based on the given view.
 
Method Summary
 void addOptional(IResourceNode predicate)
          Adds an optional field.
 void addOptional(IResourceNode predicate, INode object)
          Adds an optional field that must match the given object.
 void addOptional(IResourceNode predicate, INode object, INode defaultObject, IResourceNode defaultGraph)
          Adds an optional field that must match the given object.
 void addProperty(IResourceNode predicate, INode object, IResourceNode graph)
          Adds the given field from the requested resources.
 void addRequired(IResourceNode predicate)
          Adds a required field
 void addRequired(IResourceNode predicate, IExpression expression)
          Adds a required fields that must match the given expression.
 void addRequired(IResourceNode predicate, INode object)
          Adds a required field that must match the given object.
 NodeIterator getResources()
          Returns an iterator to the requested resources.
 void removeProperty(IResourceNode predicate, IResourceNode graph)
          Removes the given field from the requested resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceSet

public ResourceSet(DataView view)
Creates a resource set based on the given view.

Parameters:
view - a data view
Method Detail

addRequired

public void addRequired(IResourceNode predicate)
Adds a required field

Parameters:
predicate - the field name

addRequired

public void addRequired(IResourceNode predicate,
                        INode object)
Adds a required field that must match the given object.

Parameters:
predicate - the field name
object - the object

addRequired

public void addRequired(IResourceNode predicate,
                        IExpression expression)
Adds a required fields that must match the given expression.

Parameters:
predicate - the field name
expression - the expression

addOptional

public void addOptional(IResourceNode predicate)
Adds an optional field.

Parameters:
predicate - the field name

addOptional

public void addOptional(IResourceNode predicate,
                        INode object)
Adds an optional field that must match the given object.

Parameters:
predicate - the field name
object - the object

addOptional

public void addOptional(IResourceNode predicate,
                        INode object,
                        INode defaultObject,
                        IResourceNode defaultGraph)
Adds an optional field that must match the given object. If such an object does not exist, the given default is used.

Parameters:
predicate - the field name
object - the object
defaultObject - the default object, for when the requested object does not exist
defaultGraph - the default graph, for when the requested object does not exist

getResources

public NodeIterator getResources()
                          throws DataException
Returns an iterator to the requested resources.

Returns:
an iterator
Throws:
DataException - if there is a SQL exception

removeProperty

public void removeProperty(IResourceNode predicate,
                           IResourceNode graph)
                    throws DataException
Removes the given field from the requested resources.

Parameters:
predicate - the field name
graph - the graph
Throws:
DataException - if there is a SQL exception

addProperty

public void addProperty(IResourceNode predicate,
                        INode object,
                        IResourceNode graph)
                 throws DataException
Adds the given field from the requested resources.

Parameters:
predicate - the field name
object - the value
graph - the graph
Throws:
DataException - if there is a SQL exception