source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/lang/parser/lispy.rb
Ruby
mit
49
master
1,679
module Alf module Lang module Parser class Lispy include Parser include Functional include Predicates def initialize(helpers = [], connection = nil) @connection = connection @extensions = helpers helpers.each do |helper| helper.send(...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/lang/oo/aggregation_methods.rb
Ruby
mit
49
master
489
module Alf module Lang module ObjectOriented module AggregationMethods def self.def_aggregator_method(name, clazz) define_method(name) do |*args, &block| clazz.new(*args, &block).aggregate(_self_operand.to_cog) end end Aggregator.listen do |name, cla...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/lang/oo/algebra_methods.rb
Ruby
mit
49
master
1,659
module Alf module Lang module ObjectOriented module AlgebraMethods def self.def_operator_method(name, clazz) define_method(name) do |*args| # add self operands at begining of args args.unshift(_self_operand) # split operands vs. arguments o...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/lang/oo/rendering_methods.rb
Ruby
mit
49
master
1,459
module Alf module Lang module ObjectOriented module RenderingMethods def self.def_renderer_method(name, clazz) define_method(:"to_#{name}") do |*args| options, io = nil args.each do |arg| options ||= arg if arg.is_a?(Hash) io ||= ar...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/leaf.rb
Ruby
mit
49
master
630
module Alf module Engine # # Marker for leaf compiled nodes # class Leaf include Cog # The initial expression attr_reader :operand # Creates a Concat instance def initialize(operand, expr = nil, compiler = nil) super(expr, compiler) @operand = operand ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/unwrap.rb
Ruby
mit
49
master
910
module Alf module Engine # # Unwraps a tuple attribute # class Unwrap include Cog # @return [Enumerable] The operand attr_reader :operand # @return [AttrName] Name of the attribute to unwrap attr_reader :attribute # Creates a SetAttr instance def initialize...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/defaults.rb
Ruby
mit
49
master
1,197
module Alf module Engine # # Replace missing attributes and nil by default, computed values. # # Example: # # rel = [ # {:id => 1, :name => "Jones"}, # {:id => 2, :name => nil} # ] # Defaults.new(rel, TupleComputation[:name => "Smith"]).to_a # # ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/sort.rb
Ruby
mit
49
master
314
module Alf module Engine module Sort # Delegates to Sort::InMemory def self.new(operand, ordering, expr = nil, compiler = nil) Sort::InMemory.new(operand, ordering, expr, compiler) end end # module Sort end # module Engine end # module Alf require_relative 'sort/in_memory'
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/coerce.rb
Ruby
mit
49
master
1,272
module Alf module Engine # # Coerce input tuples according to a Heading. Attributes that do not belong # to the heading are simply ignored but are kept in the output. # # Example: # # operand = [ # {:name => "Jones", :price => "10.0"}, # {:name => "Smith", :price =...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/compact.rb
Ruby
mit
49
master
593
module Alf module Engine # # Remove duplicate tuples from its operand. # class Compact include Cog # @return [Enumerable] The operand attr_reader :operand # Creates a Compact instance def initialize(operand, expr = nil, compiler = nil) super(expr, compiler) ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/infer_heading.rb
Ruby
mit
49
master
694
module Alf module Engine # # Infers the heading of the iterated relation. # class InferHeading include Cog # @return [Enumerable] The operand attr_reader :operand def initialize(operand, expr = nil, compiler = nil) super(expr, compiler) @operand = operand ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/filter.rb
Ruby
mit
49
master
1,049
module Alf module Engine # # Filters operand using a tuple predicate. # # Example # # rel = [ # {:name => "Smith"}, # {:name => "Jones"} # ] # Filter.new(rel, Predicate.parse("name =~ /^J/")).to_a # # => [ # # {:name => "Jones"} ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/generator.rb
Ruby
mit
49
master
1,192
module Alf module Engine # # Generates tuples with an integer attributes, with an initial offset and # a step. # # Example: # # Generator.new(3, :id, 10, 5).to_a # # => [ # # {:id => 10}, # # {:id => 15}, # # {:id => 20} # # ] ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/concat.rb
Ruby
mit
49
master
547
module Alf module Engine # # Concat tuples from multiple operands. # class Concat include Cog # @return [Array] operands to concatenate attr_reader :operands # Creates a Concat instance def initialize(operands, expr = nil, compiler = nil) super(expr, compiler) ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/clip.rb
Ruby
mit
49
master
1,447
module Alf module Engine # # Clips input tuples keeping (all but) specific attributes only. # # Example: # # operand = [ # {:name => "Jones", :city => "London"}, # {:name => "Smith", :city => "Paris"} # ] # # Clip.new(operand, AttrList[:name], ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/cog.rb
Ruby
mit
49
master
1,309
module Alf module Engine module Cog include Compiler::Cog include Enumerable EMPTY_CHILDREN = [].freeze EMPTY_OPTIONS = {}.freeze def each(&bl) return to_enum unless block_given? _each(&bl) end def children return operands if respond_to?(:oper...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/aggregate.rb
Ruby
mit
49
master
1,327
module Alf module Engine # # Aggregates the whole operand according to a Summarization. The result contains # only one tuple. # # Example: # # res = [ # {:name => "Jones", :price => 12.0, :id => 1}, # {:name => "Smith", :price => 10.0, :id => 2} # ] # agg = Su...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/wrap.rb
Ruby
mit
49
master
999
module Alf module Engine # # Wraps attributes under as a sub-tuple # class Wrap include Cog # @return [Enumerable] The operand attr_reader :operand # @return [AttrList] Attributes to wrap attr_reader :attributes # @return [AttrName] Name of the introduced wrapped...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/set_attr.rb
Ruby
mit
49
master
1,315
module Alf module Engine # # Set computed tuples attributes. This cog allows implementing both # EXTEND and UPDATE relational operators. # # Example: # # rel = [ # {:name => "Jones", :city => "London"} # ] # comp = TupleComputation[ # :city => lam...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/ungroup.rb
Ruby
mit
49
master
985
module Alf module Engine class Ungroup include Cog # @return [Enumerable] The operand attr_reader :operand # @return [AttrName] Relation-valued attribute to ungroup attr_reader :attribute # Creates a Ungroup instance def initialize(operand, attribute, expr = nil, compi...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/rename.rb
Ruby
mit
49
master
999
module Alf module Engine # # Renames tuples from the operand according to a Renaming info. # # Example: # # rel = [ # {:name => "Jones", :city => "London"} # ] # Rename.new(rel, Renaming[:name => :last_name]).to_a # # => [ # # {:last_name => ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/hierarchize.rb
Ruby
mit
49
master
2,557
module Alf module Engine class Hierarchize include Cog # @return [Enumerable] The operand attr_reader :operand # @return [AttrList] Attribute list of the id attr_reader :id # @return [AttrList] Attribute list for the parent attr_reader :parent # @return [AttrNam...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/take.rb
Ruby
mit
49
master
1,388
module Alf module Engine # # Take only a frame of the input relation according to an (offset, limit) # parameter. # # Example: # # res = [ # {:name => "Jones", :price => 12.0, :id => 1}, # {:name => "Smith", :price => 10.0, :id => 2}, # {:name => "Blake", :price =...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/summarize.rb
Ruby
mit
49
master
206
module Alf module Engine module Summarize def arguments [ by, summarization, allbut ] end end end end require_relative 'summarize/cesure' require_relative 'summarize/hash'
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/to_array.rb
Ruby
mit
49
master
1,695
module Alf module Engine # # Ensures an order of tuples, recursing on relation value attributes, that are # converted as arrays as well. # # Example: # # res = [ # {:price => 12.0, :rva => Relation(...)}, # {:price => 10.0, :rva => Relation(...)} # ] # ToArray...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/type_safe.rb
Ruby
mit
49
master
681
module Alf module Engine class TypeSafe include Cog # @return [Enumerable] The operand attr_reader :operand # @return [TypeChecker] Type checker to use attr_reader :checker # Creates an Coerce instance def initialize(operand, checker, expr = nil, compiler = nil) ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/autonum.rb
Ruby
mit
49
master
1,084
module Alf module Engine # # Autonumbers input tuples under a new `as` attribute. Autonumbering starts # at 0. # # Example: # # operand = [ # {:name => "Jones"}, # {:name => "Smith"} # ] # Autonum.new(operand, :id).to_a # # => [ # # ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/compact/uniq.rb
Ruby
mit
49
master
559
module Alf module Engine # # Remove duplicate tuples through an in-memory `to_a.uniq` heuristics. # class Compact::Uniq include Cog # @return [Enumerable] The operand attr_reader :operand # Creates a Compact::Uniq instance def initialize(operand, expr = nil, compiler = ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/compact/set.rb
Ruby
mit
49
master
550
module Alf module Engine # # Remove duplicate tuples through an in-memory `to_set` heuristics. # class Compact::Set include Cog # @return [Enumerable] The operand attr_reader :operand # Creates a Compact::Set instance def initialize(operand, expr = nil, compiler = nil) ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/sort/in_memory.rb
Ruby
mit
49
master
1,122
module Alf module Engine # # Implement an in-memory sort, relying on `to_a.sort!` # # Example: # # rel = [ # {:name => "Smith"}, # {:name => "Jones"} # ] # Sort.new(rel, Ordering[[:name, :asc]]).to_a # # => [ # # {:name => "Jones"} ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/join/hash.rb
Ruby
mit
49
master
1,012
module Alf module Engine # # Provides hash-based join. # class Join::Hash include Join include Cog # @return [Enumerable] The left operand attr_reader :left # @return [Enumerable] The right operand attr_reader :right # Creates a Join::Hash instance de...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/summarize/cesure.rb
Ruby
mit
49
master
1,439
module Alf module Engine class Summarize::Cesure include Summarize include Cesure # @return [Enumerable] The operand attr_reader :operand # @return [AttrList] Summarization key attr_reader :by # @return [Summarization] The summarization to use attr_reader :summar...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/summarize/hash.rb
Ruby
mit
49
master
971
module Alf module Engine class Summarize::Hash include Summarize include Cog # @return [Enumerable] The operand attr_reader :operand # @return [AttrList] Summarization key attr_reader :by # @return [Summarization] The summarization to use attr_reader :summarizati...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/semi/hash.rb
Ruby
mit
49
master
1,442
module Alf module Engine # # Filters tuples from `left` that match or do not match tuples from `right`. # class Semi::Hash include Semi include Cog # @return [Enumerable] The left operand attr_reader :left # @return [Enumerable] The right operand attr_reader :righ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/quota/cesure.rb
Ruby
mit
49
master
1,366
module Alf module Engine class Quota::Cesure include Quota include Engine::Cesure # @return [Enumerable] The operand attr_reader :operand # @return [AttrList] List of attributes for 'quota by' attr_reader :by # @return [Summarization] Quota computations as a summarizat...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/image/hash.rb
Ruby
mit
49
master
1,940
module Alf module Engine # # Provides hash-based grouping. # class Image::Hash include Image include Cog # @return [Enumerable] The left operand attr_reader :left # @return [Enumerable] The right operand attr_reader :right # @return [AttrName] Name of the n...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/rank/cesure.rb
Ruby
mit
49
master
1,218
module Alf module Engine class Rank::Cesure include Rank include Engine::Cesure # @return [Enumerable] The operand attr_reader :operand # @return [AttrList] List of attributes that form the operand ordering attr_reader :by # @return [AttrName] Name of the introduced at...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/materialize/array.rb
Ruby
mit
49
master
2,103
module Alf module Engine # # Provides in-memory materialization through a ruby Array. # # This class acts as a Cog, that it, it is an enumerable of tuples. An # optional ordering can be passed at construction. # # Materialization occurs at prepare time, with auto-prepare on first # ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/materialize/hash.rb
Ruby
mit
49
master
3,846
module Alf module Engine # # Provides in-memory materialization through a ruby Hash. # # This class acts as a Cog, that it, it is an enumerable of tuples. No # particular ordering is guaranteed. In addition, the class provides # indexed access through the `[]` method. # # Materiali...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/group/hash.rb
Ruby
mit
49
master
1,192
module Alf module Engine # # Provides hash-based grouping. # class Group::Hash include Group include Cog # @return [Enumerable] The operand attr_reader :operand # @return [AttrList] Attributes to group attr_reader :attributes # @return [AttrName] Name of th...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/engine/support/cesure.rb
Ruby
mit
49
master
1,131
module Alf module Engine module Cesure include Cog # (see Cog#each) def each(&receiver) return to_enum unless block_given? dup._each(&receiver) end protected # (see Cog#each) def _each(&receiver) prev_key = nil operand.each do |tuple| ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator.rb
Ruby
mit
49
master
4,375
module Alf module Algebra module Operator include Operand include TypeCheck ### Class-based tools # Encapsulates method that allows making operator introspection, that is, # knowing operator cardinality and similar stuff. module ClassMethods # Returns the ruby case nam...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support.rb
Ruby
mit
49
master
492
require_relative 'support/nullary' require_relative 'support/unary' require_relative 'support/binary' require_relative 'support/relational' require_relative 'support/non_relational' require_relative 'support/experimental' require_relative 'support/classification' require_relative 'support/signature' require_relative...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operand.rb
Ruby
mit
49
master
1,424
module Alf module Algebra module Operand def self.coerce(op) case op when Operand then op when Symbol then Operand::Named.new(op) when Reader then Proxy.new(op) when Array then Proxy.new(op) when Engine::Cog then Proxy.new(op) when...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/shortcut.rb
Ruby
mit
49
master
849
module Alf module Algebra module Shortcut module DelegationMethods def type_check(options = {}) expand.type_check(options = {}) end def heading expand.heading end def keys expand.keys end Algebra::Operator.listen do |...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/unary.rb
Ruby
mit
49
master
625
module Alf module Algebra # # Specialization of Operator for operators that work on a unary input # module Unary # Class-level methods module ClassMethods # (see Operator::ClassMethods#arity) def arity 1 end end # module ClassMethods def se...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/binary.rb
Ruby
mit
49
master
965
module Alf module Algebra # # Specialization of Operator for operators that work on a binary input # module Binary # Class-level methods module ClassMethods # (see Operator::ClassMethods#arity) def arity 2 end end # module ClassMethods def ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/non_relational.rb
Ruby
mit
49
master
277
module Alf module Algebra module NonRelational class << self include Support::Registry def included(mod) super register(mod, NonRelational) end end end # NonRelational end # module Algebra end # module Alf
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/rewriter.rb
Ruby
mit
49
master
733
module Alf module Algebra class Rewriter include Visitor # public interface def call(expr, search = nil) apply(expr) end # copy all default implementation def apply(expr, *args, &bl) send to_method_name(expr, "on_"), expr, *args, &bl end def on_leaf...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/signature.rb
Ruby
mit
49
master
6,433
module Alf module Algebra # Provides an operator signature class Signature # @return [Class] the operator class to which this signature belongs attr_reader :operator # @return [Array] signature arguments attr_reader :arguments # @return [Array] signature options attr_rea...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/nullary.rb
Ruby
mit
49
master
452
module Alf module Algebra # # Specialization of Operator for operators without operands # module Nullary # Class-level methods module ClassMethods # (see Operator::ClassMethods#arity) def arity 0 end end # module ClassMethods def self.inclu...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/classification.rb
Ruby
mit
49
master
947
module Alf module Algebra module Classification # @return true if this is a relational operator, false otherwise def relational? ancestors.include?(Relational) end # @return true if this is an experimental operator, false otherwise def experimental? ancestors.includ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/visitor.rb
Ruby
mit
49
master
779
module Alf module Algebra module Visitor def copy_and_apply(expr) if expr.is_a?(Algebra::Operator) expr.with_operands(*expr.operands.map{|op| apply(op) }) else expr end end private def to_method_name(expr, prefix = "on_") case expr ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/relational.rb
Ruby
mit
49
master
275
module Alf module Algebra module Relational class << self include Support::Registry def included(mod) super register(mod, Relational) end end end # module Relational end # module Algebra end # module Alf
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/compiler.rb
Ruby
mit
49
master
608
module Alf module Algebra class Compiler include Visitor # public interface def call(expr, *args, &bl) apply(expr, *args, &bl) end # copy all default implementation def apply(expr, *args, &bl) send to_method_name(expr, "on_"), expr, *args, &bl end d...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/type_check.rb
Ruby
mit
49
master
1,367
module Alf module Algebra module TypeCheck def type_check_error!(msg) raise TypeCheckError, msg end def no_unknown!(unknown) unknown = unknown.to_a unless unknown.empty? msg = "#{to_s}: no such attribute" msg << ((unknown.size > 1) ? "s " : " ") ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/support/experimental.rb
Ruby
mit
49
master
333
module Alf module Algebra # # Marker for experimental operators # module Experimental class << self include Support::Registry def included(mod) super register(mod, Experimental) end end end # module Experimental end # module Algebra end ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/defaults.rb
Ruby
mit
49
master
625
module Alf module Algebra class Defaults include Operator include NonRelational include Unary signature do |s| s.argument :defaults, TupleComputation, {} s.option :strict, Boolean, false, "Restrict to default attributes only?" end def heading @head...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/ungroup.rb
Ruby
mit
49
master
1,046
module Alf module Algebra class Ungroup include Operator include Relational include Unary signature do |s| s.argument :attribute, AttrName, :grouped end def heading @heading ||= operand.heading.allbut([attribute]).merge(group_heading) end def keys...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/page.rb
Ruby
mit
49
master
690
module Alf module Algebra class Page include Operator include Relational include Unary include WithOrdering signature do |s| s.argument :ordering, Ordering, [] s.argument :page_index, Integer, 1 s.option :page_size, Integer, 25, 'Size of the pages to compu...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/hierarchize.rb
Ruby
mit
49
master
703
module Alf module Algebra class Hierarchize include Operator, Relational, Unary, Experimental signature do |s| s.argument :id, AttrList, [:id] s.argument :parent, AttrList, [:parent] s.argument :as, AttrName, :children end def heading @heading ||= ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/intersect.rb
Ruby
mit
49
master
654
module Alf module Algebra class Intersect include Operator include Relational include Binary signature do |s| end def heading @heading ||= left.heading + right.heading end def keys @keys ||= begin k1s, k2s = left.keys, right.keys ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/coerce.rb
Ruby
mit
49
master
516
module Alf module Algebra class Coerce include Operator include NonRelational include Unary signature do |s| s.argument :coercions, Heading, {} end def heading @heading ||= operand.heading.merge(coercions) end def keys @keys ||= operand.ke...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/minus.rb
Ruby
mit
49
master
433
module Alf module Algebra class Minus include Operator include Relational include Binary signature do |s| end def heading @heading ||= left.heading end def keys @keys ||= left.keys end private def _type_check(options) sam...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/not_matching.rb
Ruby
mit
49
master
459
module Alf module Algebra class NotMatching include Operator include Relational include Binary signature do |s| end def heading @heading ||= left.heading end def keys @keys ||= left.keys end private def _type_check(options) ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/frame.rb
Ruby
mit
49
master
719
module Alf module Algebra class Frame include Operator include Relational include Unary include WithOrdering signature do |s| s.argument :ordering, Ordering, [] s.argument :offset, Integer, 0 s.argument :limit, Integer, 25 end def heading ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/extend.rb
Ruby
mit
49
master
613
module Alf module Algebra class Extend include Operator include Relational include Unary signature do |s| s.argument :ext, TupleComputation, {} end def heading @heading ||= operand.heading.merge(ext.to_heading) end def keys @keys ||= begin...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/autonum.rb
Ruby
mit
49
master
531
module Alf module Algebra class Autonum include Operator include NonRelational include Unary signature do |s| s.argument :as, AttrName, :autonum end def heading @heading ||= operand.heading + Heading[as => Integer] end def keys @keys ||= o...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/summarize.rb
Ruby
mit
49
master
959
module Alf module Algebra class Summarize include Operator include Relational include Unary signature do |s| s.argument :by, AttrList, [] s.argument :summarization, Summarization, {} s.option :allbut, Boolean, false, "Summarize on all but specif...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/unwrap.rb
Ruby
mit
49
master
924
module Alf module Algebra class Unwrap include Operator include Relational include Unary signature do |s| s.argument :attribute, AttrName, :wrapped end def heading @heading ||= begin op_h = operand.heading type = op_h[attribute] ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/project.rb
Ruby
mit
49
master
886
module Alf module Algebra class Project include Operator include Relational include Unary signature do |s| s.argument :attributes, AttrList, [] s.option :allbut, Boolean, false, 'Project all but specified attributes?' end def heading @heading ||...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/image.rb
Ruby
mit
49
master
738
module Alf module Algebra class Image include Operator include Relational include Binary signature do |s| s.argument :as, AttrName, [] end def heading @heading ||= left.heading + Heading.coerce(as => group_type) end def keys left.keys ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/wrap.rb
Ruby
mit
49
master
1,213
module Alf module Algebra class Wrap include Operator include Relational include Unary signature do |s| s.argument :attributes, AttrList, [] s.argument :as, AttrName, :wrapped s.option :allbut, Boolean, false, 'Wrap all but specified attributes?' end ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/join.rb
Ruby
mit
49
master
649
module Alf module Algebra class Join include Operator include Relational include Binary signature do |s| end def heading @heading ||= left.heading + right.heading end def keys @keys ||= begin keys = [] left.keys.each do |k1| ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/clip.rb
Ruby
mit
49
master
870
module Alf module Algebra class Clip include Operator include NonRelational include Unary signature do |s| s.argument :attributes, AttrList, [] s.option :allbut, Boolean, false, "Apply an allbut clipping?" end def heading @heading ||= operand.hea...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/restrict.rb
Ruby
mit
49
master
760
module Alf module Algebra class Restrict include Operator include Relational include Unary signature do |s| s.argument :predicate, Predicate, Predicate.tautology end def heading @heading ||= operand.heading end def keys @keys ||= begin ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/quota.rb
Ruby
mit
49
master
759
module Alf module Algebra class Quota include Operator include Relational include Unary include Experimental signature do |s| s.argument :by, AttrList, [] s.argument :order, Ordering, [] s.argument :summarization, Summarization, {} en...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/group.rb
Ruby
mit
49
master
915
module Alf module Algebra class Group include Operator include Relational include Unary signature do |s| s.argument :attributes, AttrList, [] s.argument :as, AttrName, :group s.option :allbut, Boolean, false, 'Group all but specified attributes?' ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/sort.rb
Ruby
mit
49
master
484
module Alf module Algebra class Sort include Operator include NonRelational include Unary signature do |s| s.argument :ordering, Ordering, [] end def heading @heading ||= operand.heading end def keys @keys ||= operand.keys end p...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/matching.rb
Ruby
mit
49
master
453
module Alf module Algebra class Matching include Operator include Relational include Binary signature do |s| end def heading @heading ||= left.heading end def keys @keys ||= left.keys end private def _type_check(options) ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/compact.rb
Ruby
mit
49
master
435
module Alf module Algebra class Compact include Operator include NonRelational include Unary signature do |s| end def heading @heading ||= operand.heading end def keys @keys ||= operand.keys.if_empty{ Keys[ heading.to_attr_list ] } end ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/generator.rb
Ruby
mit
49
master
483
module Alf module Algebra class Generator include Operator include NonRelational include Nullary signature do |s| s.argument :size, Size, 10 s.argument :as, AttrName, :num end def heading @heading ||= Heading[as => Integer] end def keys ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/union.rb
Ruby
mit
49
master
468
module Alf module Algebra class Union include Operator include Relational include Binary signature do |s| end def heading @heading ||= left.heading + right.heading end def keys @keys ||= Keys[ heading.to_attr_list ] end private d...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/rank.rb
Ruby
mit
49
master
793
module Alf module Algebra class Rank include Operator include Relational include Unary signature do |s| s.argument :order, Ordering, [] s.argument :as, AttrName, :rank end def heading @heading ||= operand.heading.merge(as => Integer) end d...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operator/rename.rb
Ruby
mit
49
master
696
module Alf module Algebra class Rename include Operator include Relational include Unary signature do |s| s.argument :renaming, Renaming, {} end def heading @heading ||= operand.heading.rename(renaming) end def keys @keys ||= operand.keys....
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operand/named.rb
Ruby
mit
49
master
1,403
module Alf module Algebra module Operand class Named include Operand def initialize(name, connection = nil) @name = name @connection = connection end attr_reader :name, :connection def connection! raise UnboundError, "Expression not bou...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operand/fake.rb
Ruby
mit
49
master
1,506
module Alf module Algebra module Operand class Fake include Operand def initialize(connection = nil, cog = nil) @connection = connection @attributes = {} @cog = cog end attr_accessor :connection def with_connection(conn) dup.t...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/operand/proxy.rb
Ruby
mit
49
master
931
module Alf module Algebra module Operand class Proxy include Operand def initialize(subject) @subject = subject end attr_reader :subject def heading return subject.heading if subject.respond_to?(:heading) super end def ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/algebra/shortcut/allbut.rb
Ruby
mit
49
master
446
module Alf module Algebra class Allbut include Shortcut include Unary signature do |s| s.argument :attributes, AttrList, [] end def expand project(operand, attributes, allbut: true) end def key_preserving? expand.key_preserving? end ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/optimizer/restrict.rb
Ruby
mit
49
master
5,646
module Alf class Optimizer class Restrict < Optimizer::Base ### overridings def search_predicate Algebra::Restrict end def _call(restrict, search) apply(restrict.operand, restrict.predicate, search) end def restrict(operand, predicate) check_constant(o...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/optimizer/project.rb
Ruby
mit
49
master
5,683
module Alf class Optimizer class Project < Optimizer::Base ### def project(operand, attributes, options) options[:allbut] ? allbut(operand, attributes) : super end ### overridings def search_predicate Algebra::Project end def _call(project, search) ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/compiler/default.rb
Ruby
mit
49
master
5,168
module Alf class Compiler class Default < Compiler def supports_reuse? true end def reuse(plan, cog) cog end ### non relational def on_autonum(plan, expr, compiled) factor(Engine::Autonum, expr, compiled, expr.as) end def on_clip(plan, e...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/compiler/plan.rb
Ruby
mit
49
master
2,040
require 'tsort' module Alf class Compiler class Plan def initialize(compiler = Compiler.new) @parser = Lang::Parser::Lispy.new @compilers = {} @compiled = {} @usage_count = Hash.new{|h,k| h[k] = 0 } @main_compiler = compiler join(compiler) ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/compiler/cog.rb
Ruby
mit
49
master
883
module Alf class Compiler module Cog extend Forwardable def initialize(expr, compiler) @expr = expr @compiler = compiler end attr_reader :expr attr_reader :compiler def_delegators :expr, :connection, :heading, ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/adapter/memory.rb
Ruby
mit
49
master
647
module Alf class Adapter class Memory < Adapter # (see Connection.recognizes?) # # @return [Boolean] true if args contains one String only, which denotes # an existing folder; false otherwise def self.recognizes?(conn_spec) conn_spec == 'memory://' end #...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/adapter/connection.rb
Ruby
mit
49
master
2,160
module Alf class Adapter class Connection def initialize(conn_spec) @conn_spec = conn_spec end attr_reader :conn_spec ### connection, transaction, locks # Yields the block in a transaction def in_transaction(opts = {}) yield end # Closes the conn...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/adapter/folder.rb
Ruby
mit
49
master
682
module Alf class Adapter class Folder < Adapter # (see Connection.recognizes?) # # @return [Boolean] true if args contains one String only, which denotes # an existing folder; false otherwise def self.recognizes?(conn_spec) Path.like?(conn_spec) && Path(conn_spec).di...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/adapter/folder/connection.rb
Ruby
mit
49
master
1,112
module Alf class Adapter class Folder class Connection < Adapter::Connection alias :folder :conn_spec # Returns true if `name` is known, false otherwise. def knows?(name) !find_file(name).nil? end # Returns a cog for `expr` inside the compilation plan `pl...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/adapter/connection/schema_cached.rb
Ruby
mit
49
master
853
module Alf class Adapter class Connection class SchemaCached < Connection def self.empty_cache Hash.new{|h,k| h[k] = {}} end def initialize(connection, cache = nil) @connection = connection @cache = cache || SchemaCached.empty_cache end ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
lib/alf/adapter/memory/connection.rb
Ruby
mit
49
master
1,060
module Alf class Adapter class Memory class Connection < Adapter::Connection def initialize(*args, &bl) super @relvars = {} end # Returns true if `name` is known, false otherwise. def knows?(name) true end # Returns a cog for `...