org.jrdf.graph
Interface TripleFactory

All Known Implementing Classes:
AbstractTripleFactory

public interface TripleFactory

A Triple Factory is a class which defines the creation of triples and certain sets of triples. This includes generating triples for reification, containers and collections.

Version:
$Revision: 1045 $
Author:
Andrew Newman

Method Summary
 void addAlternative(SubjectNode subjectNode, Alternative<ObjectNode> alternative)
          Inserts a alternative using the given subject.
 void addBag(SubjectNode subjectNode, Bag<ObjectNode> bag)
          Inserts a bag using the given subject.
 void addCollection(SubjectNode firstNode, Collection<ObjectNode> collection)
          Inserts a collection using the given subject.
 void addSequence(SubjectNode subjectNode, Sequence<ObjectNode> sequence)
          Inserts a sequence using the given subject.
 Triple createTriple(SubjectNode subject, PredicateNode predicate, ObjectNode object)
          Creates a new triple to be used in the graph.
 void reifyTriple(SubjectNode subjectNode, PredicateNode predicateNode, ObjectNode objectNode, SubjectNode reificationNode)
          Reifies a triple.
 void reifyTriple(Triple triple, SubjectNode reificationNode)
          Reifies a triple.
 

Method Detail

createTriple

Triple createTriple(SubjectNode subject,
                    PredicateNode predicate,
                    ObjectNode object)
                    throws TripleFactoryException
Creates a new triple to be used in the graph. Does not add it to an associated graph. Use @see Graph#add.

Parameters:
subject - The subject of the statement.
predicate - The predicate of the statement.
object - The object of the statement.
Returns:
the newly created triple object.
Throws:
TripleFactoryException - If the resource failed to be created.

reifyTriple

void reifyTriple(SubjectNode subjectNode,
                 PredicateNode predicateNode,
                 ObjectNode objectNode,
                 SubjectNode reificationNode)
                 throws TripleFactoryException,
                        AlreadyReifiedException
Reifies a triple. A triple made up of the first three nodes is added to graph and the reificationNode is used to reify the triple.

Parameters:
subjectNode - the subject of the triple.
predicateNode - the predicate of the triple.
objectNode - the object of the triple.
reificationNode - a node denoting the reified triple.
Throws:
TripleFactoryException - If the resource failed to be added.
AlreadyReifiedException - If there was already a triple URI for the given triple.

reifyTriple

void reifyTriple(Triple triple,
                 SubjectNode reificationNode)
                 throws TripleFactoryException,
                        AlreadyReifiedException
Reifies a triple. The triple added to the graph and the reificationNode is used to reify the triple.

Parameters:
triple - the triple to be reified.
reificationNode - a node denoting the reified triple.
Throws:
TripleFactoryException - If the resource failed to be added.
AlreadyReifiedException - If there was already a triple URI for the given triple.

addAlternative

void addAlternative(SubjectNode subjectNode,
                    Alternative<ObjectNode> alternative)
                    throws TripleFactoryException
Inserts a alternative using the given subject. The subject is also the object of a proceeding statement that identifies the container.

Parameters:
subjectNode - the subject node of the triple.
alternative - the alternative to add.
Throws:
TripleFactoryException - If the resources were failed to be added.

addBag

void addBag(SubjectNode subjectNode,
            Bag<ObjectNode> bag)
            throws TripleFactoryException
Inserts a bag using the given subject. The subject is also the object of a proceeding statement that identifies the container.

Parameters:
subjectNode - the subject node of the triple.
bag - the bag to add.
Throws:
TripleFactoryException - If the resources were failed to be added.

addSequence

void addSequence(SubjectNode subjectNode,
                 Sequence<ObjectNode> sequence)
                 throws TripleFactoryException
Inserts a sequence using the given subject. The subject is also the object of a proceeding statement that identifies the container.

Parameters:
subjectNode - the subject node of the triple.
sequence - the sequence to add.
Throws:
TripleFactoryException - If the resources were failed to be added.

addCollection

void addCollection(SubjectNode firstNode,
                   Collection<ObjectNode> collection)
                   throws TripleFactoryException
Inserts a collection using the given subject. The subject is also the object of a proceeding statement that identifies the collection.

Parameters:
firstNode - the subject node of the triple.
collection - the collection to add.
Throws:
TripleFactoryException - If the resources were failed to be added.