Class: Alf::Relvar::Virtual

Inherits:
Object
  • Object
show all
Includes:
Alf::Relvar
Defined in:
lib/alf-relvar/alf/relvar/virtual.rb

Instance Attribute Summary collapse

Attributes included from Support::Bindable

#connection

Instance Method Summary collapse

Methods included from Alf::Relvar

#affect, #each, #empty!, #empty?, #lock, #not_empty!, #safe, #to_relation, #to_relvar, #type, #upsert, #value

Methods included from Lang::ObjectOriented

new

Methods included from Lang::ObjectOriented::RenderingMethods

def_renderer_method, #to_a, #to_array

Methods included from Lang::ObjectOriented::AlgebraMethods

#!~, #&, #*, #+, #-, #=~, #allbut, def_operator_method, #tuple_extract

Methods included from Lang::ObjectOriented::AggregationMethods

def_aggregator_method

Methods included from Algebra::Operand

#attr_list, coerce, #to_dot, #to_relation

Methods included from Support::Bindable

#bind, #bound?, #connection!

Constructor Details

#initialize(expr, connection = nil) ⇒ Virtual

Returns a new instance of Virtual.



6
7
8
9
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 6

def initialize(expr, connection = nil)
  @expr = expr
  @connection = connection
end

Instance Attribute Details

#exprObject (readonly)

Returns the value of attribute expr.



10
11
12
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 10

def expr
  @expr
end

Instance Method Details

#delete(predicate = Predicate.tautology) ⇒ Object

Delete all tuples of this relation variable.



36
37
38
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 36

def delete(predicate = Predicate.tautology)
  Update::Deleter.new.call(expr, predicate)
end

#headingObject

Static analysis & inference



14
15
16
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 14

def heading
  expr.heading
end

#insert(tuples) ⇒ Object

Inserts some tuples inside this relation variable.



25
26
27
28
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 25

def insert(tuples)
  tuples = [ tuples ] if TupleLike===tuples
  Update::Inserter.new.call(expr, tuples)
end

#keysObject



18
19
20
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 18

def keys
  expr.keys
end

#to_cogObject

to_xxx



42
43
44
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 42

def to_cog
  connection!.cog(expr)
end

#to_lispyObject



46
47
48
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 46

def to_lispy
  expr.to_lispy
end

#to_sObject



50
51
52
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 50

def to_s
  "Relvar::Virtual(#{expr})"
end

#update(computation, predicate = Predicate.tautology) ⇒ Object

Updates all tuples of this relation variable.



31
32
33
# File 'lib/alf-relvar/alf/relvar/virtual.rb', line 31

def update(computation, predicate = Predicate.tautology)
  Update::Updater.new.call(expr, computation, predicate)
end