org.jrdf.graph.global.molecule
Interface Molecule

All Known Implementing Classes:
MoleculeImpl

public interface Molecule

A Collection all the statements of a particular group.

Version:
$Revision: 1226 $
Author:
Imran Khan

Method Summary
 Molecule add(Set<Triple> triples)
          Adds a set of triples to this molecule.
 Molecule add(Triple triple)
          Adds the given triple to the molecule.
 boolean contains(SubjectNode subject, PredicateNode predicate, ObjectNode object)
          Checks to see if the given triple exists within the molecule.
 boolean contains(Triple triple)
          Checks to see if the given triple exists within the molecule.
 Triple getHeadTriple()
          Returns the head triple of the molecule.
 SortedSet<Triple> getTriples()
          Returns all triples in the molecule.
 Iterator<Triple> iterator()
          Returns an iterator for the set of triples which make up this molecule.
 Molecule remove(Triple triple)
          Removes a triple from the molecule.
 int size()
          Number of triples contained in the molecule.
 Iterator<Triple> tailTriples()
          An iterator that contains tail triples i.e. all triples except head triple.
 

Method Detail

contains

boolean contains(Triple triple)
Checks to see if the given triple exists within the molecule.

Parameters:
triple - the triple to search for - does not currently support ANY_SUBJECT, etc.
Returns:
true if found.

contains

boolean contains(SubjectNode subject,
                 PredicateNode predicate,
                 ObjectNode object)
Checks to see if the given triple exists within the molecule.

Parameters:
subject - the subject to search for - does not currently support ANY_SUBJECT.
predicate - the predicate to search for - does not currently support ANY_PREDICATE.
object - the object to search for - does not currently support ANY_OBJECT.
Returns:
true if found.

iterator

Iterator<Triple> iterator()
Returns an iterator for the set of triples which make up this molecule.

Returns:
all the triples in the molecule.

add

Molecule add(Triple triple)
Adds the given triple to the molecule.

Parameters:
triple - the triple to add.
Returns:
a new molecule based on the current one plus the new triple.

add

Molecule add(Set<Triple> triples)
Adds a set of triples to this molecule.

Parameters:
triples - the set of triples.
Returns:
a new molecule based on the current one plus the new triples.

size

int size()
Number of triples contained in the molecule.

Returns:
the number of triples contains in the molecule.

getHeadTriple

Triple getHeadTriple()
Returns the head triple of the molecule.

Returns:
the head triple of the molecule.

tailTriples

Iterator<Triple> tailTriples()
An iterator that contains tail triples i.e. all triples except head triple.

Returns:
the iterator of tail triples.

remove

Molecule remove(Triple triple)
Removes a triple from the molecule.

Parameters:
triple - the triple to remove.
Returns:
a new Molecule that contains all triples except the one removed.

getTriples

SortedSet<Triple> getTriples()
Returns all triples in the molecule.

Returns:
all triples in the molecule.