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, toStringpublic Relation(Heading heading, RelationBuffer relationBuffer)
heading - -relationBuffer - -public Relation aggregate(java.util.Map<NameIdentifier,java.lang.String> expressions)
IRelationAGGREGATE.aggregate in interface IRelationexpressions - 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
IRelationcontains in interface IRelationr - 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
IRelationcontainsUsing in interface IRelationr - 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
IRelationcontainsUsing in interface IRelationt - 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
IRelationDIVIDEBYPER.dividedyper in interface IRelationdivisor - 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.Objectpublic Relation extend(java.util.Map<NameIdentifier,java.lang.String> extendExpressions)
IRelationEXTEND.extend in interface IRelationextendExpressions - 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()
IRelationgetHostExpressionEvaluationText in interface IRelationpublic RelationBuffer getRelationBuffer()
IRelationgetRelationBuffer in interface IRelationpublic Relation group(java.util.Map<NameIdentifier,java.util.Set<NameIdentifier>> groupAttributes) throws EvaluationException
IRelationGROUP.group in interface IRelationgroupAttributes - 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)
IRelationGTCLOSE.gtclose in interface IRelationmatchby - 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.Objectpublic IRelation intersect(IRelation intersectWith) throws EvaluationException
IRelationINTERSECT.intersect in interface IRelationintersectWith - 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
IRelationINTERSECT.intersectUsing in interface IRelationintersectWith - 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()
IRelationIRelation.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
IRelationJOIN.join in interface IRelationjoinWith - 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
IRelationJOIN.joinUsing in interface IRelationjoinWith - 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
IRelationLEFTJOIN.leftJoin in interface IRelationleftjoinwith - 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
IRelationLEFTJOIN.leftJoinUsing in interface IRelationleftjoinwith - 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
IRelationMINUS.minus in interface IRelationsubtrahend - the relation to subtract from this oneEvaluationException - If immediate evaluation was performed and that evaluation raised an exceptionpublic IRelation minusFrom(IRelation minuend) throws EvaluationException
IRelationMINUSminusFrom in interface IRelationminuend - 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
IRelationMINUS.minusUsing in interface IRelationsubtrahend - 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
IRelationMINUSUSINGminusUsingFrom in interface IRelationminuend - 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
IRelationPACK.pack in interface IRelationpackAttributes - 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
IRelationPROJECT.project in interface IRelationattributes - 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
IRelationRENAME.rename in interface IRelationrenames - 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)
IRelationRESTRICT.public IRelation semijoin(IRelation semiJoinWith) throws EvaluationException, ValidationException
IRelationSEMIJOIN.semijoin in interface IRelationsemiJoinWith - 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
IRelationSEMIJOINsemiJoinFor in interface IRelationsemiJoinLeftArg - 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
IRelationSEMIJOIN.semijoinUsing in interface IRelationsemiJoinWith - 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
IRelationSEMIJOINsemijoinUsingFor in interface IRelationsemiJoinLeftArg - 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
IRelationSEMIMINUS.semiminus in interface IRelationsemiDiffWith - 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
IRelationSEMIMINUSsemiminusFor in interface IRelationsemiMinusLeftArg - 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
IRelationSEMIMINUS.semiminusUsing in interface IRelationsemiDiffWith - 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
IRelationSEMIMINUSsemiminusUsingFor in interface IRelationsemiMinusLeftArg - 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)
IRelationSUMMARIZEBY.summarizeby in interface IRelationbyAttributes - 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
IRelationTCLOSE.tclose in interface IRelationmatchby - 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)
IRelationTRANSFORM.public Relation ungroup(NameIdentifier... ungroupAttributes) throws EvaluationException
IRelationUNGROUP.ungroup in interface IRelationungroupAttributes - 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
IRelationUNIONunion in interface IRelationunionWith - 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
IRelationUNIONunionUsing in interface IRelationunionWith - 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
IRelationUNPACKunpack in interface IRelationunpackAttributes - 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
IRelationXMINUSxminus in interface IRelationsymdiffWith - 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
IRelationXMINUSxminusUsing in interface IRelationsymdiffWith - 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