org.deri.iris.storage
Interface IRelation

All Known Implementing Classes:
SimpleRelation, View

public interface IRelation

The interface to all relation classes. The order of the tuples is given by the order of insertion. The access via index position is intended to allow for smart indexing, caching etc when using relation classes that support large amounts of data.


Method Summary
 boolean add(ITuple tuple)
          Add a tuple to the relation.
 boolean addAll(IRelation relation)
          Add all tuples in relation 'relation' to this relation.
 boolean contains(ITuple tuple)
           
 ITuple get(int index)
          Get a tuple at a specific index.
 int size()
          Get the current number of tuples in this relation.
 

Method Detail

add

boolean add(ITuple tuple)
Add a tuple to the relation. The tuple MUST have the same arity as all other tuples in the relation.

Parameters:
tuple - The (unique) tuple to add.
Returns:
true, if it was added, false if a tuple already exists in the relation with the same term values.

addAll

boolean addAll(IRelation relation)
Add all tuples in relation 'relation' to this relation. The tuples in 'relation' MUST have the same arity as all other tuples in this relation.

Parameters:
relation - The relation containing tuples to add.
Returns:
true if any tuples were actually added.

size

int size()
Get the current number of tuples in this relation.

Returns:
The number of tuples in the relation.

get

ITuple get(int index)
Get a tuple at a specific index.

Parameters:
index - The index of the tuple in the relation, 0 <= index < size().
Returns:
The tuple at the given index position.

contains

boolean contains(ITuple tuple)