module Bmg::Algebra
Public Instance Methods
allbut(butlist = [])
click to toggle source
# 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 = {})
click to toggle source
# File lib/bmg/algebra.rb, line 23 def autosummarize(by = [], summarization = {}) _autosummarize type = self.type.autosummarize(by, summarization), by, summarization end
autowrap(options = {})
click to toggle source
# File lib/bmg/algebra.rb, line 14 def autowrap(options = {}) _autowrap self.type.autowrap(options), options end
constants(cs = {})
click to toggle source
# File lib/bmg/algebra.rb, line 32 def constants(cs = {}) _constants self.type.constants(cs), cs end
extend(extension = {})
click to toggle source
# 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 = {})
click to toggle source
# 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 = {})
click to toggle source
# 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 = [])
click to toggle source
# 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 = {})
click to toggle source
# 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 = [])
click to toggle source
# File lib/bmg/algebra.rb, line 96 def matching(right, on = []) _matching self.type.matching(right.type, on), right, on end
materialize()
click to toggle source
# File lib/bmg/algebra.rb, line 223 def materialize Relation::Materialized.new(self) end
not_matching(right, on = [])
click to toggle source
# 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)
click to toggle source
# 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 = [])
click to toggle source
# File lib/bmg/algebra.rb, line 123 def project(attrlist = []) _project self.type.project(attrlist), attrlist end
rename(renaming = {})
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# File lib/bmg/algebra.rb, line 214 def spied(spy) return self if spy.nil? Relation::Spied.new(self, spy) end
summarize(by, summarization = {})
click to toggle source
# File lib/bmg/algebra.rb, line 166 def summarize(by, summarization = {}) _summarize self.type.summarize(by, summarization), by, summarization end
transform(transformation = nil, options = {}, &proc)
click to toggle source
# File lib/bmg/algebra.rb, line 175 def transform(transformation = nil, options = {}, &proc) transformation, options = proc, (transformation || {}) unless proc.nil? return self if transformation.is_a?(Hash) && transformation.empty? _transform(self.type.transform(transformation, options), transformation, options) end
ungroup(attrs)
click to toggle source
# File lib/bmg/algebra.rb, line 186 def ungroup(attrs) _ungroup self.type.ungroup(attrs), attrs end
union(other, options = {})
click to toggle source
# File lib/bmg/algebra.rb, line 195 def union(other, options = {}) return self if other.is_a?(Relation::Empty) _union self.type.union(other.type), other, options end
unspied()
click to toggle source
# File lib/bmg/algebra.rb, line 219 def unspied self end
unwrap(attrs)
click to toggle source
# File lib/bmg/algebra.rb, line 205 def unwrap(attrs) _unwrap self.type.unwrap(attrs), attrs end
Protected Instance Methods
_allbut(type, butlist)
click to toggle source
# File lib/bmg/algebra.rb, line 9 def _allbut(type, butlist) Operator::Allbut.new(type, self, butlist) end
_autosummarize(type, by, summarization)
click to toggle source
# File lib/bmg/algebra.rb, line 27 def _autosummarize(type, by, summarization) Operator::Autosummarize.new(type, self, by, summarization) end
_autowrap(type, options)
click to toggle source
# File lib/bmg/algebra.rb, line 18 def _autowrap(type, options) Operator::Autowrap.new(type, self, options) end
_constants(type, cs)
click to toggle source
# File lib/bmg/algebra.rb, line 36 def _constants(type, cs) Operator::Constants.new(type, self, cs) end
_extend(type, extension)
click to toggle source
# File lib/bmg/algebra.rb, line 46 def _extend(type, extension) Operator::Extend.new(type, self, extension) end
_group(type, attrs, as, options)
click to toggle source
# File lib/bmg/algebra.rb, line 55 def _group(type, attrs, as, options) Operator::Group.new(type, self, attrs, as, options) end
_image(type, right, as, on, options)
click to toggle source
# File lib/bmg/algebra.rb, line 64 def _image(type, right, as, on, options) Operator::Image.new(type, self, right, as, on, options) end
_join(type, right, on)
click to toggle source
# File lib/bmg/algebra.rb, line 73 def _join(type, right, on) right.send(:_joined_with, type, self, on) end
_joined_with(type, right, on)
click to toggle source
# File lib/bmg/algebra.rb, line 78 def _joined_with(type, right, on) Operator::Join.new(type, right, self, on) end
_left_join(type, right, on, default_right_tuple)
click to toggle source
# File lib/bmg/algebra.rb, line 88 def _left_join(type, right, on, default_right_tuple) Operator::Join.new(type, self, right, on, { variant: :left, default_right_tuple: default_right_tuple }) end
_matching(type, right, on)
click to toggle source
# File lib/bmg/algebra.rb, line 100 def _matching(type, right, on) Operator::Matching.new(type, self, right, on) end
_not_matching(type, right, on)
click to toggle source
# File lib/bmg/algebra.rb, line 109 def _not_matching(type, right, on) Operator::NotMatching.new(type, self, right, on) end
_page(type, ordering, page_index, options)
click to toggle source
# File lib/bmg/algebra.rb, line 118 def _page(type, ordering, page_index, options) Operator::Page.new(type, self, ordering, page_index, options) end
_project(type, attrlist)
click to toggle source
# File lib/bmg/algebra.rb, line 127 def _project(type, attrlist) Operator::Project.new(type, self, attrlist) end
_rename(type, renaming)
click to toggle source
# File lib/bmg/algebra.rb, line 138 def _rename(type, renaming) Operator::Rename.new(type, self, renaming) end
_restrict(type, predicate)
click to toggle source
# File lib/bmg/algebra.rb, line 161 def _restrict(type, predicate) Operator::Restrict.new(type, self, predicate) end
_summarize(type, by, summarization)
click to toggle source
# File lib/bmg/algebra.rb, line 170 def _summarize(type, by, summarization) Operator::Summarize.new(type, self, by, summarization) end
_transform(type, transformation, options)
click to toggle source
# File lib/bmg/algebra.rb, line 181 def _transform(type, transformation, options) Operator::Transform.new(type, self, transformation, options) end
_ungroup(type, attrs)
click to toggle source
# File lib/bmg/algebra.rb, line 190 def _ungroup(type, attrs) Operator::Ungroup.new(type, self, attrs) end
_union(type, other, options)
click to toggle source
# File lib/bmg/algebra.rb, line 200 def _union(type, other, options) Operator::Union.new(type, [self, other], options) end
_unwrap(type, attrs)
click to toggle source
# File lib/bmg/algebra.rb, line 209 def _unwrap(type, attrs) Operator::Unwrap.new(type, self, attrs) end