TurtleDB
A mini distributed database system
ca.uqac.dim.turtledb.Relation Class Reference
Inheritance diagram for ca.uqac.dim.turtledb.Relation:

List of all members.

Public Member Functions

abstract Schema getSchema ()
final int getDegree ()
void setStreamingMode (boolean b)
final RelationIterator iterator ()
String toString ()
abstract void accept (QueryVisitor v) throws QueryVisitor.VisitorException
int getCardinality ()
abstract int tupleCount ()
boolean contains (Tuple tup)
abstract RelationIterator streamIterator ()
abstract RelationIterator cacheIterator ()
boolean isFragment ()
boolean isLeaf ()

Public Attributes

boolean m_streamingMode = false

Protected Member Functions

 Relation ()

Detailed Description

A relation is implemented as a map from a set of tuples (the relation's key) to a set of tuples

Author:
sylvain

Definition at line 28 of file Relation.java.


Constructor & Destructor Documentation

Empty constructor. Should only be called from children's constructors.

Definition at line 47 of file Relation.java.


Member Function Documentation

Determines if a relation contains a given tuple. Warning #1: this implementation is inefficient, as it enumerates all tuples until found. Warning #2: using contains resets any undergoing enumeration made on the relation.

Parameters:
tupThe tuple to look for
Returns:
True if the tuple is present, false otherwise

Reimplemented in ca.uqac.dim.turtledb.Table.

Definition at line 148 of file Relation.java.

Computes the cardinality of a relation. Except for instances of Table (which actually contain concrete tuples), calling this method will trigger the evaluation of the query tree and the enumeration of all tuples. It should be used sparingly.

Returns:
The number of tuples in the relation

Reimplemented in ca.uqac.dim.turtledb.Table.

Definition at line 120 of file Relation.java.

A relation's degree is the size of its schema.

Returns:
The relation's degree

Definition at line 56 of file Relation.java.

Determines if the query tree is a fragment. This is the case when the tree's root is a VariableTable.

Returns:
True if the query tree is a fragment, false otherwise

Reimplemented in ca.uqac.dim.turtledb.VariableTable.

Definition at line 180 of file Relation.java.

Determines if a given operator is at the leaf of the query tree. Only instances of Table and VariableTable may be leaves.

Returns:

Reimplemented in ca.uqac.dim.turtledb.Table, and ca.uqac.dim.turtledb.VariableTable.

Definition at line 191 of file Relation.java.

Sets the way of querying the relation's tuples

Parameters:
bTrue to evaluate in streaming mode, false otherwise

Definition at line 65 of file Relation.java.

Pretty-prints a relation to a string

Reimplemented in ca.uqac.dim.turtledb.VariableTable.

Definition at line 81 of file Relation.java.

abstract int ca.uqac.dim.turtledb.Relation.tupleCount ( ) [pure virtual]

Returns the number of actual tuples present in the query. This number is different from the cardinality of the query; it counts the number of tuples that are present in the leaves of the query tree.

Returns:
The tuple count

Implemented in ca.uqac.dim.turtledb.Table, ca.uqac.dim.turtledb.VariableTable, ca.uqac.dim.turtledb.NAryRelation, ca.uqac.dim.turtledb.BinaryRelation, ca.uqac.dim.turtledb.Join, and ca.uqac.dim.turtledb.UnaryRelation.


Member Data Documentation

Whether the enumeration of the relation's tuples is performed in "streaming" mode (vs. "cache" mode)

Definition at line 35 of file Relation.java.


The documentation for this class was generated from the following file: