Module: Alf::Relvar

Extended by:
Forwardable
Includes:
Algebra::Operand, Lang::ObjectOriented
Included in:
Base, Fake, Memory, ReadOnly, Virtual
Defined in:
lib/alf/relvar.rb,
lib/alf/relvar/fake.rb,
lib/alf/relvar/base.rb,
lib/alf/relvar/memory.rb,
lib/alf/relvar/virtual.rb,
lib/alf/relvar/read_only.rb

Defined Under Namespace

Classes: Base, Fake, Memory, ReadOnly, Virtual

Instance Attribute Summary collapse

Instance Method Summary collapse

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

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

Methods included from Lang::ObjectOriented::AggregationMethods

def_aggregator_method

Methods included from Algebra::Operand

#attr_list, coerce, #heading, #keys, #resulting_type, #to_ascii_tree, #to_cog, #type_check

Instance Attribute Details

#exprObject (readonly)

Returns the value of attribute expr


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

def expr
  @expr
end

Instance Method Details

#affect(value) ⇒ Object


54
55
56
57
# File 'lib/alf/relvar.rb', line 54

def affect(value)
  delete
  insert(value)
end

#delete(predicate = Predicate.tautology) ⇒ Object

Raises:


63
64
65
# File 'lib/alf/relvar.rb', line 63

def delete(predicate = Predicate.tautology)
  raise NotSupportedError
end

#each(&bl) ⇒ Object


23
24
25
# File 'lib/alf/relvar.rb', line 23

def each(&bl)
  to_cog.each(&bl)
end

#empty!(msg = "relvar is empty") ⇒ Object

Raises:


32
33
34
35
# File 'lib/alf/relvar.rb', line 32

def empty!(msg = "relvar is empty")
  raise FactAssertionError, msg unless empty?
  self
end

#empty?Boolean


27
28
29
30
# File 'lib/alf/relvar.rb', line 27

def empty?
  to_cog.each{|_| return false }
  true
end

#initialize(expr = nil) ⇒ Object


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

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

#insert(tuples) ⇒ Object

Raises:


59
60
61
# File 'lib/alf/relvar.rb', line 59

def insert(tuples)
  raise NotSupportedError
end

#lockObject

Raises:


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

def lock(*)
  raise NotSupportedError
end

#not_empty!(msg = "relvar is not empty") ⇒ Object

Raises:


37
38
39
40
# File 'lib/alf/relvar.rb', line 37

def not_empty!(msg = "relvar is not empty")
  raise FactAssertionError, msg if empty?
  self
end

#safe(*args, &bl) ⇒ Object


75
76
77
# File 'lib/alf/relvar.rb', line 75

def safe(*args, &bl)
  Safe.new(self, *args, &bl)
end

#sizeObject


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

def size
  to_a.size
end

#to_relationObject


83
84
85
# File 'lib/alf/relvar.rb', line 83

def to_relation
  to_cog.to_relation
end

#to_relvarObject


79
80
81
# File 'lib/alf/relvar.rb', line 79

def to_relvar
  self
end

#typeObject


17
18
19
# File 'lib/alf/relvar.rb', line 17

def type
  @type ||= Relation[heading]
end

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

Raises:


67
68
69
# File 'lib/alf/relvar.rb', line 67

def update(updating, predicate = Predicate.tautology)
  raise NotSupportedError
end

#upsert(tuples) ⇒ Object


71
72
73
# File 'lib/alf/relvar.rb', line 71

def upsert(tuples)
  empty? ? insert(tuples) : update(tuples)
end

#valueObject


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

def value
  to_relation
end