Module: Alf::Relvar
Defined Under Namespace
Classes: Base, Fake, ReadOnly, Virtual
Instance Method Summary
collapse
new
def_renderer_method, #to_a, #to_array
#!~, #&, #*, #+, #-, #=~, #allbut, def_operator_method, #tuple_extract
def_aggregator_method
#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
22
23
24
|
# File 'lib/alf-relvar/alf/relvar.rb', line 22
def bound?
expr.bound?
end
|
#connection ⇒ Object
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
#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
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
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
62
63
64
|
# File 'lib/alf-relvar/alf/relvar.rb', line 62
def insert(tuples)
raise NotSupportedError
end
|
#lock ⇒ Object
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
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_lispy ⇒ Object
86
87
88
|
# File 'lib/alf-relvar/alf/relvar.rb', line 86
def to_lispy
raise NotImplementedError
end
|
#to_relation ⇒ Object
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_relvar ⇒ Object
82
83
84
|
# File 'lib/alf-relvar/alf/relvar.rb', line 82
def to_relvar
self
end
|
#type ⇒ Object
26
27
28
|
# File 'lib/alf-relvar/alf/relvar.rb', line 26
def type
@type ||= Relation[heading]
end
|
#update(updating, predicate = Predicate.tautology) ⇒ Object
#upsert(tuples) ⇒ Object
74
75
76
|
# File 'lib/alf-relvar/alf/relvar.rb', line 74
def upsert(tuples)
empty? ? insert(tuples) : update(tuples)
end
|
#value ⇒ Object
49
50
51
|
# File 'lib/alf-relvar/alf/relvar.rb', line 49
def value
to_relation
end
|