public class Relation extends TupleContainer implements IRelation
Constructor and Description |
---|
Relation(Heading heading,
RelationBuffer relationBuffer)
Creates the AbstractRelation
|
Modifier and Type | Method and Description |
---|---|
Relation |
aggregate(java.util.Map<NameIdentifier,java.lang.String> expressions)
Computes the aggregation of this relation, per the given aggregation specs.
|
boolean |
contains(IRelation r)
Checks whether this relation contains all tuples of the given relation.
|
boolean |
contains(Tuple t)
Checks if this container contains the given tuple
|
boolean |
containsUsing(IRelation r,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Checks whether this relation contains all tuples of the given relation, with the given usingAttributes treated in 'USING' mode.
|
boolean |
containsUsing(Tuple t,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Checks whether this relation contains the given tuple, with the given usingAttributes treated in 'USING' mode.
|
IRelation |
dividedyper(IRelation divisor,
IRelation per)
Computes the division of this relation by the given divisor, per the given 'per' relation.
|
boolean |
equals(java.lang.Object obj) |
Relation |
extend(java.util.Map<NameIdentifier,java.lang.String> extendExpressions)
Computes the extend of this relation, according to the specs provided in extendExpressions.
|
java.lang.String |
getHostExpressionEvaluationText()
Gets The expression text for the expression to be evaluated by the host
|
RelationBuffer |
getRelationBuffer()
Gets the RelationBuffer holding the tuples collection.
|
Relation |
group(java.util.Map<NameIdentifier,java.util.Set<NameIdentifier>> groupAttributes)
Computes the grouping of this relation, according to the specs provided in groupAttributes.
|
Relation |
gtclose(java.util.Map<NameIdentifier,NameIdentifier> matchby,
java.util.Map<NameIdentifier,java.lang.String> expressions)
Computes the generalized transitive closure of this relation, according to the specs provided in matchby and expressions.
|
int |
hashCode() |
IRelation |
intersect(IRelation intersectWith)
Computes the intersection of this relation with the given one.
|
IRelation |
intersectUsing(IRelation intersectWith,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the intersection of this relation with the given one, with explicitly specified attributes (and only those) to be treated in 'USING' mode.
|
boolean |
isProperSubSetOf(Relation relation)
Checks if this container contains all of the tuples in the given one
|
boolean |
isProperSuperSetOf(Relation relation)
Checks if this container contains all of the tuples in the given one
|
boolean |
isProxy()
Checks whether this object is a proxy for a relation.
|
boolean |
isSubSetOf(Relation relation)
Checks if this container is a subset of the given one
|
boolean |
isSuperSetOf(Relation relation)
Checks if this container contains all of the tuples in the given one
|
IRelation |
join(IRelation joinWith)
Computes the join of this relation with the given one, with explicitly specified attributes (and only those) to be treated in 'USING' mode.
|
IRelation |
joinUsing(IRelation joinWith,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the join of this relation with the given one, with explicitly specified attributes (and only those) to be treated in 'USING' mode.
|
IRelation |
leftJoin(IRelation leftjoinwith,
java.util.Map<NameIdentifier,java.lang.String> missingAttributeValueExpressions)
Computes the leftjoin of this relation with the given one.
|
IRelation |
leftJoinUsing(IRelation leftjoinwith,
java.util.Map<NameIdentifier,java.lang.String> missingAttributeValueExpressions,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the leftjoin of this relation with the given one.
|
IRelation |
minus(IRelation subtrahend)
Computes the difference of this relation with the given subtrahend, with explicitly specified attributes (and only those) to be treated in 'USING' mode.
|
IRelation |
minusFrom(IRelation minuend)
Computes the difference between the given relation and this one.
|
IRelation |
minusUsing(IRelation subtrahend,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the difference of this relation with the given subtrahend, with explicitly specified attributes (and only those) to be treated in 'USING' mode.
|
IRelation |
minusUsingFrom(IRelation minuend,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the difference between the given relation and this one, with the attributes mentioned in usingAttributes treated in 'USING' mode.
|
IRelation |
pack(NameIdentifier... packAttributes)
Computes an pack of this relation.
|
Relation |
project(NameIdentifier... attributes)
Computes the projection of this relation over the attributes provided.
|
Relation |
rename(java.util.Map<NameIdentifier,NameIdentifier> renames)
Computes the rename of this relation according to the provided rename specs.
|
Relation |
restrict(java.lang.String restrictExpression)
Computes the restriction of this relation to the set of tuples that satisfy the given boolean expression.
|
IRelation |
semijoin(IRelation semiJoinWith)
Computes the semijoin between this relation and the given one.
|
IRelation |
semiJoinFor(IRelation semiJoinLeftArg)
Computes the semijoin between the given relation and this one.
|
IRelation |
semijoinUsing(IRelation semiJoinWith,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the semijoin between this relation and the given one.
|
IRelation |
semijoinUsingFor(IRelation semiJoinLeftArg,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the semijoin between the given relation and this one, with the attributes mentioned in usingAttributes treated in 'USING' mode.
|
IRelation |
semiminus(IRelation semiDiffWith)
Computes the semidifference between this relation and the given one.
|
IRelation |
semiminusFor(IRelation semiMinusLeftArg)
Computes the semiminus between the given relation and this one.
|
IRelation |
semiminusUsing(IRelation semiDiffWith,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the semidifference between this relation and the given one.
|
IRelation |
semiminusUsingFor(IRelation semiMinusLeftArg,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the semiminus between the given relation and this one, with the attributes mentioned in usingAttributes treated in 'USING' mode.
|
Relation |
summarizeby(java.util.Set<NameIdentifier> byAttributes,
java.util.Map<NameIdentifier,java.lang.String> expressions)
Computes the summaries specified by expressions groups of tuples in this relation, with the grouping as specified in byAttributes.
|
Relation |
tclose(java.util.Map<NameIdentifier,NameIdentifier> matchby)
Computes the transitive closure of the given relation using the attribute matching as specified by matchby.
|
IRelation |
transform(java.util.Map<NameIdentifier,java.lang.String> transformSpecs)
Computes the specified transformation of this relation.
|
Relation |
ungroup(NameIdentifier... ungroupAttributes)
Computes the ungrouping of this relation using the specified ungroup attributes.
|
IRelation |
union(IRelation unionWith)
Computes the union of this relation with another one, with explicitly specified attributes (and only those) to be treated in 'USING' mode.
|
IRelation |
unionUsing(IRelation unionWith,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the union of this relation with another one, with explicitly specified attributes (and only those) to be treated in 'USING' mode.
|
IRelation |
unpack(NameIdentifier... unpackAttributes)
Computes an unpack of this relation.
|
IRelation |
xminus(IRelation symdiffWith)
Computes the symmetric difference between this relation and the given one.
|
IRelation |
xminusUsing(IRelation symdiffWith,
java.util.LinkedHashSet<NameIdentifier> usingAttributes)
Computes the symmetric difference between this relation and the given one, with the attributes mentioned in usingAttributes treated in 'USING' mode.
|
getHeading, getTupleCollectionBuffer, iterator, printBodyEscapedWithBodyHeaderWithTypeNames, printBodyEscapedWithoutBodyHeaderWithoutTypeNames, printBodyEscapedWithoutBodyHeaderWithTypeNames, printBodyWithoutBodyHeaderWithoutTypeNames, printBodyWithoutBodyHeaderWithTypeNames, printBodyXMLWithBodyHeader, printBodyXMLWithoutBodyHeader, printValueEscapedWithoutTypeNames, printValueEscapedWithTypeNames, printValueWithoutTypeNames, printValueWithTypeNames, printValueXML, size, toString
public Relation(Heading heading, RelationBuffer relationBuffer)
heading
- -relationBuffer
- -public Relation aggregate(java.util.Map<NameIdentifier,java.lang.String> expressions)
IRelation
AGGREGATE
.aggregate
in interface IRelation
expressions
- the map defining the names for the attributes holding the computed aggregation values in the result, and the expressions texts of the expressions for computing thempublic final boolean contains(IRelation r) throws EvaluationException
IRelation
contains
in interface IRelation
r
- the relation to be checked for containment within this relationEvaluationException
- If immediate evaluation was attempted and that evaluation failed for any reasonpublic final boolean contains(Tuple t)
public final boolean containsUsing(IRelation r, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException
IRelation
containsUsing
in interface IRelation
r
- the relation to be checked for containment within this relationusingAttributes
- the in-order list of interval-typed attributes to be treated in 'USING' mode for the intersection and the packing of the resultEvaluationException
- If immediate evaluation was attempted and that evaluation failed for any reasonpublic final boolean containsUsing(Tuple t, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException
IRelation
containsUsing
in interface IRelation
t
- the tuple to be checked for containment in this relationusingAttributes
- the in-order list of interval-typed attributes to be treated in 'USING' mode for the intersection and the packing of the resultEvaluationException
- If immediate evaluation was attempted and that evaluation failed for any reasonpublic IRelation dividedyper(IRelation divisor, IRelation per) throws ValidationException, EvaluationException
IRelation
DIVIDEBYPER
.dividedyper
in interface IRelation
divisor
- the divisor by which this relation is to be relationally dividedper
- the 'per' relation as per TTM divideValidationException
- If the given combination of relations do not constitute a valid relational division operationEvaluationException
- If immediate evaluation was attempted and that evaluation failed for any reasonpublic final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public Relation extend(java.util.Map<NameIdentifier,java.lang.String> extendExpressions)
IRelation
EXTEND
.extend
in interface IRelation
extendExpressions
- the map defining the names for the attributes holding the computed extend values in the result, and the expressions texts of the expressions for computing thempublic java.lang.String getHostExpressionEvaluationText()
IRelation
getHostExpressionEvaluationText
in interface IRelation
public RelationBuffer getRelationBuffer()
IRelation
getRelationBuffer
in interface IRelation
public Relation group(java.util.Map<NameIdentifier,java.util.Set<NameIdentifier>> groupAttributes) throws EvaluationException
IRelation
GROUP
.group
in interface IRelation
groupAttributes
- The specification of the groupings to be applied. Each entry consists of an attribute name for the relation-valued attribute in the result, and the set of attributes of this relation that that relation-typed attribute is to include.EvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic Relation gtclose(java.util.Map<NameIdentifier,NameIdentifier> matchby, java.util.Map<NameIdentifier,java.lang.String> expressions)
IRelation
GTCLOSE
.gtclose
in interface IRelation
matchby
- The specification of the closure's matching schemeexpressions
- the specifications of the expressions for determining the values of all the attributes of the involved relation that are not part of the closure's matching scheme (i.e. the attributes not mentioned in matchby)public final int hashCode()
hashCode
in class java.lang.Object
public IRelation intersect(IRelation intersectWith) throws EvaluationException
IRelation
INTERSECT
.intersect
in interface IRelation
intersectWith
- the relation to intersect with this oneEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation intersectUsing(IRelation intersectWith, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException
IRelation
INTERSECT
.intersectUsing
in interface IRelation
intersectWith
- the relation to intersect with this oneusingAttributes
- the in-order list of interval-typed attributes to be treated in 'USING' mode for the intersection and the packing of the resultEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic final boolean isProperSubSetOf(Relation relation)
relation
- the tuplecontainer to compare this one withpublic final boolean isProperSuperSetOf(Relation relation)
relation
- the tuplecontainer to compare this one withpublic final boolean isProxy()
IRelation
IRelation.getRelationBuffer()
method.public final boolean isSubSetOf(Relation relation)
relation
- the tuplecontainer to compare this one withpublic final boolean isSuperSetOf(Relation relation)
relation
- the tuplecontainer to compare this one withpublic IRelation join(IRelation joinWith) throws EvaluationException
IRelation
JOIN
.join
in interface IRelation
joinWith
- the relation to join with this oneEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation joinUsing(IRelation joinWith, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException
IRelation
JOIN
.joinUsing
in interface IRelation
joinWith
- the relation to join with this oneusingAttributes
- the names of the interval-typed attributes to be treated in 'USING' mode by the joinEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation leftJoin(IRelation leftjoinwith, java.util.Map<NameIdentifier,java.lang.String> missingAttributeValueExpressions) throws EvaluationException, ValidationException
IRelation
LEFTJOIN
.leftJoin
in interface IRelation
leftjoinwith
- the relation to leftjoin this one tomissingAttributeValueExpressions
- The map of attributeName to default value epxression texts for all the attributes that appear in the leftjoinwith argument and are not join attributesEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- if the leftjoinwith argument is not join-compatible with this one, or if the missingAttributeValueExpressions do not define a map with expressions of the appropriate type for all and exactly the attributes of the leftjoinwith argument that do not appear in this relationpublic IRelation leftJoinUsing(IRelation leftjoinwith, java.util.Map<NameIdentifier,java.lang.String> missingAttributeValueExpressions, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException, ValidationException
IRelation
LEFTJOIN
.leftJoinUsing
in interface IRelation
leftjoinwith
- the relation to leftjoin this one tomissingAttributeValueExpressions
- The map of attributeName to default value epxression texts for all the attributes that appear in the leftjoinwith argument and are not join attributesusingAttributes
- the names of the interval-typed attributes to be treated in 'USING' mode by the joinEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- if the leftjoinwith argument is not join-compatible with this one, or if the missingAttributeValueExpressions do not define a map with expressions of the appropriate type for all and exactly the attributes of the leftjoinwith argument that do not appear in this relationpublic IRelation minus(IRelation subtrahend) throws EvaluationException
IRelation
MINUS
.minus
in interface IRelation
subtrahend
- the relation to subtract from this oneEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation minusFrom(IRelation minuend) throws EvaluationException
IRelation
MINUS
minusFrom
in interface IRelation
minuend
- the relation that is the minuend in a relational difference in which we are the subtrahendEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation minusUsing(IRelation subtrahend, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException
IRelation
MINUS
.minusUsing
in interface IRelation
subtrahend
- the relation to be 'subtracted' from this one, with the specified usingAttributes being treated in 'using' modeusingAttributes
- the in-order list of interval-typed attributes to be treated in 'USING' mode for the difference and the subsequent packing of the resultEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation minusUsingFrom(IRelation minuend, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException
IRelation
MINUSUSING
minusUsingFrom
in interface IRelation
minuend
- the relation that is the minuend in a relational difference in which we are the subtrahendusingAttributes
- the interval-typed attributes over which this relation is to be unpackedEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation pack(NameIdentifier... packAttributes) throws EvaluationException
IRelation
PACK
.pack
in interface IRelation
packAttributes
- the interval-typed attributes over which this relation is to be packedEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic Relation project(NameIdentifier... attributes) throws EvaluationException
IRelation
PROJECT
.project
in interface IRelation
attributes
- the attributes to be retained in a projection of this relationEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic Relation rename(java.util.Map<NameIdentifier,NameIdentifier> renames) throws EvaluationException
IRelation
RENAME
.rename
in interface IRelation
renames
- the specification of the renames to be applied to this relation. Each entry consists of the attribute name for an attribute in this relation, and the attribute name for the corresponding attribute in the resulting relation.EvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic Relation restrict(java.lang.String restrictExpression)
IRelation
RESTRICT
.public IRelation semijoin(IRelation semiJoinWith) throws EvaluationException, ValidationException
IRelation
SEMIJOIN
.semijoin
in interface IRelation
semiJoinWith
- the relation to which this relation is to be semijoinedEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- if the given semiJoinWith argument is not join-compatible with this relationpublic IRelation semiJoinFor(IRelation semiJoinLeftArg) throws EvaluationException, ValidationException
IRelation
SEMIJOIN
semiJoinFor
in interface IRelation
semiJoinLeftArg
- the relation that is to be semijoined to this oneEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- If the given semiJoinLeftArg relation is not join-compatible with this onepublic IRelation semijoinUsing(IRelation semiJoinWith, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException, ValidationException
IRelation
SEMIJOIN
.semijoinUsing
in interface IRelation
semiJoinWith
- the relation to which this relation is to be semijoinedusingAttributes
- the interval-typed attributes that are to be treated in 'USING' mode by the semijoin. Must be a subset of the interval-typed attributes that are common between the heading of this relation and that of the semiJoinWith relation.EvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- if the given semiJoinWith argument is not join-compatible with this relationpublic IRelation semijoinUsingFor(IRelation semiJoinLeftArg, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException, ValidationException
IRelation
SEMIJOIN
semijoinUsingFor
in interface IRelation
semiJoinLeftArg
- the relation that is to be semijoined to this oneusingAttributes
- the interval-typed attributes over which this relation is to be unpackedEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- If the given semiJoinLeftArg relation is not join-compatible with this onepublic IRelation semiminus(IRelation semiDiffWith) throws EvaluationException, ValidationException
IRelation
SEMIMINUS
.semiminus
in interface IRelation
semiDiffWith
- the relation to which this relation is to be semidiffedEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- If the given semiDiffWith relation is not join-compatible with this onepublic IRelation semiminusFor(IRelation semiMinusLeftArg) throws EvaluationException, ValidationException
IRelation
SEMIMINUS
semiminusFor
in interface IRelation
semiMinusLeftArg
- the relation that is to be semijoined to this oneEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- If the given semiJoinLeftArg relation is not join-compatible with this onepublic IRelation semiminusUsing(IRelation semiDiffWith, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException, ValidationException
IRelation
SEMIMINUS
.semiminusUsing
in interface IRelation
semiDiffWith
- the relation to which this relation is to be semidiffedusingAttributes
- the interval-typed attributes that are to be treated in 'USING' mode by the semidifference. Must be a subset of the interval-typed attributes that are common between the heading of this relation and that of the semiDiffWith relation.EvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- If the given semiDiffWith relation is not join-compatible with this onepublic IRelation semiminusUsingFor(IRelation semiMinusLeftArg, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException, ValidationException
IRelation
SEMIMINUS
semiminusUsingFor
in interface IRelation
semiMinusLeftArg
- the relation that is to be semijoined to this oneusingAttributes
- the interval-typed attributes over which this relation is to be unpackedEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionValidationException
- If the given semiJoinLeftArg relation is not join-compatible with this onepublic Relation summarizeby(java.util.Set<NameIdentifier> byAttributes, java.util.Map<NameIdentifier,java.lang.String> expressions)
IRelation
SUMMARIZEBY
.summarizeby
in interface IRelation
byAttributes
- The set of attributes per which summaries are to be included in the result.expressions
- The map of summary attributes to be computed and the expressions for computing their values in the resultpublic Relation tclose(java.util.Map<NameIdentifier,NameIdentifier> matchby) throws EvaluationException
IRelation
TCLOSE
.tclose
in interface IRelation
matchby
- the specification of how attributes are matched in the closure to determine additional tuples in the resultEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation transform(java.util.Map<NameIdentifier,java.lang.String> transformSpecs)
IRelation
TRANSFORM
.public Relation ungroup(NameIdentifier... ungroupAttributes) throws EvaluationException
IRelation
UNGROUP
.ungroup
in interface IRelation
ungroupAttributes
- the relation-typed attributes of this relation that are to be ungrouped in the resultEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation union(IRelation unionWith) throws EvaluationException
IRelation
UNION
union
in interface IRelation
unionWith
- the relation to be unioned with this oneEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation unionUsing(IRelation unionWith, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException
IRelation
UNION
unionUsing
in interface IRelation
unionWith
- the relation to be unioned with this oneusingAttributes
- the in-order list of interval-typed attributes to be treated in 'USING' mode for the union and the packing of the resultEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation unpack(NameIdentifier... unpackAttributes) throws EvaluationException
IRelation
UNPACK
unpack
in interface IRelation
unpackAttributes
- the interval-typed attributes over which this relation is to be unpackedEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation xminus(IRelation symdiffWith) throws EvaluationException
IRelation
XMINUS
xminus
in interface IRelation
symdiffWith
- the relation to be symdiffed with this oneEvaluationException
- If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation xminusUsing(IRelation symdiffWith, java.util.LinkedHashSet<NameIdentifier> usingAttributes) throws EvaluationException
IRelation
XMINUS
xminusUsing
in interface IRelation
symdiffWith
- the relation to be symdiffed with this oneusingAttributes
- the interval-typed attributes over which this relation is to be unpackedEvaluationException
- If immediate evaluation was performed and that evaluation raised an exception