Module: Axiom::Algebra::Join::Methods

Extended by:
Axiom::Aliasable
Defined in:
lib/axiom/algebra/join.rb

Instance Method Summary collapse

Methods included from Axiom::Aliasable

inheritable_alias

Instance Method Details

#join(other) {|relation| ... } ⇒ Join, Restriction

Return a relation that is the join of two relations

Examples:

natural join

join = relation.join(other)

theta-join using a block

join = relation.join(other) { |r| r.a.gte(r.b) }

Parameters:

  • other (Relation)

    the other relation to join

Yields:

  • (relation)

    optional block to restrict the tuples with

Yield Parameters:

  • relation (Relation)

    the context to evaluate the restriction with

Yield Returns:

  • (Function, #call)

    predicate to restrict the tuples with

Returns:



192
193
194
195
196
# File 'lib/axiom/algebra/join.rb', line 192

def join(other)
  relation = Join.new(self, other)
  relation = relation.restrict { |context| yield context } if block_given?
  relation
end