org.jrdf.graph
Interface Resource

All Superinterfaces:
BlankNode, Node, ObjectNode, PredicateNode, Serializable, SubjectNode, TypedNodeVisitable, URIReference
All Known Implementing Classes:
AbstractResource, BlankNodeResourceImpl, URIReferenceResourceImpl

public interface Resource
extends URIReference, BlankNode, Serializable

A resource stands for either a Blank Node or a URI Reference. This is a convienence interface designed to make it easier to create triples programmatically.


Method Summary
 void addValue(PredicateNode predicate, ObjectNode object)
          Add a new triple with this as the subject, the given predicate and object.
 void addValue(URI predicate, Object object)
           
 void addValue(URI predicate, Resource object)
           
 void addValue(URI predicate, String lexicalValue)
           
 void addValue(URI predicate, String lexicalValue, String language)
           
 void addValue(URI predicate, String lexicalValue, URI dataType)
           
 void addValue(URI predicate, URI object)
           
 ClosableIterator<ObjectNode> getObjects(PredicateNode predicate)
          With this as the subject and using the given predicate return all the objects.
 ClosableIterator<ObjectNode> getObjects(URI predicate)
           
 ClosableIterator<SubjectNode> getSubjects(PredicateNode predicate)
          With this as the object and using the given predicate return all the subjects.
 ClosableIterator<SubjectNode> getSubjects(URI predicate)
           
 Node getUnderlyingNode()
          Returns the node that the resource represents - either a BlankNode or a URIReference.
 boolean isURIReference()
          Returns true if this is a URIReference, otherwise it's a BlankNode.
 void removeSubject(SubjectNode subject, PredicateNode predicate)
          Remove the triple with this as the object, the given subject and predicate.
 void removeSubject(URI subject, URI predicate)
           
 void removeValue(PredicateNode predicate, ObjectNode object)
          Remove the triple with this as the subject, the given predicate and object.
 void removeValue(URI predicate, Object object)
           
 void removeValue(URI predicate, Resource object)
           
 void removeValue(URI predicate, String lexicalValue)
           
 void removeValue(URI predicate, String lexicalValue, String language)
           
 void removeValue(URI predicate, String lexicalValue, URI dataType)
           
 void removeValue(URI predicate, URI object)
           
 void removeValues(PredicateNode predicate)
          Remove all the triples with this as the subject and the given predicate.
 void removeValues(URI predicate)
           
 void setValue(PredicateNode predicate, ObjectNode object)
          Remove any other triples with this as the subject, the given predicate and any object and add a new triple with this as the subject and the given predicate and object.
 void setValue(URI predicate, Object object)
           
 void setValue(URI predicate, Resource object)
           
 void setValue(URI predicate, String lexicalValue)
           
 void setValue(URI predicate, String lexicalValue, String language)
           
 void setValue(URI predicate, String lexicalValue, URI dataType)
           
 void setValue(URI predicate, URI object)
           
 
Methods inherited from interface org.jrdf.graph.URIReference
equals, getURI, hashCode
 
Methods inherited from interface org.jrdf.graph.TypedNodeVisitable
accept
 
Methods inherited from interface org.jrdf.graph.TypedNodeVisitable
accept
 
Methods inherited from interface org.jrdf.graph.TypedNodeVisitable
accept
 
Methods inherited from interface org.jrdf.graph.BlankNode
equals, hashCode
 
Methods inherited from interface org.jrdf.graph.TypedNodeVisitable
accept
 
Methods inherited from interface org.jrdf.graph.TypedNodeVisitable
accept
 

Method Detail

isURIReference

boolean isURIReference()
Returns true if this is a URIReference, otherwise it's a BlankNode.

Returns:
true if this is a URIReference, otherwise it's a BlankNode.

addValue

void addValue(PredicateNode predicate,
              ObjectNode object)
              throws GraphException
Add a new triple with this as the subject, the given predicate and object.

Parameters:
predicate - the existing predicate in the graph to create the triple with.
object - the existing object in the graph to create the triple with.
Throws:
GraphException - if the predicate or object do not exist in the graph.

addValue

void addValue(URI predicate,
              URI object)
              throws GraphException
Throws:
GraphException

addValue

void addValue(URI predicate,
              String lexicalValue)
              throws GraphException
Throws:
GraphException

addValue

void addValue(URI predicate,
              Resource object)
              throws GraphException
Throws:
GraphException

addValue

void addValue(URI predicate,
              Object object)
              throws GraphException
Throws:
GraphException

addValue

void addValue(URI predicate,
              String lexicalValue,
              String language)
              throws GraphException
Throws:
GraphException

addValue

void addValue(URI predicate,
              String lexicalValue,
              URI dataType)
              throws GraphException
Throws:
GraphException

setValue

void setValue(PredicateNode predicate,
              ObjectNode object)
              throws GraphException
Remove any other triples with this as the subject, the given predicate and any object and add a new triple with this as the subject and the given predicate and object. This many that multiple object values will be replaced by a single object value.

Parameters:
predicate - the existing predicate in the graph to set.
object - the existing object in the graph to set.
Throws:
GraphException - if the predicate or object do not exist in the graph.

setValue

void setValue(URI predicate,
              URI object)
              throws GraphException
Throws:
GraphException

setValue

void setValue(URI predicate,
              String lexicalValue)
              throws GraphException
Throws:
GraphException

setValue

void setValue(URI predicate,
              Resource object)
              throws GraphException
Throws:
GraphException

setValue

void setValue(URI predicate,
              Object object)
              throws GraphException
Throws:
GraphException

setValue

void setValue(URI predicate,
              String lexicalValue,
              String language)
              throws GraphException
Throws:
GraphException

setValue

void setValue(URI predicate,
              String lexicalValue,
              URI dataType)
              throws GraphException
Throws:
GraphException

removeValue

void removeValue(PredicateNode predicate,
                 ObjectNode object)
                 throws GraphException
Remove the triple with this as the subject, the given predicate and object.

Parameters:
predicate - the existing predicate in the graph to remove.
object - the existing object in the graph to remove.
Throws:
GraphException - if the predicate or object does not exist in the graph.

removeValue

void removeValue(URI predicate,
                 URI object)
                 throws GraphException
Throws:
GraphException

removeValue

void removeValue(URI predicate,
                 String lexicalValue)
                 throws GraphException
Throws:
GraphException

removeValue

void removeValue(URI predicate,
                 Resource object)
                 throws GraphException
Throws:
GraphException

removeValue

void removeValue(URI predicate,
                 Object object)
                 throws GraphException
Throws:
GraphException

removeValue

void removeValue(URI predicate,
                 String lexicalValue,
                 String language)
                 throws GraphException
Throws:
GraphException

removeValue

void removeValue(URI predicate,
                 String lexicalValue,
                 URI dataType)
                 throws GraphException
Throws:
GraphException

removeValues

void removeValues(PredicateNode predicate)
                  throws GraphException
Remove all the triples with this as the subject and the given predicate.

Parameters:
predicate - the existing predicate in the graph.
Throws:
GraphException - if the predicate does not exist in the graph.

removeValues

void removeValues(URI predicate)
                  throws GraphException
Throws:
GraphException

removeSubject

void removeSubject(SubjectNode subject,
                   PredicateNode predicate)
                   throws GraphException
Remove the triple with this as the object, the given subject and predicate.

Parameters:
subject - the existing subject in the graph to remove.
predicate - the existing predicate in the graph to remove.
Throws:
GraphException - if the subject or predicate do not exist in the graph.

removeSubject

void removeSubject(URI subject,
                   URI predicate)
                   throws GraphException
Throws:
GraphException

getObjects

ClosableIterator<ObjectNode> getObjects(PredicateNode predicate)
                                        throws GraphException
With this as the subject and using the given predicate return all the objects.

Parameters:
predicate - the existing predicate in the graph to use to find the objects.
Returns:
all the objects in the graph with this resource as the subject and the given predicate.
Throws:
GraphException - if the subject or predicate do not exist in the graph.

getObjects

ClosableIterator<ObjectNode> getObjects(URI predicate)
                                        throws GraphException
Throws:
GraphException

getSubjects

ClosableIterator<SubjectNode> getSubjects(PredicateNode predicate)
                                          throws GraphException
With this as the object and using the given predicate return all the subjects.

Parameters:
predicate - the existing predicate in the graph to use to find the subjects.
Returns:
all the objects in the graph with this resource as the subject and the given predicate.
Throws:
GraphException - if the subject or predicate do not exist in the graph.

getSubjects

ClosableIterator<SubjectNode> getSubjects(URI predicate)
                                          throws GraphException
Throws:
GraphException

getUnderlyingNode

Node getUnderlyingNode()
Returns the node that the resource represents - either a BlankNode or a URIReference.

Returns:
the BlankNode or URIReference.