Module: Alf::Relvar

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

Defined Under Namespace

Classes: Base, Fake, ReadOnly, Virtual

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

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

Methods included from Lang::ObjectOriented::AggregationMethods

def_aggregator_method

Methods included from Algebra::Operand

#attr_list, coerce, #heading, #keys, #to_cog, #to_dot

Instance Method Details

#affect(value) ⇒ Object



57
58
59
60
# File 'lib/alf-relvar/alf/relvar.rb', line 57

def affect(value)
  delete
  insert(value)
end

#bind(connection) ⇒ Object



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

def bind(connection)
  expr.bind(connection)
end

#bound?Boolean

Returns:

  • (Boolean)


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

def bound?
  expr.bound?
end

#connectionObject



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

def connection
  expr.connection
end

#connection!Object



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

def connection!
  expr.connection!
end

#connection=(conn) ⇒ Object



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

def connection=(conn)
  expr.connection = conn
end

#delete(predicate = Predicate.tautology) ⇒ Object

Raises:



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

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

#each(&bl) ⇒ Object



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

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

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

Raises:



39
40
41
42
# File 'lib/alf-relvar/alf/relvar.rb', line 39

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

#empty?Boolean

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/alf-relvar/alf/relvar.rb', line 34

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

#insert(tuples) ⇒ Object

Raises:



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

def insert(tuples)
  raise NotSupportedError
end

#lockObject

Raises:



53
54
55
# File 'lib/alf-relvar/alf/relvar.rb', line 53

def lock(*)
  raise NotSupportedError
end

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

Raises:



44
45
46
47
# File 'lib/alf-relvar/alf/relvar.rb', line 44

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

#safe(*args, &bl) ⇒ Object



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

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

#to_lispyObject

Raises:

  • (NotImplementedError)


86
87
88
# File 'lib/alf-relvar/alf/relvar.rb', line 86

def to_lispy
  raise NotImplementedError
end

#to_relationObject



90
91
92
93
94
# File 'lib/alf-relvar/alf/relvar.rb', line 90

def to_relation
  type.new(to_cog.to_set)
rescue NotSupportedError
  Relation.coerce(to_cog.each.to_a)
end

#to_relvarObject



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

def to_relvar
  self
end

#typeObject



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

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

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

Raises:



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

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

#upsert(tuples) ⇒ Object



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

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

#valueObject



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

def value
  to_relation
end