Module: Bmg::Algebra
- Includes:
- Shortcuts
- Included in:
- Relation
- Defined in:
- lib/bmg/algebra.rb,
lib/bmg/algebra/shortcuts.rb
Defined Under Namespace
Modules: Shortcuts
Instance Method Summary
collapse
-
#allbut(butlist = []) ⇒ Object
-
#autosummarize(by = [], summarization = {}) ⇒ Object
-
#autowrap(options = {}) ⇒ Object
-
#constants(cs = {}) ⇒ Object
-
#extend(extension = {}) ⇒ Object
-
#group(attrs, as = :group, options = {}) ⇒ Object
-
#image(right, as = :image, on = [], options = {}) ⇒ Object
-
#join(right, on = []) ⇒ Object
-
#matching(right, on = []) ⇒ Object
-
#materialize ⇒ Object
-
#not_matching(right, on = []) ⇒ Object
-
#page(ordering, page_index, options) ⇒ Object
-
#project(attrlist = []) ⇒ Object
-
#rename(renaming = {}) ⇒ Object
-
#restrict(predicate) ⇒ Object
-
#spied(spy) ⇒ Object
-
#summarize(by, summarization = {}) ⇒ Object
-
#union(other, options = {}) ⇒ Object
-
#unspied ⇒ Object
Methods included from Shortcuts
#prefix, #rxmatch, #suffix
Instance Method Details
#allbut(butlist = []) ⇒ Object
4
5
6
7
|
# File 'lib/bmg/algebra.rb', line 4
def allbut(butlist = [])
return self if butlist.empty?
_allbut self.type.allbut(butlist), butlist
end
|
#autosummarize(by = [], summarization = {}) ⇒ Object
23
24
25
|
# File 'lib/bmg/algebra.rb', line 23
def autosummarize(by = [], summarization = {})
_autosummarize type = self.type.autosummarize(by, summarization), by, summarization
end
|
#autowrap(options = {}) ⇒ Object
14
15
16
|
# File 'lib/bmg/algebra.rb', line 14
def autowrap(options = {})
_autowrap self.type.autowrap(options), options
end
|
#constants(cs = {}) ⇒ Object
32
33
34
|
# File 'lib/bmg/algebra.rb', line 32
def constants(cs = {})
_constants self.type.constants(cs), cs
end
|
#extend(extension = {}) ⇒ Object
41
42
43
44
|
# File 'lib/bmg/algebra.rb', line 41
def extend(extension = {})
return self if extension.empty?
_extend self.type.extend(extension), extension
end
|
#group(attrs, as = :group, options = {}) ⇒ Object
51
52
53
|
# File 'lib/bmg/algebra.rb', line 51
def group(attrs, as = :group, options = {})
_group self.type.group(attrs, as), attrs, as, options
end
|
#image(right, as = :image, on = [], options = {}) ⇒ Object
60
61
62
|
# File 'lib/bmg/algebra.rb', line 60
def image(right, as = :image, on = [], options = {})
_image self.type.image(right.type, as, on, options), right, as, on, options
end
|
#join(right, on = []) ⇒ Object
69
70
71
|
# File 'lib/bmg/algebra.rb', line 69
def join(right, on = [])
_join self.type.join(right.type, on), right, on
end
|
#matching(right, on = []) ⇒ Object
83
84
85
|
# File 'lib/bmg/algebra.rb', line 83
def matching(right, on = [])
_matching self.type.matching(right.type, on), right, on
end
|
#materialize ⇒ Object
181
182
183
|
# File 'lib/bmg/algebra.rb', line 181
def materialize
Relation::Materialized.new(self)
end
|
#not_matching(right, on = []) ⇒ Object
92
93
94
|
# File 'lib/bmg/algebra.rb', line 92
def not_matching(right, on = [])
_not_matching self.type.not_matching(right.type, on), right, on
end
|
#page(ordering, page_index, options) ⇒ Object
101
102
103
|
# File 'lib/bmg/algebra.rb', line 101
def page(ordering, page_index, options)
_page self.type.page(ordering, page_index, options), ordering, page_index, options
end
|
#project(attrlist = []) ⇒ Object
110
111
112
|
# File 'lib/bmg/algebra.rb', line 110
def project(attrlist = [])
_project self.type.project(attrlist), attrlist
end
|
#rename(renaming = {}) ⇒ Object
119
120
121
122
123
|
# File 'lib/bmg/algebra.rb', line 119
def rename(renaming = {})
renaming = renaming.reject{|k,v| k==v }
return self if renaming.empty?
_rename self.type.rename(renaming), renaming
end
|
#restrict(predicate) ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/bmg/algebra.rb', line 130
def restrict(predicate)
predicate = Predicate.coerce(predicate)
if predicate.tautology?
self
else
type = self.type.restrict(predicate)
if predicate.contradiction?
Relation.empty(type)
else
begin
_restrict type, predicate
rescue Predicate::NotSupportedError
Operator::Restrict.new(type, self, predicate)
end
end
end
end
|
#spied(spy) ⇒ Object
172
173
174
175
|
# File 'lib/bmg/algebra.rb', line 172
def spied(spy)
return self if spy.nil?
Relation::Spied.new(self, spy)
end
|
#summarize(by, summarization = {}) ⇒ Object
153
154
155
|
# File 'lib/bmg/algebra.rb', line 153
def summarize(by, summarization = {})
_summarize self.type.summarize(by, summarization), by, summarization
end
|
#union(other, options = {}) ⇒ Object
162
163
164
165
|
# File 'lib/bmg/algebra.rb', line 162
def union(other, options = {})
return self if other.is_a?(Relation::Empty)
_union self.type.union(other.type), other, options
end
|
#unspied ⇒ Object
177
178
179
|
# File 'lib/bmg/algebra.rb', line 177
def unspied
self
end
|