org.dftproject.genesis.core.data
Class DataResourceNode

java.lang.Object
  extended by org.dftproject.genesis.core.data.DataResourceNode
All Implemented Interfaces:
INode, IResourceNode

public class DataResourceNode
extends java.lang.Object
implements IResourceNode

DataResourceNode is a database-backed resource node.


Constructor Summary
protected DataResourceNode(java.lang.String uri, DataView view)
          Creates a database-back resource node.
 
Method Summary
 void addObject(IResourceNode predicate, INode object, IResourceNode graph)
          Adds a statement wherein this node is the subject.
 void addObject(IResourceNode predicate, INode object, IResourceNode graph, DataConnection conn)
          Adds a statement wherein this node is the subject using the given connection.
 boolean equals(java.lang.Object obj)
           
 INode getFirstObject(IResourceNode predicate)
          Returns the first object related to this node (as a subject) by the given predicate.
 Statement getFirstQuadAsSubject(IResourceNode predicate)
          Returns the first statement with the given predicate wherein this node is the subject.
 java.util.Map<IResourceNode,java.util.Set<Statement>> getQuadsAsSubject()
          Returns the mapping of predicate to statements wherein this node serves as the subject.
 java.util.Set<Statement> getQuadsAsSubject(IResourceNode predicate)
          Returns the statements with the given predicate wherein this node is the subject.
 org.apache.commons.collections.MultiMap getSubjects()
          Returns the subjects.
 java.lang.String getURI()
          Returns the name of this node.
 int hashCode()
           
 void removeObject(IResourceNode predicate, INode object, IResourceNode graph)
          Removes a statement wherein this node is the subject.
 void setQuadAsSubject(IResourceNode predicate, INode object, IResourceNode graph)
          Adds a statement wherein this node is the subject to the objects cache.
 void setSubject(IResourceNode predicate, INode subject)
          Adds a statement wherein this node is the object to the subjects cache.
 java.lang.String toString()
           
 void unsetQuadAsSubject(IResourceNode predicate, INode object, IResourceNode graph)
          Removes a statement wherein this node is the subject to the objects cache.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataResourceNode

protected DataResourceNode(java.lang.String uri,
                           DataView view)
Creates a database-back resource node.

Parameters:
uri - the name of the resource
view - the view to which this resource belongs
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getURI

public java.lang.String getURI()
Description copied from interface: IResourceNode
Returns the name of this node.

Specified by:
getURI in interface IResourceNode
Returns:
the name of this node

getSubjects

public org.apache.commons.collections.MultiMap getSubjects()
Description copied from interface: IResourceNode
Returns the subjects.

Specified by:
getSubjects in interface IResourceNode
Returns:
the subjects

getQuadsAsSubject

public java.util.Map<IResourceNode,java.util.Set<Statement>> getQuadsAsSubject()
Description copied from interface: IResourceNode
Returns the mapping of predicate to statements wherein this node serves as the subject.

Specified by:
getQuadsAsSubject in interface IResourceNode
Returns:
the mapping

setSubject

public void setSubject(IResourceNode predicate,
                       INode subject)
Adds a statement wherein this node is the object to the subjects cache.

Note: this method does not modify the database.

Parameters:
predicate - the predicate
subject - the subject

setQuadAsSubject

public void setQuadAsSubject(IResourceNode predicate,
                             INode object,
                             IResourceNode graph)
Adds a statement wherein this node is the subject to the objects cache.

Note: this method does not modify the database.

Parameters:
predicate - the predicate
object - the object
graph - the graph

unsetQuadAsSubject

public void unsetQuadAsSubject(IResourceNode predicate,
                               INode object,
                               IResourceNode graph)
Removes a statement wherein this node is the subject to the objects cache.

Note: this method does not modify the database.

Parameters:
predicate - the predicate
object - the object
graph - the graph

addObject

public void addObject(IResourceNode predicate,
                      INode object,
                      IResourceNode graph)
Description copied from interface: IResourceNode
Adds a statement wherein this node is the subject.

Specified by:
addObject in interface IResourceNode
Parameters:
predicate - the predicate
object - the object
graph - the graph

addObject

public void addObject(IResourceNode predicate,
                      INode object,
                      IResourceNode graph,
                      DataConnection conn)
Adds a statement wherein this node is the subject using the given connection.

Parameters:
predicate - the predicate
object - the object
graph - the graph
conn - the connection

removeObject

public void removeObject(IResourceNode predicate,
                         INode object,
                         IResourceNode graph)
Description copied from interface: IResourceNode
Removes a statement wherein this node is the subject.

Specified by:
removeObject in interface IResourceNode
Parameters:
predicate - the predicate
object - the object
graph - the graph

getQuadsAsSubject

public java.util.Set<Statement> getQuadsAsSubject(IResourceNode predicate)
Description copied from interface: IResourceNode
Returns the statements with the given predicate wherein this node is the subject.

Specified by:
getQuadsAsSubject in interface IResourceNode
Parameters:
predicate - the predicate
Returns:
the statements

getFirstQuadAsSubject

public Statement getFirstQuadAsSubject(IResourceNode predicate)
Description copied from interface: IResourceNode
Returns the first statement with the given predicate wherein this node is the subject.

Specified by:
getFirstQuadAsSubject in interface IResourceNode
Returns:
the statement

getFirstObject

public INode getFirstObject(IResourceNode predicate)
Description copied from interface: IResourceNode
Returns the first object related to this node (as a subject) by the given predicate.

Specified by:
getFirstObject in interface IResourceNode
Parameters:
predicate - the predicate
Returns:
the object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object