Module: Bmg::Algebra

Included in:
Relation
Defined in:
lib/bmg/algebra.rb

Constant Summary collapse

METHODS =
[
  :allbut,
  :autowrap,
  :autosummarize,
  :constants,
  :extend,
  :group,
  :image,
  :matching,
  :page,
  :project,
  :rename,
  :restrict,
  :rxmatch,
  :union
]

Instance Method Summary collapse

Instance Method Details

#allbut(butlist = []) ⇒ Object



21
22
23
# File 'lib/bmg/algebra.rb', line 21

def allbut(butlist = [])
  _allbut self.type.allbut(butlist), butlist
end

#autosummarize(by = [], summarization = {}) ⇒ Object



39
40
41
# File 'lib/bmg/algebra.rb', line 39

def autosummarize(by = [], summarization = {})
  _autosummarize type = self.type.autosummarize(by, summarization), by, summarization
end

#autowrap(options = {}) ⇒ Object



30
31
32
# File 'lib/bmg/algebra.rb', line 30

def autowrap(options = {})
  _autowrap self.type.autowrap(options), options
end

#constants(cs = {}) ⇒ Object



48
49
50
# File 'lib/bmg/algebra.rb', line 48

def constants(cs = {})
  _constants self.type.constants(cs), cs
end

#extend(extension = {}) ⇒ Object



57
58
59
# File 'lib/bmg/algebra.rb', line 57

def extend(extension = {})
  _extend self.type.extend(extension), extension
end

#group(attrs, as = :group, options = {}) ⇒ Object



66
67
68
# File 'lib/bmg/algebra.rb', line 66

def group(attrs, as = :group, options = {})
  _group self.type.group(attrs, as), attrs, as, options
end

#image(right, as = :image, on = [], options = {}) ⇒ Object



75
76
77
# File 'lib/bmg/algebra.rb', line 75

def image(right, as = :image, on = [], options = {})
  _image self.type.image(right, as, on, options), right, as, on, options
end

#matching(right, on = []) ⇒ Object



84
85
86
# File 'lib/bmg/algebra.rb', line 84

def matching(right, on = [])
  _matching self.type.matching(right, on), right, on
end

#page(ordering, page_index, options) ⇒ Object



93
94
95
# File 'lib/bmg/algebra.rb', line 93

def page(ordering, page_index, options)
  _page self.type.page(ordering, page_index, options), ordering, page_index, options
end

#project(attrlist = []) ⇒ Object



102
103
104
# File 'lib/bmg/algebra.rb', line 102

def project(attrlist = [])
  _project self.type.project(attrlist), attrlist
end

#rename(renaming = {}) ⇒ Object



111
112
113
# File 'lib/bmg/algebra.rb', line 111

def rename(renaming = {})
  _rename self.type.rename(renaming), renaming
end

#restrict(predicate) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/bmg/algebra.rb', line 120

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

#rxmatch(attrs, matcher, options = {}) ⇒ Object



143
144
145
# File 'lib/bmg/algebra.rb', line 143

def rxmatch(attrs, matcher, options = {})
  _rxmatch type.rxmatch(attrs, matcher, options), attrs, matcher, options
end

#spied(spy) ⇒ Object



161
162
163
164
# File 'lib/bmg/algebra.rb', line 161

def spied(spy)
  return self if spy.nil?
  Relation::Spied.new(self, spy)
end

#union(other, options = {}) ⇒ Object



152
153
154
# File 'lib/bmg/algebra.rb', line 152

def union(other, options = {})
  _union self.type.union(other.type), other, options
end

#unspiedObject



166
167
168
# File 'lib/bmg/algebra.rb', line 166

def unspied
  self
end