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
-
#left_join(right, on = [], default_right_tuple = {}) ⇒ 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
-
#transform(transformation = nil, options = {}, &proc) ⇒ 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
|
#left_join(right, on = [], default_right_tuple = {}) ⇒ Object
83
84
85
86
|
# File 'lib/bmg/algebra.rb', line 83
def left_join(right, on = [], default_right_tuple = {})
drt = default_right_tuple
_left_join self.type.left_join(right.type, on, drt), right, on, drt
end
|
#matching(right, on = []) ⇒ Object
96
97
98
|
# File 'lib/bmg/algebra.rb', line 96
def matching(right, on = [])
_matching self.type.matching(right.type, on), right, on
end
|
#not_matching(right, on = []) ⇒ Object
105
106
107
|
# File 'lib/bmg/algebra.rb', line 105
def not_matching(right, on = [])
_not_matching self.type.not_matching(right.type, on), right, on
end
|
#page(ordering, page_index, options) ⇒ Object
114
115
116
|
# File 'lib/bmg/algebra.rb', line 114
def page(ordering, page_index, options)
_page self.type.page(ordering, page_index, options), ordering, page_index, options
end
|
#project(attrlist = []) ⇒ Object
123
124
125
|
# File 'lib/bmg/algebra.rb', line 123
def project(attrlist = [])
_project self.type.project(attrlist), attrlist
end
|
#rename(renaming = {}) ⇒ Object
132
133
134
135
136
|
# File 'lib/bmg/algebra.rb', line 132
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# File 'lib/bmg/algebra.rb', line 143
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
195
196
197
198
|
# File 'lib/bmg/algebra.rb', line 195
def spied(spy)
return self if spy.nil?
Relation::Spied.new(self, spy)
end
|
#summarize(by, summarization = {}) ⇒ Object
166
167
168
|
# File 'lib/bmg/algebra.rb', line 166
def summarize(by, summarization = {})
_summarize self.type.summarize(by, summarization), by, summarization
end
|
175
176
177
178
|
# File 'lib/bmg/algebra.rb', line 175
def transform(transformation = nil, options = {}, &proc)
transformation, options = proc, (transformation || {}) unless proc.nil?
_transform(self.type.transform(transformation, options), transformation, options)
end
|
#union(other, options = {}) ⇒ Object
185
186
187
188
|
# File 'lib/bmg/algebra.rb', line 185
def union(other, options = {})
return self if other.is_a?(Relation::Empty)
_union self.type.union(other.type), other, options
end
|
#unspied ⇒ Object
200
201
202
|
# File 'lib/bmg/algebra.rb', line 200
def unspied
self
end
|