alf-core 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +10 -0
- data/Gemfile +2 -8
- data/Gemfile.lock +9 -17
- data/examples/operators/frame.alf +2 -0
- data/lib/alf-core.rb +24 -22
- data/lib/{alf-adapter/alf → alf}/adapter.rb +0 -0
- data/lib/{alf-adapter/alf → alf}/adapter/connection.rb +4 -10
- data/lib/{alf-adapter/alf → alf}/adapter/connection/schema_cached.rb +0 -0
- data/lib/{alf-adapter-fs/alf → alf}/adapter/folder.rb +0 -0
- data/lib/{alf-adapter-fs/alf → alf}/adapter/folder/connection.rb +3 -2
- data/lib/{alf-adapter-fs/alf → alf}/adapter/fs.rb +0 -0
- data/lib/{alf-aggregator/alf → alf}/aggregator.rb +12 -9
- data/lib/{alf-aggregator/alf → alf}/aggregator/avg.rb +0 -0
- data/lib/{alf-aggregator/alf → alf}/aggregator/collect.rb +0 -0
- data/lib/{alf-aggregator/alf → alf}/aggregator/concat.rb +0 -0
- data/lib/{alf-aggregator/alf → alf}/aggregator/count.rb +0 -0
- data/lib/{alf-aggregator/alf → alf}/aggregator/max.rb +0 -0
- data/lib/{alf-aggregator/alf → alf}/aggregator/min.rb +0 -0
- data/lib/{alf-aggregator/alf → alf}/aggregator/stddev.rb +0 -0
- data/lib/{alf-aggregator/alf → alf}/aggregator/sum.rb +0 -0
- data/lib/{alf-aggregator/alf → alf}/aggregator/variance.rb +0 -0
- data/lib/{alf-algebra/alf → alf}/algebra.rb +1 -0
- data/lib/{alf-algebra/alf → alf}/algebra/operand.rb +13 -6
- data/lib/{alf-algebra/alf → alf}/algebra/operand/fake.rb +18 -4
- data/lib/alf/algebra/operand/named.rb +65 -0
- data/lib/{alf-algebra/alf → alf}/algebra/operand/proxy.rb +7 -3
- data/lib/{alf-algebra/alf → alf}/algebra/operator.rb +40 -12
- data/lib/{alf-algebra/alf → alf}/algebra/operator/autonum.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/clip.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/coerce.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/compact.rb +8 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/defaults.rb +8 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/extend.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/frame.rb +12 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/generator.rb +8 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/group.rb +10 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/hierarchize.rb +8 -0
- data/lib/{alf-algebra/alf → alf}/algebra/operator/intersect.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/join.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/matching.rb +10 -2
- data/lib/{alf-algebra/alf → alf}/algebra/operator/minus.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/not_matching.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/page.rb +11 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/project.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/quota.rb +12 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/rank.rb +11 -2
- data/lib/{alf-algebra/alf → alf}/algebra/operator/rename.rb +10 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/restrict.rb +12 -2
- data/lib/{alf-algebra/alf → alf}/algebra/operator/sort.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/summarize.rb +10 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/ungroup.rb +11 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/union.rb +9 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/unwrap.rb +13 -1
- data/lib/{alf-algebra/alf → alf}/algebra/operator/wrap.rb +10 -1
- data/lib/alf/algebra/shortcut.rb +40 -0
- data/lib/alf/algebra/shortcut/allbut.rb +25 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support.rb +2 -1
- data/lib/{alf-algebra/alf → alf}/algebra/support/binary.rb +0 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/classification.rb +0 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/compiler.rb +0 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/experimental.rb +0 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/non_relational.rb +0 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/nullary.rb +0 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/relational.rb +0 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/rewriter.rb +4 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/signature.rb +7 -8
- data/lib/alf/algebra/support/type_check.rb +51 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/unary.rb +0 -0
- data/lib/{alf-algebra/alf → alf}/algebra/support/visitor.rb +2 -1
- data/lib/{alf-algebra/alf → alf}/algebra/support/with_ordering.rb +0 -0
- data/lib/alf/compiler.rb +57 -0
- data/lib/alf/compiler/cog.rb +39 -0
- data/lib/alf/compiler/default.rb +168 -0
- data/lib/alf/compiler/plan.rb +77 -0
- data/lib/{alf-core → alf/core}/loader.rb +0 -0
- data/lib/{alf-core → alf/core}/version.rb +1 -1
- data/lib/{alf-database/alf → alf}/database.rb +0 -0
- data/lib/{alf-database/alf → alf}/database/connection.rb +10 -52
- data/lib/{alf-database/alf → alf}/database/options.rb +2 -5
- data/lib/{alf-core → alf}/dsl.rb +4 -4
- data/lib/{alf-engine/alf → alf}/engine.rb +0 -2
- data/lib/{alf-engine/alf → alf}/engine/aggregate.rb +6 -2
- data/lib/{alf-engine/alf → alf}/engine/autonum.rb +6 -2
- data/lib/{alf-engine/alf → alf}/engine/clip.rb +10 -2
- data/lib/{alf-engine/alf → alf}/engine/coerce.rb +6 -2
- data/lib/alf/engine/cog.rb +58 -0
- data/lib/{alf-engine/alf → alf}/engine/compact.rb +2 -2
- data/lib/{alf-engine/alf → alf}/engine/compact/set.rb +2 -2
- data/lib/{alf-engine/alf → alf}/engine/compact/uniq.rb +2 -2
- data/lib/{alf-engine/alf → alf}/engine/concat.rb +2 -2
- data/lib/{alf-engine/alf → alf}/engine/defaults.rb +6 -2
- data/lib/{alf-engine/alf → alf}/engine/filter.rb +8 -4
- data/lib/{alf-engine/alf → alf}/engine/generator.rb +6 -2
- data/lib/alf/engine/group.rb +7 -0
- data/lib/{alf-engine/alf → alf}/engine/group/hash.rb +11 -2
- data/lib/{alf-engine/alf → alf}/engine/hierarchize.rb +6 -2
- data/lib/{alf-engine/alf → alf}/engine/infer_heading.rb +2 -2
- data/lib/{alf-engine/alf → alf}/engine/join.rb +0 -0
- data/lib/{alf-engine/alf → alf}/engine/join/hash.rb +2 -2
- data/lib/{alf-engine/alf → alf}/engine/leaf.rb +7 -3
- data/lib/{alf-engine/alf → alf}/engine/materialize.rb +5 -1
- data/lib/{alf-engine/alf → alf}/engine/materialize/array.rb +3 -2
- data/lib/{alf-engine/alf → alf}/engine/materialize/hash.rb +3 -2
- data/lib/alf/engine/quota.rb +7 -0
- data/lib/{alf-engine/alf → alf}/engine/quota/cesure.rb +8 -3
- data/lib/alf/engine/rank.rb +7 -0
- data/lib/{alf-engine/alf → alf}/engine/rank/cesure.rb +8 -3
- data/lib/{alf-engine/alf → alf}/engine/rename.rb +6 -2
- data/lib/alf/engine/semi.rb +7 -0
- data/lib/{alf-engine/alf → alf}/engine/semi/hash.rb +7 -2
- data/lib/{alf-engine/alf → alf}/engine/set_attr.rb +8 -4
- data/lib/alf/engine/sort.rb +13 -0
- data/lib/{alf-engine/alf → alf}/engine/sort/in_memory.rb +12 -2
- data/lib/alf/engine/summarize.rb +13 -0
- data/lib/{alf-engine/alf → alf}/engine/summarize/cesure.rb +5 -4
- data/lib/{alf-engine/alf → alf}/engine/summarize/hash.rb +3 -2
- data/lib/{alf-engine/alf → alf}/engine/support/cesure.rb +0 -0
- data/lib/{alf-engine/alf → alf}/engine/take.rb +6 -2
- data/lib/{alf-engine/alf → alf}/engine/to_array.rb +13 -5
- data/lib/{alf-engine/alf → alf}/engine/type_safe.rb +2 -2
- data/lib/{alf-engine/alf → alf}/engine/ungroup.rb +7 -2
- data/lib/{alf-engine/alf → alf}/engine/unwrap.rb +11 -5
- data/lib/{alf-engine/alf → alf}/engine/wrap.rb +6 -2
- data/lib/{alf-core → alf}/errors.rb +2 -3
- data/lib/{alf-core → alf}/ext.rb +0 -0
- data/lib/{alf-core → alf}/ext/domain/heading_based.rb +5 -0
- data/lib/alf/facade.rb +53 -0
- data/lib/{alf-lang/alf → alf}/lang.rb +1 -1
- data/lib/{alf-lang/alf → alf}/lang/functional.rb +0 -4
- data/lib/{alf-lang/alf → alf}/lang/object_oriented.rb +0 -0
- data/lib/{alf-lang/alf → alf}/lang/oo/aggregation_methods.rb +1 -1
- data/lib/{alf-lang/alf → alf}/lang/oo/algebra_methods.rb +0 -12
- data/lib/{alf-lang/alf → alf}/lang/oo/rendering_methods.rb +1 -1
- data/lib/alf/lang/parser.rb +9 -0
- data/lib/alf/lang/parser/lispy.rb +63 -0
- data/lib/alf/lang/parser/safer.rb +69 -0
- data/lib/{alf-lang/alf → alf}/lang/predicates.rb +1 -1
- data/lib/{alf-optimizer/alf → alf}/optimizer.rb +15 -7
- data/lib/alf/optimizer/project.rb +182 -0
- data/lib/{alf-optimizer/alf → alf}/optimizer/restrict.rb +48 -50
- data/lib/{alf-predicate/alf → alf}/predicate.rb +16 -12
- data/lib/{alf-predicate/alf → alf}/predicate/factory.rb +13 -8
- data/lib/{alf-predicate/alf → alf}/predicate/grammar.rb +2 -5
- data/lib/{alf-predicate/alf → alf}/predicate/grammar.sexp.yml +11 -7
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/and.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/contradiction.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/dyadic_comp.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/eq.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/expr.rb +10 -5
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/gt.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/gte.rb +0 -0
- data/lib/{alf-predicate/alf/predicate/nodes/var_ref.rb → alf/predicate/nodes/identifier.rb} +3 -3
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/in.rb +2 -2
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/literal.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/lt.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/lte.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/nadic_bool.rb +0 -0
- data/lib/alf/predicate/nodes/native.rb +32 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/neq.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/not.rb +0 -0
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/or.rb +0 -0
- data/lib/{alf-predicate/alf/predicate/nodes/native.rb → alf/predicate/nodes/qualified_identifier.rb} +8 -4
- data/lib/{alf-predicate/alf → alf}/predicate/nodes/tautology.rb +0 -0
- data/lib/alf/predicate/processors.rb +3 -0
- data/lib/alf/predicate/processors/qualifier.rb +25 -0
- data/lib/alf/predicate/processors/renamer.rb +27 -0
- data/lib/{alf-predicate/alf → alf}/predicate/processors/to_ruby_code.rb +6 -11
- data/lib/{alf-io/alf → alf}/reader.rb +11 -2
- data/lib/{alf-io/alf → alf}/reader/csv.rb +0 -0
- data/lib/{alf-io/alf → alf}/reader/json.rb +0 -0
- data/lib/{alf-io/alf → alf}/reader/rash.rb +0 -0
- data/lib/{alf-io/alf → alf}/reader/ruby.rb +0 -0
- data/lib/alf/reader/yaml.rb +25 -0
- data/lib/{alf-relation/alf → alf}/relation.rb +12 -2
- data/lib/{alf-relvar/alf → alf}/relvar.rb +14 -21
- data/lib/alf/relvar/base.rb +35 -0
- data/lib/{alf-relvar/alf → alf}/relvar/fake.rb +3 -2
- data/lib/{alf-relvar/alf → alf}/relvar/read_only.rb +6 -30
- data/lib/{alf-relvar/alf → alf}/relvar/virtual.rb +0 -31
- data/lib/{alf-io/alf → alf}/renderer.rb +0 -0
- data/lib/{alf-io/alf → alf}/renderer/csv.rb +0 -0
- data/lib/{alf-io/alf → alf}/renderer/json.rb +0 -0
- data/lib/{alf-io/alf → alf}/renderer/rash.rb +0 -0
- data/lib/{alf-io/alf → alf}/renderer/text.rb +0 -0
- data/lib/{alf-io/alf → alf}/renderer/yaml.rb +2 -2
- data/lib/{alf-support/alf → alf}/support.rb +2 -1
- data/lib/{alf-support/alf → alf}/support/coerce.rb +0 -0
- data/lib/{alf-support/alf → alf}/support/config.rb +0 -0
- data/lib/{alf-io/alf → alf}/support/csv_utils.rb +0 -0
- data/lib/{alf-support/alf → alf}/support/dot_utils.rb +0 -0
- data/lib/{alf-support/alf → alf}/support/miscellaneous.rb +0 -0
- data/lib/{alf-support/alf → alf}/support/ordered_set.rb +0 -0
- data/lib/{alf-support/alf → alf}/support/registry.rb +0 -0
- data/lib/{alf-support/alf → alf}/support/scope.rb +0 -0
- data/lib/{alf-support/alf → alf}/support/to_lispy.rb +6 -1
- data/lib/{alf-support/alf → alf}/support/to_ruby_literal.rb +0 -0
- data/lib/alf/support/tree.rb +51 -0
- data/lib/{alf-support/alf → alf}/support/tuple_scope.rb +9 -1
- data/lib/{alf-relation/alf → alf}/tuple.rb +1 -1
- data/lib/{alf-types/alf → alf}/types.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/attr_list.rb +2 -2
- data/lib/{alf-types/alf → alf}/types/attr_name.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/boolean.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/heading.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/keys.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/ordering.rb +7 -1
- data/lib/{alf-types/alf → alf}/types/renaming.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/selection.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/selector.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/size.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/summarization.rb +0 -0
- data/lib/{alf-types/alf → alf}/types/tuple_computation.rb +13 -4
- data/lib/{alf-types/alf → alf}/types/tuple_expression.rb +6 -19
- data/lib/{alf-types/alf → alf}/types/type_check.rb +1 -0
- data/lib/{alf-update/alf → alf}/update.rb +0 -0
- data/lib/{alf-update/alf → alf}/update/deleter.rb +0 -3
- data/lib/{alf-update/alf → alf}/update/inserter.rb +1 -7
- data/lib/{alf-update/alf → alf}/update/updater.rb +0 -2
- data/lib/{alf-viewpoint/alf → alf}/viewpoint.rb +9 -7
- data/lib/{alf-viewpoint/alf → alf}/viewpoint/metadata.rb +5 -2
- data/spec/compiler_helper.rb +20 -0
- data/spec/integration/relation/test_to_array.rb +6 -6
- data/spec/integration/test_examples.rb +14 -6
- data/spec/shared/a_cog.rb +8 -4
- data/spec/shared/a_valid_type_implementation.rb +4 -7
- data/spec/spec_helper.rb +9 -5
- data/spec/type_check_helper.rb +1 -0
- data/spec/unit/alf-adapter/shared_examples/an_adapter_with_readable_cogs.rb +1 -1
- data/spec/unit/alf-aggregator/test_concat.rb +8 -0
- data/spec/unit/alf-algebra/operand/named/test_hash_and_equal.rb +53 -0
- data/spec/unit/alf-algebra/operand/named/test_keys.rb +1 -1
- data/spec/unit/alf-algebra/operand/named/test_to_ascii_tree.rb +18 -0
- data/spec/unit/alf-algebra/operand/named/test_to_cog.rb +24 -0
- data/spec/unit/alf-algebra/operand/named/test_to_relvar.rb +1 -1
- data/spec/unit/alf-algebra/operand/named/test_type_check.rb +38 -0
- data/spec/unit/alf-algebra/operand/proxy/test_to_cog.rb +42 -0
- data/spec/unit/alf-algebra/operand/test_coerce.rb +0 -6
- data/spec/unit/alf-algebra/operand/test_proxy.rb +1 -1
- data/spec/unit/alf-algebra/operator/allbut/test_key_preserving.rb +1 -1
- data/spec/unit/alf-algebra/operator/allbut/test_keys.rb +1 -1
- data/spec/unit/alf-algebra/operator/allbut/test_type_check.rb +42 -0
- data/spec/unit/alf-algebra/operator/autonum/test_type_check.rb +30 -0
- data/spec/unit/alf-algebra/operator/clip/test_type_check.rb +42 -0
- data/spec/unit/alf-algebra/operator/coerce/test_type_check.rb +42 -0
- data/spec/unit/alf-algebra/operator/commons/test_resulting_type.rb +20 -0
- data/spec/unit/alf-algebra/operator/commons/test_to_ascii_tree.rb +40 -0
- data/spec/unit/alf-algebra/operator/extend/test_type_check.rb +42 -0
- data/spec/unit/alf-algebra/operator/frame/test_type_check.rb +54 -0
- data/spec/unit/alf-algebra/operator/group/test_type_check.rb +50 -0
- data/spec/unit/alf-algebra/operator/hierarchize/test_type_check.rb +54 -0
- data/spec/unit/alf-algebra/operator/intersect/test_type_check.rb +30 -0
- data/spec/unit/alf-algebra/operator/join/test_type_check.rb +62 -0
- data/spec/unit/alf-algebra/operator/matching/test_keys.rb +1 -1
- data/spec/unit/alf-algebra/operator/matching/test_type_check.rb +62 -0
- data/spec/unit/alf-algebra/operator/minus/test_type_check.rb +30 -0
- data/spec/unit/alf-algebra/operator/not_matching/test_type_check.rb +62 -0
- data/spec/unit/alf-algebra/operator/page/test_type_check.rb +50 -0
- data/spec/unit/alf-algebra/operator/project/test_type_check.rb +42 -0
- data/spec/unit/alf-algebra/operator/quota/test_type_check.rb +54 -0
- data/spec/unit/alf-algebra/operator/rank/test_type_check.rb +42 -0
- data/spec/unit/alf-algebra/operator/rename/test_type_check.rb +42 -0
- data/spec/unit/alf-algebra/operator/restrict/test_type_check.rb +46 -0
- data/spec/unit/alf-algebra/operator/shared/test_to_cog.rb +34 -0
- data/spec/unit/alf-algebra/operator/sort/test_type_check.rb +30 -0
- data/spec/unit/alf-algebra/operator/summarize/test_type_check.rb +42 -0
- data/spec/unit/alf-algebra/operator/test_hash_and_equal.rb +59 -0
- data/spec/unit/alf-algebra/operator/ungroup/test_type_check.rb +44 -0
- data/spec/unit/alf-algebra/operator/union/test_type_check.rb +30 -0
- data/spec/unit/alf-algebra/operator/unwrap/test_type_check.rb +44 -0
- data/spec/unit/alf-algebra/operator/wrap/test_type_check.rb +50 -0
- data/spec/unit/alf-algebra/support/signature/test_to_lispy.rb +24 -9
- data/spec/unit/alf-algebra/support/test_non_relational.rb +1 -2
- data/spec/unit/alf-algebra/support/test_relational.rb +1 -1
- data/spec/unit/alf-compiler/default/test_allbut.rb +65 -0
- data/spec/unit/alf-compiler/default/test_autonum.rb +30 -0
- data/spec/unit/alf-compiler/default/test_clip.rb +30 -0
- data/spec/unit/alf-compiler/default/test_coerce.rb +30 -0
- data/spec/unit/alf-compiler/default/test_compact.rb +26 -0
- data/spec/unit/alf-compiler/default/test_completude.rb +16 -0
- data/spec/unit/alf-compiler/default/test_defaults.rb +50 -0
- data/spec/unit/alf-compiler/default/test_extend.rb +34 -0
- data/spec/unit/alf-compiler/default/test_frame.rb +77 -0
- data/spec/unit/alf-compiler/default/test_generator.rb +30 -0
- data/spec/unit/alf-compiler/default/test_group.rb +38 -0
- data/spec/unit/alf-compiler/default/test_hierarchize.rb +40 -0
- data/spec/unit/alf-compiler/default/test_intersect.rb +34 -0
- data/spec/unit/alf-compiler/default/test_join.rb +34 -0
- data/spec/unit/alf-compiler/default/test_matching.rb +38 -0
- data/spec/unit/alf-compiler/default/test_minus.rb +38 -0
- data/spec/unit/alf-compiler/default/test_not_matching.rb +38 -0
- data/spec/unit/alf-compiler/default/test_page.rb +91 -0
- data/spec/unit/alf-compiler/default/test_project.rb +76 -0
- data/spec/unit/alf-compiler/default/test_quota.rb +88 -0
- data/spec/unit/alf-compiler/default/test_rank.rb +71 -0
- data/spec/unit/alf-compiler/default/test_rename.rb +30 -0
- data/spec/unit/alf-compiler/default/test_restrict.rb +34 -0
- data/spec/unit/alf-compiler/default/test_sort.rb +81 -0
- data/spec/unit/alf-compiler/default/test_summarize.rb +85 -0
- data/spec/unit/alf-compiler/default/test_ungroup.rb +30 -0
- data/spec/unit/alf-compiler/default/test_union.rb +36 -0
- data/spec/unit/alf-compiler/default/test_unwrap.rb +30 -0
- data/spec/unit/alf-compiler/default/test_wrap.rb +38 -0
- data/spec/unit/alf-compiler/shared/compiled_examples.rb +111 -0
- data/spec/unit/alf-compiler/test_principle.rb +332 -0
- data/spec/unit/alf-core/test_aggregator.rb +0 -24
- data/spec/unit/alf-database/connection/test_parse.rb +0 -49
- data/spec/unit/alf-database/connection/test_relvar.rb +1 -9
- data/spec/unit/alf-database/options/test_parser.rb +23 -0
- data/spec/unit/alf-engine/cog/test_to_ascii_tree.rb +14 -0
- data/spec/unit/alf-engine/test_aggregate.rb +2 -2
- data/spec/unit/alf-engine/test_filter.rb +1 -1
- data/spec/unit/alf-engine/test_to_array.rb +16 -2
- data/spec/unit/alf-io/reader/test_yaml.rb +30 -0
- data/spec/unit/alf-io/renderer/test_yaml.rb +11 -0
- data/spec/unit/alf-lang/functional/test_aggregation.rb +18 -4
- data/spec/unit/alf-lang/parser/lispy/test_connection_bang.rb +28 -0
- data/spec/unit/alf-lang/parser/lispy/test_parse.rb +38 -0
- data/spec/unit/alf-lang/parser/lispy/test_to_s.rb +16 -0
- data/spec/unit/alf-lang/parser/safer/safe.txt +5 -0
- data/spec/unit/alf-lang/parser/safer/test_parse.rb +82 -0
- data/spec/unit/alf-lang/parser/safer/unsafe.txt +14 -0
- data/spec/unit/alf-optimizer/restrict/test_on_autonum.rb +1 -1
- data/spec/unit/alf-optimizer/test_quota.rb +1 -1
- data/spec/unit/alf-optimizer/test_rename.rb +7 -0
- data/spec/unit/alf-optimizer/test_summarize.rb +1 -1
- data/spec/unit/alf-predicate/expr/test_to_proc.rb +4 -6
- data/spec/unit/alf-predicate/expr/test_to_ruby_code.rb +23 -23
- data/spec/unit/alf-predicate/factory/shared/a_comparison_factory_method.rb +3 -3
- data/spec/unit/alf-predicate/factory/test_between.rb +1 -1
- data/spec/unit/alf-predicate/factory/test_comp.rb +3 -3
- data/spec/unit/alf-predicate/factory/test_factor_predicate.rb +3 -3
- data/spec/unit/alf-predicate/factory/{test_var_ref.rb → test_identifier.rb} +4 -4
- data/spec/unit/alf-predicate/factory/test_in.rb +1 -1
- data/spec/unit/alf-predicate/factory/test_native.rb +9 -4
- data/spec/unit/alf-predicate/factory/test_qualified_identifier.rb +17 -0
- data/spec/unit/alf-predicate/grammar/test_match.rb +9 -9
- data/spec/unit/alf-predicate/grammar/test_sexpr.rb +11 -11
- data/spec/unit/alf-predicate/nodes/{var_ref → identifier}/test_and_split.rb +2 -2
- data/spec/unit/alf-predicate/nodes/{var_ref → identifier}/test_free_variables.rb +2 -2
- data/spec/unit/alf-predicate/nodes/identifier/test_name.rb +14 -0
- data/spec/unit/alf-predicate/nodes/qualified_identifier/test_and_split.rb +25 -0
- data/spec/unit/alf-predicate/nodes/qualified_identifier/test_free_variables.rb +14 -0
- data/spec/unit/alf-predicate/nodes/qualified_identifier/test_name.rb +14 -0
- data/spec/unit/alf-predicate/nodes/qualified_identifier/test_qualifier.rb +14 -0
- data/spec/unit/alf-predicate/predicate/test_and_split.rb +4 -4
- data/spec/unit/alf-predicate/predicate/test_bool_and.rb +1 -1
- data/spec/unit/alf-predicate/predicate/test_bool_not.rb +1 -1
- data/spec/unit/alf-predicate/predicate/test_bool_or.rb +1 -1
- data/spec/unit/alf-predicate/predicate/test_coerce.rb +9 -8
- data/spec/unit/alf-predicate/predicate/test_contradiction.rb +2 -2
- data/spec/unit/alf-predicate/predicate/test_factory_methods.rb +12 -12
- data/spec/unit/alf-predicate/predicate/test_qualify.rb +36 -0
- data/spec/unit/alf-predicate/predicate/test_rename.rb +58 -15
- data/spec/unit/alf-predicate/predicate/test_tautology.rb +2 -2
- data/spec/unit/alf-predicate/predicate/test_to_ruby_code.rb +8 -2
- data/spec/unit/alf-predicate/predicate/test_to_ruby_literal.rb +1 -1
- data/spec/unit/alf-predicate/test_predicate.rb +7 -8
- data/spec/unit/alf-relation/relation/class/test_dum.rb +19 -0
- data/spec/unit/alf-relation/relation/test_heading.rb +1 -1
- data/spec/unit/alf-relation/relation/test_keys.rb +17 -0
- data/spec/unit/alf-relation/relation/test_relation.rb +1 -1
- data/spec/unit/alf-relation/relation/test_to_a.rb +10 -10
- data/spec/unit/alf-relvar/base/test_oo_lang.rb +26 -10
- data/spec/unit/alf-relvar/base/test_to_cog.rb +2 -2
- data/spec/unit/alf-relvar/read_only/test_to_relation.rb +17 -0
- data/spec/unit/alf-relvar/read_only/test_type.rb +0 -4
- data/spec/unit/alf-relvar/virtual/test_oo_lang.rb +0 -4
- data/spec/unit/alf-relvar/virtual/test_to_cog.rb +4 -4
- data/spec/unit/alf-relvar/virtual/test_to_s.rb +1 -1
- data/spec/unit/alf-support/test_to_lispy.rb +13 -31
- data/spec/unit/alf-support/test_tuple_scope.rb +11 -0
- data/spec/unit/alf-types/ordering/test_coerce.rb +13 -0
- data/spec/unit/alf-types/ordering/test_lte.rb +43 -0
- data/spec/unit/alf-types/summarization/test_coerce.rb +2 -2
- data/spec/unit/alf-types/summarization/test_least.rb +1 -1
- data/spec/unit/alf-types/summarization/test_summarize.rb +1 -1
- data/spec/unit/alf-types/test_summarization.rb +2 -2
- data/spec/unit/alf-types/test_tuple_expression.rb +2 -2
- data/spec/unit/alf-types/tuple_computation/test_coerce.rb +4 -13
- data/spec/unit/alf-types/tuple_computation/test_empty.rb +24 -0
- data/spec/unit/alf-types/tuple_computation/test_project.rb +46 -0
- data/spec/unit/alf-types/tuple_expression/test_coerce.rb +1 -10
- data/spec/unit/alf-types/tuple_expression/test_evaluate.rb +0 -8
- data/spec/unit/alf-types/tuple_expression/test_to_ruby_literal.rb +0 -5
- data/spec/unit/alf-update/deleter/{test_var_ref.rb → test_identifier.rb} +1 -1
- data/spec/unit/alf-update/inserter/{test_var_ref.rb → test_identifier.rb} +1 -1
- data/spec/unit/alf-update/updater/{test_var_ref.rb → test_identifier.rb} +1 -1
- data/spec/unit/alf-viewpoint/test_native_const.rb +1 -1
- data/spec/update_helper.rb +18 -2
- metadata +417 -313
- data/lib/alf-algebra/alf/algebra/operand/named.rb +0 -36
- data/lib/alf-algebra/alf/algebra/operator/infer_heading.rb +0 -19
- data/lib/alf-algebra/alf/algebra/operator/type_safe.rb +0 -21
- data/lib/alf-algebra/alf/algebra/support/to_dot.rb +0 -196
- data/lib/alf-core/facade.rb +0 -39
- data/lib/alf-engine/alf/engine/cog.rb +0 -50
- data/lib/alf-engine/alf/engine/compiler.rb +0 -171
- data/lib/alf-engine/alf/engine/group.rb +0 -3
- data/lib/alf-engine/alf/engine/quota.rb +0 -3
- data/lib/alf-engine/alf/engine/rank.rb +0 -3
- data/lib/alf-engine/alf/engine/semi.rb +0 -3
- data/lib/alf-engine/alf/engine/sort.rb +0 -30
- data/lib/alf-engine/alf/engine/summarize.rb +0 -4
- data/lib/alf-engine/alf/engine/to_dot.rb +0 -60
- data/lib/alf-io/alf/io.rb +0 -6
- data/lib/alf-lang/alf/lang/lispy.rb +0 -65
- data/lib/alf-predicate/alf/predicate/parser.rb +0 -12
- data/lib/alf-predicate/alf/predicate/processors.rb +0 -3
- data/lib/alf-predicate/alf/predicate/processors/renamer.rb +0 -19
- data/lib/alf-predicate/alf/predicate/processors/to_proc.rb +0 -35
- data/lib/alf-relvar/alf/relvar/base.rb +0 -69
- data/lib/alf-support/alf/support/bindable.rb +0 -26
- data/spec/integration/algebra/test_to_dot.rb +0 -14
- data/spec/integration/relvar/test_type_safe.rb +0 -22
- data/spec/unit/alf-algebra/operator/infer_heading/test_keys.rb +0 -23
- data/spec/unit/alf-algebra/operator/test_infer_heading.rb +0 -16
- data/spec/unit/alf-algebra/operator/type_safe/test_heading.rb +0 -26
- data/spec/unit/alf-algebra/operator/type_safe/test_keys.rb +0 -26
- data/spec/unit/alf-engine/compiler/test_on_frame.rb +0 -70
- data/spec/unit/alf-engine/compiler/test_on_hierarchize.rb +0 -33
- data/spec/unit/alf-engine/compiler/test_on_page.rb +0 -128
- data/spec/unit/alf-engine/compiler/test_unsupported.rb +0 -48
- data/spec/unit/alf-lang/lispy/test_connection_bang.rb +0 -26
- data/spec/unit/alf-lang/lispy/test_parse.rb +0 -38
- data/spec/unit/alf-lang/lispy/test_to_s.rb +0 -14
- data/spec/unit/alf-optimizer/optimizer/test_optimizer.rb +0 -37
- data/spec/unit/alf-optimizer/test_infer_heading.rb +0 -9
- data/spec/unit/alf-predicate/grammar/test_parse.rb +0 -23
- data/spec/unit/alf-predicate/nodes/var_ref/test_var_name.rb +0 -14
- data/spec/unit/alf-relvar/base/test_name.rb +0 -15
- data/spec/unit/alf-relvar/virtual/test_connection.rb +0 -15
- data/spec/unit/alf-support/bindable/test_bind.rb +0 -60
- data/spec/unit/alf-support/bindable/test_bound.rb +0 -31
- data/spec/unit/alf-support/bindable/test_connection.rb +0 -31
- data/spec/unit/alf-support/bindable/test_connection_bang.rb +0 -35
- data/spec/unit/alf-update/inserter/test_type_safe.rb +0 -72
@@ -38,6 +38,7 @@ module Alf
|
|
38
38
|
# # => []
|
39
39
|
#
|
40
40
|
class Materialize::Hash
|
41
|
+
include Materialize
|
41
42
|
include Cog
|
42
43
|
|
43
44
|
# @return [Enumerable] The operand
|
@@ -50,8 +51,8 @@ module Alf
|
|
50
51
|
attr_reader :allbut
|
51
52
|
|
52
53
|
# Creates a Materialize::Hash instance
|
53
|
-
def initialize(operand, key, allbut = false, expr = nil)
|
54
|
-
super(expr)
|
54
|
+
def initialize(operand, key, allbut = false, expr = nil, compiler = nil)
|
55
|
+
super(expr, compiler)
|
55
56
|
@operand = operand
|
56
57
|
@key = key
|
57
58
|
@allbut = allbut
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Alf
|
2
2
|
module Engine
|
3
3
|
class Quota::Cesure
|
4
|
+
include Quota
|
4
5
|
include Engine::Cesure
|
5
6
|
|
6
7
|
# @return [Enumerable] The operand
|
@@ -13,14 +14,18 @@ module Alf
|
|
13
14
|
attr_reader :summarization
|
14
15
|
|
15
16
|
# Creates an Quota::Cesure instance
|
16
|
-
def initialize(operand, by, summarization, expr = nil)
|
17
|
-
super(expr)
|
17
|
+
def initialize(operand, by, summarization, expr = nil, compiler = nil)
|
18
|
+
super(expr, compiler)
|
18
19
|
@operand = operand
|
19
20
|
@by = by.to_attr_list
|
20
21
|
@summarization = summarization
|
21
22
|
end
|
22
23
|
|
23
|
-
|
24
|
+
def arguments
|
25
|
+
[ by, summarization ]
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
24
29
|
|
25
30
|
# (see Cesure#project)
|
26
31
|
def project(tuple)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Alf
|
2
2
|
module Engine
|
3
3
|
class Rank::Cesure
|
4
|
+
include Rank
|
4
5
|
include Engine::Cesure
|
5
6
|
|
6
7
|
# @return [Enumerable] The operand
|
@@ -13,14 +14,18 @@ module Alf
|
|
13
14
|
attr_reader :as
|
14
15
|
|
15
16
|
# Creates an Rank::Cesure instance
|
16
|
-
def initialize(operand, by, as, expr = nil)
|
17
|
-
super(expr)
|
17
|
+
def initialize(operand, by, as, expr = nil, compiler = nil)
|
18
|
+
super(expr, compiler)
|
18
19
|
@operand = operand
|
19
20
|
@by = by.to_attr_list
|
20
21
|
@as = as
|
21
22
|
end
|
22
23
|
|
23
|
-
|
24
|
+
def arguments
|
25
|
+
[ by, as ]
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
24
29
|
|
25
30
|
# (see Cesure#project)
|
26
31
|
def project(tuple)
|
@@ -23,8 +23,8 @@ module Alf
|
|
23
23
|
attr_reader :renaming
|
24
24
|
|
25
25
|
# Creates a Rename instance
|
26
|
-
def initialize(operand, renaming, expr = nil)
|
27
|
-
super(expr)
|
26
|
+
def initialize(operand, renaming, expr = nil, compiler = nil)
|
27
|
+
super(expr, compiler)
|
28
28
|
@operand = operand
|
29
29
|
@renaming = renaming
|
30
30
|
end
|
@@ -36,6 +36,10 @@ module Alf
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
def arguments
|
40
|
+
[ renaming ]
|
41
|
+
end
|
42
|
+
|
39
43
|
end # class Rename
|
40
44
|
end # module Engine
|
41
45
|
end # module Alf
|
@@ -4,6 +4,7 @@ module Alf
|
|
4
4
|
# Filters tuples from `left` that match or do not match tuples from `right`.
|
5
5
|
#
|
6
6
|
class Semi::Hash
|
7
|
+
include Semi
|
7
8
|
include Cog
|
8
9
|
|
9
10
|
# @return [Enumerable] The left operand
|
@@ -16,8 +17,8 @@ module Alf
|
|
16
17
|
attr_reader :predicate
|
17
18
|
|
18
19
|
# Creates a Semi::Hash instance
|
19
|
-
def initialize(left, right, predicate, expr = nil)
|
20
|
-
super(expr)
|
20
|
+
def initialize(left, right, predicate, expr = nil, compiler = nil)
|
21
|
+
super(expr, compiler)
|
21
22
|
@left = left
|
22
23
|
@right = right
|
23
24
|
@predicate = predicate
|
@@ -41,6 +42,10 @@ module Alf
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
45
|
+
def arguments
|
46
|
+
[ predicate ]
|
47
|
+
end
|
48
|
+
|
44
49
|
end # class Semi::Hash
|
45
50
|
end # module Engine
|
46
51
|
end # module Alf
|
@@ -28,8 +28,8 @@ module Alf
|
|
28
28
|
attr_reader :computation
|
29
29
|
|
30
30
|
# Creates a SetAttr instance
|
31
|
-
def initialize(operand, computation, expr = nil)
|
32
|
-
super(expr)
|
31
|
+
def initialize(operand, computation, expr = nil, compiler = nil)
|
32
|
+
super(expr, compiler)
|
33
33
|
@operand = operand
|
34
34
|
@computation = computation
|
35
35
|
end
|
@@ -38,11 +38,15 @@ module Alf
|
|
38
38
|
def _each
|
39
39
|
scope = tuple_scope
|
40
40
|
operand.each do |tuple|
|
41
|
-
t
|
42
|
-
yield tuple.merge(@computation.evaluate(t
|
41
|
+
t = scope.__set_tuple(tuple)
|
42
|
+
yield tuple.merge(@computation.evaluate(t))
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
def arguments
|
47
|
+
[ computation ]
|
48
|
+
end
|
49
|
+
|
46
50
|
end # class SetAttr
|
47
51
|
end # module Engine
|
48
52
|
end # module Alf
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Alf
|
2
|
+
module Engine
|
3
|
+
module Sort
|
4
|
+
|
5
|
+
# Delegates to Sort::InMemory
|
6
|
+
def self.new(operand, ordering, expr = nil, compiler = nil)
|
7
|
+
Sort::InMemory.new(operand, ordering, expr, compiler)
|
8
|
+
end
|
9
|
+
|
10
|
+
end # module Sort
|
11
|
+
end # module Engine
|
12
|
+
end # module Alf
|
13
|
+
require_relative 'sort/in_memory'
|
@@ -16,6 +16,7 @@ module Alf
|
|
16
16
|
# # ]
|
17
17
|
#
|
18
18
|
class Sort::InMemory
|
19
|
+
include Sort
|
19
20
|
include Cog
|
20
21
|
|
21
22
|
# @return [Enumerable] The operand
|
@@ -25,17 +26,26 @@ module Alf
|
|
25
26
|
attr_reader :ordering
|
26
27
|
|
27
28
|
# Creates an Autonum instance
|
28
|
-
def initialize(operand, ordering, expr = nil)
|
29
|
-
super(expr)
|
29
|
+
def initialize(operand, ordering, expr = nil, compiler = nil)
|
30
|
+
super(expr, compiler)
|
30
31
|
@operand = operand
|
31
32
|
@ordering = ordering
|
32
33
|
end
|
33
34
|
|
35
|
+
# (see Cog#cog_orders)
|
36
|
+
def cog_orders
|
37
|
+
@cog_orders ||= [ ordering ]
|
38
|
+
end
|
39
|
+
|
34
40
|
# (see Cog#each)
|
35
41
|
def _each(&block)
|
36
42
|
operand.to_a.sort!(&ordering.sorter).each(&block)
|
37
43
|
end
|
38
44
|
|
45
|
+
def arguments
|
46
|
+
[ ordering ]
|
47
|
+
end
|
48
|
+
|
39
49
|
end # class Sort::InMemory
|
40
50
|
end # module Engine
|
41
51
|
end # module Alf
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Alf
|
2
2
|
module Engine
|
3
3
|
class Summarize::Cesure
|
4
|
-
include
|
4
|
+
include Summarize
|
5
|
+
include Cesure
|
5
6
|
|
6
7
|
# @return [Enumerable] The operand
|
7
8
|
attr_reader :operand
|
@@ -16,15 +17,15 @@ module Alf
|
|
16
17
|
attr_reader :allbut
|
17
18
|
|
18
19
|
# Creates an Summarize::Cesure instance
|
19
|
-
def initialize(operand, by, summarization, allbut, expr = nil)
|
20
|
-
super(expr)
|
20
|
+
def initialize(operand, by, summarization, allbut, expr = nil, compiler = nil)
|
21
|
+
super(expr, compiler)
|
21
22
|
@operand = operand
|
22
23
|
@by = by
|
23
24
|
@summarization = summarization
|
24
25
|
@allbut = allbut
|
25
26
|
end
|
26
27
|
|
27
|
-
|
28
|
+
protected
|
28
29
|
|
29
30
|
# (see Cesure#project)
|
30
31
|
def project(tuple)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Alf
|
2
2
|
module Engine
|
3
3
|
class Summarize::Hash
|
4
|
+
include Summarize
|
4
5
|
include Cog
|
5
6
|
|
6
7
|
# @return [Enumerable] The operand
|
@@ -16,8 +17,8 @@ module Alf
|
|
16
17
|
attr_reader :allbut
|
17
18
|
|
18
19
|
# Creates an Summarize::Hash instance
|
19
|
-
def initialize(operand, by, summarization, allbut, expr = nil)
|
20
|
-
super(expr)
|
20
|
+
def initialize(operand, by, summarization, allbut, expr = nil, compiler = nil)
|
21
|
+
super(expr, compiler)
|
21
22
|
@operand = operand
|
22
23
|
@by = by
|
23
24
|
@summarization = summarization
|
File without changes
|
@@ -31,8 +31,8 @@ module Alf
|
|
31
31
|
attr_reader :limit
|
32
32
|
|
33
33
|
# Creates a Take instance
|
34
|
-
def initialize(operand, offset, limit, expr = nil)
|
35
|
-
super(expr)
|
34
|
+
def initialize(operand, offset, limit, expr = nil, compiler = nil)
|
35
|
+
super(expr, compiler)
|
36
36
|
@operand = operand
|
37
37
|
@offset = offset
|
38
38
|
@limit = limit
|
@@ -48,6 +48,10 @@ module Alf
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
def arguments
|
52
|
+
[ offset, limit ]
|
53
|
+
end
|
54
|
+
|
51
55
|
end # class Take
|
52
56
|
end # module Engine
|
53
57
|
end # module Alf
|
@@ -26,19 +26,24 @@ module Alf
|
|
26
26
|
attr_reader :ordering
|
27
27
|
|
28
28
|
# Creates an ToArray instance
|
29
|
-
def initialize(operand, ordering, expr = nil)
|
30
|
-
super(expr)
|
29
|
+
def initialize(operand, ordering = nil, expr = nil, compiler = nil)
|
30
|
+
super(expr, compiler)
|
31
31
|
@operand = operand
|
32
32
|
@ordering = ordering
|
33
33
|
end
|
34
34
|
|
35
35
|
# (see Cog#each)
|
36
36
|
def _each(&block)
|
37
|
-
Sort.new(operand, ordering)
|
37
|
+
operand = ordering ? Sort.new(self.operand, ordering) : self.operand
|
38
|
+
operand.each do |tuple|
|
38
39
|
yield recurse(tuple)
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
43
|
+
def arguments
|
44
|
+
[ ordering ]
|
45
|
+
end
|
46
|
+
|
42
47
|
private
|
43
48
|
|
44
49
|
def recurse(tuple)
|
@@ -46,13 +51,16 @@ module Alf
|
|
46
51
|
when Hash
|
47
52
|
Hash[tuple.map{|k,v| [ k, reorder(k,v) ] }]
|
48
53
|
when Tuple
|
49
|
-
tuple.remap{|k,v| reorder(k, v) }
|
54
|
+
tuple.remap{|k,v| reorder(k, v) }.to_hash
|
50
55
|
end
|
51
56
|
end
|
52
57
|
|
53
58
|
def reorder(key, value)
|
54
59
|
if RelationLike===value
|
55
|
-
|
60
|
+
subordering = ordering ? ordering.dive(key) : nil
|
61
|
+
ToArray.new(value, subordering).to_a
|
62
|
+
elsif TupleLike===value
|
63
|
+
value.to_hash
|
56
64
|
else
|
57
65
|
value
|
58
66
|
end
|
@@ -10,8 +10,8 @@ module Alf
|
|
10
10
|
attr_reader :checker
|
11
11
|
|
12
12
|
# Creates an Coerce instance
|
13
|
-
def initialize(operand, checker, expr = nil)
|
14
|
-
super(expr)
|
13
|
+
def initialize(operand, checker, expr = nil, compiler = nil)
|
14
|
+
super(expr, compiler)
|
15
15
|
@operand = operand
|
16
16
|
@checker = checker
|
17
17
|
end
|
@@ -10,8 +10,8 @@ module Alf
|
|
10
10
|
attr_reader :attribute
|
11
11
|
|
12
12
|
# Creates a Ungroup instance
|
13
|
-
def initialize(operand, attribute, expr = nil)
|
14
|
-
super(expr)
|
13
|
+
def initialize(operand, attribute, expr = nil, compiler = nil)
|
14
|
+
super(expr, compiler)
|
15
15
|
@operand = operand
|
16
16
|
@attribute = attribute
|
17
17
|
end
|
@@ -22,11 +22,16 @@ module Alf
|
|
22
22
|
tuple = tuple.dup
|
23
23
|
tuple = tuple.to_hash unless tuple.is_a?(Hash)
|
24
24
|
tuple.delete(@attribute).each do |subtuple|
|
25
|
+
subtuple = symbolize(subtuple)
|
25
26
|
yield tuple.merge(subtuple)
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
31
|
+
def arguments
|
32
|
+
[ attribute ]
|
33
|
+
end
|
34
|
+
|
30
35
|
end # class Ungroup
|
31
36
|
end # module Engine
|
32
37
|
end # module Alf
|
@@ -13,8 +13,8 @@ module Alf
|
|
13
13
|
attr_reader :attribute
|
14
14
|
|
15
15
|
# Creates a SetAttr instance
|
16
|
-
def initialize(operand, attribute, expr = nil)
|
17
|
-
super(expr)
|
16
|
+
def initialize(operand, attribute, expr = nil, compiler = nil)
|
17
|
+
super(expr, compiler)
|
18
18
|
@operand = operand
|
19
19
|
@attribute = attribute
|
20
20
|
end
|
@@ -22,13 +22,19 @@ module Alf
|
|
22
22
|
# (see Cog#each)
|
23
23
|
def _each
|
24
24
|
operand.each do |tuple|
|
25
|
-
tuple
|
26
|
-
tuple
|
27
|
-
tuple.
|
25
|
+
tuple = tuple.dup
|
26
|
+
tuple = tuple.to_hash unless tuple.is_a?(Hash)
|
27
|
+
wrapped = tuple.delete(@attribute) || {}
|
28
|
+
wrapped = symbolize(wrapped)
|
29
|
+
tuple.merge!(wrapped)
|
28
30
|
yield tuple
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
34
|
+
def arguments
|
35
|
+
[ attribute ]
|
36
|
+
end
|
37
|
+
|
32
38
|
end # class Unwrap
|
33
39
|
end # module Engine
|
34
40
|
end # module Alf
|