Module: Bmg::Algebra

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

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#allbut(butlist = []) ⇒ Object



17
18
19
# File 'lib/bmg/algebra.rb', line 17

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

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



35
36
37
# File 'lib/bmg/algebra.rb', line 35

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

#autowrap(options = {}) ⇒ Object



26
27
28
# File 'lib/bmg/algebra.rb', line 26

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

#constants(cs = {}) ⇒ Object



44
45
46
# File 'lib/bmg/algebra.rb', line 44

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

#extend(extension = {}) ⇒ Object



53
54
55
# File 'lib/bmg/algebra.rb', line 53

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

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



62
63
64
# File 'lib/bmg/algebra.rb', line 62

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

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



71
72
73
# File 'lib/bmg/algebra.rb', line 71

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

#project(attrlist = []) ⇒ Object



80
81
82
# File 'lib/bmg/algebra.rb', line 80

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

#rename(renaming = {}) ⇒ Object



89
90
91
# File 'lib/bmg/algebra.rb', line 89

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

#restrict(predicate) ⇒ Object



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/bmg/algebra.rb', line 98

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



130
131
132
133
# File 'lib/bmg/algebra.rb', line 130

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

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



121
122
123
# File 'lib/bmg/algebra.rb', line 121

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

#unspiedObject



135
136
137
# File 'lib/bmg/algebra.rb', line 135

def unspied
  self
end