veritas 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +6 -4
- data/Gemfile +23 -12
- data/LICENSE +1 -1
- data/README.rdoc +35 -33
- data/Rakefile +3 -8
- data/TODO +20 -1
- data/config/flay.yml +1 -1
- data/config/roodi.yml +2 -2
- data/lib/veritas/algebra/extension.rb +29 -0
- data/lib/veritas/algebra/join.rb +3 -3
- data/lib/veritas/algebra/product.rb +3 -3
- data/lib/veritas/algebra/projection.rb +31 -2
- data/lib/veritas/algebra/rename/aliases.rb +3 -4
- data/lib/veritas/algebra/rename.rb +14 -0
- data/lib/veritas/algebra/restriction.rb +14 -0
- data/lib/veritas/algebra/summarization.rb +31 -0
- data/lib/veritas/attribute/numeric.rb +1 -1
- data/lib/veritas/attribute/string.rb +1 -1
- data/lib/veritas/attribute.rb +4 -4
- data/lib/veritas/core_ext/range.rb +1 -1
- data/lib/veritas/logic/expression.rb +3 -3
- data/lib/veritas/logic/predicate/enumerable.rb +11 -0
- data/lib/veritas/logic/predicate/exclusion.rb +1 -1
- data/lib/veritas/logic/predicate/inclusion.rb +3 -3
- data/lib/veritas/logic/predicate/inequality.rb +1 -1
- data/lib/veritas/logic/proposition.rb +3 -3
- data/lib/veritas/optimizer/algebra/extension.rb +1 -1
- data/lib/veritas/optimizer/algebra/join.rb +2 -2
- data/lib/veritas/optimizer/algebra/product.rb +3 -3
- data/lib/veritas/optimizer/algebra/projection.rb +4 -4
- data/lib/veritas/optimizer/algebra/rename.rb +36 -12
- data/lib/veritas/optimizer/algebra/restriction.rb +5 -5
- data/lib/veritas/optimizer/algebra/summarization.rb +1 -1
- data/lib/veritas/optimizer/logic/connective/binary.rb +1 -1
- data/lib/veritas/optimizer/logic/connective/negation.rb +1 -1
- data/lib/veritas/optimizer/logic/predicate/comparable.rb +1 -1
- data/lib/veritas/optimizer/logic/predicate/enumerable.rb +1 -1
- data/lib/veritas/optimizer/logic/predicate/exclusion.rb +1 -1
- data/lib/veritas/optimizer/logic/predicate/inclusion.rb +1 -1
- data/lib/veritas/optimizer/relation/operation/binary.rb +1 -1
- data/lib/veritas/optimizer/relation/operation/{combine.rb → combination.rb} +2 -2
- data/lib/veritas/optimizer/relation/operation/limit.rb +9 -18
- data/lib/veritas/optimizer/relation/operation/offset.rb +4 -4
- data/lib/veritas/optimizer/relation/operation/order.rb +3 -3
- data/lib/veritas/optimizer/relation/operation/reverse.rb +2 -2
- data/lib/veritas/optimizer/relation/operation.rb +1 -1
- data/lib/veritas/relation/header.rb +3 -3
- data/lib/veritas/relation/operation/binary.rb +2 -2
- data/lib/veritas/relation/operation/{combine.rb → combination.rb} +2 -2
- data/lib/veritas/relation/operation/limit.rb +25 -17
- data/lib/veritas/relation/operation/offset.rb +25 -17
- data/lib/veritas/relation/operation/order/direction.rb +3 -3
- data/lib/veritas/relation/operation/order/direction_set.rb +3 -3
- data/lib/veritas/relation/operation/order.rb +17 -6
- data/lib/veritas/relation/operation/reverse.rb +1 -1
- data/lib/veritas/relation/operation/set.rb +1 -1
- data/lib/veritas/relation/operation.rb +1 -1
- data/lib/veritas/relation.rb +8 -6
- data/lib/veritas/support/immutable.rb +11 -30
- data/lib/veritas/support/operation/binary.rb +5 -5
- data/lib/veritas/support/operation/unary.rb +4 -4
- data/lib/veritas/support/visitable.rb +20 -0
- data/lib/veritas/tuple.rb +5 -4
- data/lib/veritas/version.rb +1 -1
- data/lib/veritas.rb +1 -0
- data/spec/integration/veritas/algebra/difference/optimize_spec.rb +19 -17
- data/spec/integration/veritas/algebra/intersection/optimize_spec.rb +19 -17
- data/spec/integration/veritas/algebra/projection/optimize_spec.rb +6 -6
- data/spec/integration/veritas/algebra/rename/optimize_spec.rb +5 -5
- data/spec/integration/veritas/algebra/restriction/optimize_spec.rb +3 -3
- data/spec/integration/veritas/algebra/summarization_spec.rb +35 -0
- data/spec/integration/veritas/logic/expression/optimize_spec.rb +8 -0
- data/spec/integration/veritas/relation/operation/limit/optimize_spec.rb +7 -7
- data/spec/integration/veritas/relation/operation/offset/optimize_spec.rb +5 -5
- data/spec/integration/veritas/relation/operation/reverse/optimize_spec.rb +4 -4
- data/spec/integration/veritas/relation/optimize_spec.rb +4 -0
- data/spec/shared/command_method_behavior.rb +5 -0
- data/spec/shared/hash_method_behavior.rb +9 -0
- data/spec/shared/logic_connective_binary_optimize_behavior.rb +2 -2
- data/spec/shared/optimize_method_behavior.rb +5 -4
- data/spec/unit/date/pred_spec.rb +7 -4
- data/spec/unit/range/overlaps_spec.rb +43 -43
- data/spec/unit/range/to_inclusive_spec.rb +9 -5
- data/spec/unit/time/pred_spec.rb +7 -4
- data/spec/unit/veritas/abstract_class/class_methods/new_spec.rb +9 -8
- data/spec/unit/veritas/algebra/difference/each_spec.rb +12 -9
- data/spec/unit/veritas/algebra/difference/methods/difference_spec.rb +6 -5
- data/spec/unit/veritas/algebra/extension/class_methods/new_spec.rb +7 -7
- data/spec/unit/veritas/algebra/extension/each_spec.rb +4 -2
- data/spec/unit/veritas/algebra/extension/eql_spec.rb +64 -0
- data/spec/unit/veritas/algebra/extension/extensions_spec.rb +2 -2
- data/spec/unit/veritas/algebra/extension/hash_spec.rb +14 -0
- data/spec/unit/veritas/algebra/extension/header_spec.rb +2 -2
- data/spec/unit/veritas/algebra/extension/methods/extend_spec.rb +4 -4
- data/spec/unit/veritas/algebra/extension/operand_spec.rb +2 -2
- data/spec/unit/veritas/algebra/intersection/each_spec.rb +9 -8
- data/spec/unit/veritas/algebra/intersection/methods/intersect_spec.rb +6 -5
- data/spec/unit/veritas/algebra/join/class_methods/new_spec.rb +5 -4
- data/spec/unit/veritas/algebra/join/each_spec.rb +5 -4
- data/spec/unit/veritas/algebra/join/methods/join_spec.rb +12 -12
- data/spec/unit/veritas/algebra/product/class_methods/new_spec.rb +10 -9
- data/spec/unit/veritas/algebra/product/each_spec.rb +9 -8
- data/spec/unit/veritas/algebra/product/methods/product_spec.rb +4 -3
- data/spec/unit/veritas/algebra/projection/directions_spec.rb +5 -9
- data/spec/unit/veritas/algebra/projection/each_spec.rb +5 -3
- data/spec/unit/veritas/algebra/projection/eql_spec.rb +65 -0
- data/spec/unit/veritas/algebra/projection/hash_spec.rb +15 -0
- data/spec/unit/veritas/algebra/projection/header_spec.rb +2 -2
- data/spec/unit/veritas/algebra/projection/methods/project_spec.rb +7 -3
- data/spec/unit/veritas/algebra/projection/methods/remove_spec.rb +5 -3
- data/spec/unit/veritas/algebra/rename/aliases/class_methods/coerce_spec.rb +12 -4
- data/spec/unit/veritas/algebra/rename/aliases/each_spec.rb +4 -2
- data/spec/unit/veritas/algebra/rename/aliases/eql_spec.rb +5 -4
- data/spec/unit/veritas/algebra/rename/aliases/equal_value_spec.rb +7 -6
- data/spec/unit/veritas/algebra/rename/aliases/hash_spec.rb +2 -4
- data/spec/unit/veritas/algebra/rename/aliases/to_hash_spec.rb +11 -7
- data/spec/unit/veritas/algebra/rename/aliases/union_spec.rb +5 -5
- data/spec/unit/veritas/algebra/rename/aliases_spec.rb +5 -5
- data/spec/unit/veritas/algebra/rename/directions_spec.rb +4 -4
- data/spec/unit/veritas/algebra/rename/each_spec.rb +6 -4
- data/spec/unit/veritas/algebra/rename/eql_spec.rb +24 -10
- data/spec/unit/veritas/algebra/rename/hash_spec.rb +14 -0
- data/spec/unit/veritas/algebra/rename/header_spec.rb +2 -2
- data/spec/unit/veritas/algebra/rename/methods/rename_spec.rb +5 -5
- data/spec/unit/veritas/algebra/restriction/each_spec.rb +4 -2
- data/spec/unit/veritas/algebra/restriction/eql_spec.rb +24 -9
- data/spec/unit/veritas/algebra/restriction/hash_spec.rb +14 -0
- data/spec/unit/veritas/algebra/restriction/methods/restrict_spec.rb +10 -10
- data/spec/unit/veritas/algebra/restriction/predicate_spec.rb +2 -2
- data/spec/unit/veritas/algebra/summarization/each_spec.rb +4 -2
- data/spec/unit/veritas/algebra/summarization/eql_spec.rb +80 -0
- data/spec/unit/veritas/algebra/summarization/hash_spec.rb +15 -0
- data/spec/unit/veritas/algebra/summarization/header_spec.rb +2 -2
- data/spec/unit/veritas/algebra/summarization/methods/summarize_spec.rb +4 -4
- data/spec/unit/veritas/algebra/summarization/summarize_by_spec.rb +2 -2
- data/spec/unit/veritas/algebra/summarization/summarizers_spec.rb +2 -2
- data/spec/unit/veritas/algebra/union/each_spec.rb +14 -9
- data/spec/unit/veritas/algebra/union/methods/union_spec.rb +6 -5
- data/spec/unit/veritas/aliasable/inheritable_alias_spec.rb +8 -8
- data/spec/unit/veritas/attribute/boolean/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/boolean/valid_value_spec.rb +3 -2
- data/spec/unit/veritas/attribute/call_spec.rb +5 -4
- data/spec/unit/veritas/attribute/class/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/class_methods/coerce_spec.rb +18 -12
- data/spec/unit/veritas/attribute/class_methods/name_from_spec.rb +11 -9
- data/spec/unit/veritas/attribute/class_methods/new_spec.rb +10 -10
- data/spec/unit/veritas/attribute/comparable/comparable_spec.rb +10 -9
- data/spec/unit/veritas/attribute/date/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/date/range_spec.rb +3 -2
- data/spec/unit/veritas/attribute/date_time/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/date_time/range_spec.rb +3 -2
- data/spec/unit/veritas/attribute/decimal/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/eql_spec.rb +17 -15
- data/spec/unit/veritas/attribute/equal_value_spec.rb +19 -17
- data/spec/unit/veritas/attribute/float/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/hash_spec.rb +7 -8
- data/spec/unit/veritas/attribute/inspect_spec.rb +3 -2
- data/spec/unit/veritas/attribute/integer/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/joinable_spec.rb +9 -8
- data/spec/unit/veritas/attribute/name_spec.rb +4 -3
- data/spec/unit/veritas/attribute/numeric/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/numeric/joinable_spec.rb +9 -7
- data/spec/unit/veritas/attribute/numeric/size_spec.rb +5 -3
- data/spec/unit/veritas/attribute/numeric/valid_value_spec.rb +3 -2
- data/spec/unit/veritas/attribute/object/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/options_spec.rb +13 -8
- data/spec/unit/veritas/attribute/orderable/asc_spec.rb +3 -2
- data/spec/unit/veritas/attribute/orderable/desc_spec.rb +3 -2
- data/spec/unit/veritas/attribute/rename_spec.rb +8 -7
- data/spec/unit/veritas/attribute/required_spec.rb +6 -4
- data/spec/unit/veritas/attribute/string/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/string/joinable_spec.rb +9 -8
- data/spec/unit/veritas/attribute/string/length_spec.rb +7 -4
- data/spec/unit/veritas/attribute/string/valid_value_spec.rb +3 -2
- data/spec/unit/veritas/attribute/time/class_methods/primitive_spec.rb +5 -1
- data/spec/unit/veritas/attribute/time/range_spec.rb +3 -2
- data/spec/unit/veritas/attribute/valid_primitive_spec.rb +3 -2
- data/spec/unit/veritas/attribute/valid_value_spec.rb +9 -7
- data/spec/unit/veritas/evaluator/expression/add_spec.rb +8 -8
- data/spec/unit/veritas/evaluator/expression/expressions_spec.rb +1 -1
- data/spec/unit/veritas/immutable/class_methods/freeze_object_spec.rb +5 -1
- data/spec/unit/veritas/immutable/class_methods/new_spec.rb +3 -3
- data/spec/unit/veritas/immutable/dup_spec.rb +4 -4
- data/spec/unit/veritas/immutable/memoize_methods/freeze_spec.rb +12 -10
- data/spec/unit/veritas/immutable/memoize_methods/memoize_spec.rb +6 -6
- data/spec/unit/veritas/immutable/memory/element_reference_spec.rb +4 -3
- data/spec/unit/veritas/immutable/memory/element_set_spec.rb +5 -4
- data/spec/unit/veritas/immutable/module_methods/included_spec.rb +1 -1
- data/spec/unit/veritas/immutable/module_methods/memoize_spec.rb +10 -15
- data/spec/unit/veritas/logic/connective/binary/rename_spec.rb +15 -3
- data/spec/unit/veritas/logic/connective/conjunction/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/connective/conjunction/inspect_spec.rb +6 -5
- data/spec/unit/veritas/logic/connective/conjunction/methods/and_spec.rb +6 -5
- data/spec/unit/veritas/logic/connective/disjunction/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/connective/disjunction/inspect_spec.rb +6 -5
- data/spec/unit/veritas/logic/connective/disjunction/methods/or_spec.rb +6 -5
- data/spec/unit/veritas/logic/connective/inverse_spec.rb +2 -2
- data/spec/unit/veritas/logic/connective/negation/inverse_spec.rb +2 -2
- data/spec/unit/veritas/logic/connective/negation/methods/not_spec.rb +1 -0
- data/spec/unit/veritas/logic/connective/unary/rename_spec.rb +3 -1
- data/spec/unit/veritas/logic/expression/class_methods/call_spec.rb +3 -9
- data/spec/unit/veritas/logic/expression/eql_spec.rb +4 -3
- data/spec/unit/veritas/logic/expression/equal_value_spec.rb +19 -24
- data/spec/unit/veritas/logic/expression/hash_spec.rb +4 -3
- data/spec/unit/veritas/logic/expression/inspect_spec.rb +4 -3
- data/spec/unit/veritas/logic/expression/inverse_spec.rb +4 -3
- data/spec/unit/veritas/logic/expression/rename_spec.rb +6 -4
- data/spec/unit/veritas/logic/predicate/call_spec.rb +6 -5
- data/spec/unit/veritas/logic/predicate/class_methods/call_spec.rb +6 -2
- data/spec/unit/veritas/logic/predicate/class_methods/extract_value_spec.rb +2 -1
- data/spec/unit/veritas/logic/predicate/comparable/class_methods/call_spec.rb +5 -1
- data/spec/unit/veritas/logic/predicate/comparable/inspect_spec.rb +5 -3
- data/spec/unit/veritas/logic/predicate/enumerable/class_methods/compare_method_spec.rb +19 -0
- data/spec/unit/veritas/logic/predicate/eql_spec.rb +31 -16
- data/spec/unit/veritas/logic/predicate/equality/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/equality/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/equality/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/equality/class_methods/reverse_spec.rb +4 -2
- data/spec/unit/veritas/logic/predicate/equality/inspect_spec.rb +3 -2
- data/spec/unit/veritas/logic/predicate/equality/inverse_spec.rb +11 -6
- data/spec/unit/veritas/logic/predicate/equality/methods/eq_spec.rb +4 -2
- data/spec/unit/veritas/logic/predicate/exclusion/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/exclusion/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/exclusion/inspect_spec.rb +2 -2
- data/spec/unit/veritas/logic/predicate/exclusion/inverse_spec.rb +13 -7
- data/spec/unit/veritas/logic/predicate/exclusion/methods/exclude_spec.rb +4 -3
- data/spec/unit/veritas/logic/predicate/fixtures/classes.rb +0 -4
- data/spec/unit/veritas/logic/predicate/greater_than/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/greater_than/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/greater_than/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/greater_than/class_methods/reverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/greater_than/inspect_spec.rb +4 -3
- data/spec/unit/veritas/logic/predicate/greater_than/inverse_spec.rb +12 -7
- data/spec/unit/veritas/logic/predicate/greater_than/methods/gt_spec.rb +4 -2
- data/spec/unit/veritas/logic/predicate/greater_than_or_equal_to/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/greater_than_or_equal_to/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/greater_than_or_equal_to/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/greater_than_or_equal_to/class_methods/reverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/greater_than_or_equal_to/inspect_spec.rb +4 -3
- data/spec/unit/veritas/logic/predicate/greater_than_or_equal_to/inverse_spec.rb +12 -7
- data/spec/unit/veritas/logic/predicate/greater_than_or_equal_to/methods/gte_spec.rb +4 -2
- data/spec/unit/veritas/logic/predicate/hash_spec.rb +7 -7
- data/spec/unit/veritas/logic/predicate/inclusion/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/inclusion/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/inclusion/inspect_spec.rb +2 -2
- data/spec/unit/veritas/logic/predicate/inclusion/inverse_spec.rb +13 -7
- data/spec/unit/veritas/logic/predicate/inclusion/methods/include_spec.rb +4 -3
- data/spec/unit/veritas/logic/predicate/inequality/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/inequality/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/inequality/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/inequality/class_methods/reverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/inequality/inspect_spec.rb +4 -3
- data/spec/unit/veritas/logic/predicate/inequality/inverse_spec.rb +12 -7
- data/spec/unit/veritas/logic/predicate/inequality/methods/ne_spec.rb +4 -2
- data/spec/unit/veritas/logic/predicate/inspect_spec.rb +5 -4
- data/spec/unit/veritas/logic/predicate/inverse_spec.rb +6 -6
- data/spec/unit/veritas/logic/predicate/less_than/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/less_than/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/less_than/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/less_than/class_methods/reverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/less_than/inspect_spec.rb +3 -2
- data/spec/unit/veritas/logic/predicate/less_than/inverse_spec.rb +11 -6
- data/spec/unit/veritas/logic/predicate/less_than/methods/lt_spec.rb +4 -2
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/class_methods/reverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/inspect_spec.rb +4 -3
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/inverse_spec.rb +12 -7
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/methods/lte_spec.rb +4 -2
- data/spec/unit/veritas/logic/predicate/match/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/match/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/match/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/match/inspect_spec.rb +4 -3
- data/spec/unit/veritas/logic/predicate/match/inverse_spec.rb +12 -6
- data/spec/unit/veritas/logic/predicate/match/methods/match_spec.rb +4 -2
- data/spec/unit/veritas/logic/predicate/no_match/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/no_match/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/no_match/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/logic/predicate/no_match/inspect_spec.rb +4 -3
- data/spec/unit/veritas/logic/predicate/no_match/inverse_spec.rb +13 -7
- data/spec/unit/veritas/logic/predicate/no_match/methods/no_match_spec.rb +4 -2
- data/spec/unit/veritas/logic/predicate/rename_spec.rb +13 -10
- data/spec/unit/veritas/logic/proposition/call_spec.rb +4 -4
- data/spec/unit/veritas/logic/proposition/class_methods/call_spec.rb +4 -2
- data/spec/unit/veritas/logic/proposition/class_methods/new_spec.rb +13 -9
- data/spec/unit/veritas/logic/proposition/eql_spec.rb +6 -6
- data/spec/unit/veritas/logic/proposition/false/and_spec.rb +5 -4
- data/spec/unit/veritas/logic/proposition/false/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/proposition/false/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/proposition/false/inspect_spec.rb +3 -2
- data/spec/unit/veritas/logic/proposition/false/inverse_spec.rb +6 -5
- data/spec/unit/veritas/logic/proposition/false/or_spec.rb +4 -3
- data/spec/unit/veritas/logic/proposition/hash_spec.rb +5 -12
- data/spec/unit/veritas/logic/proposition/inspect_spec.rb +8 -4
- data/spec/unit/veritas/logic/proposition/inverse_spec.rb +3 -4
- data/spec/unit/veritas/logic/proposition/true/and_spec.rb +4 -3
- data/spec/unit/veritas/logic/proposition/true/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/logic/proposition/true/class_methods/inverse_spec.rb +3 -1
- data/spec/unit/veritas/logic/proposition/true/inspect_spec.rb +3 -2
- data/spec/unit/veritas/logic/proposition/true/inverse_spec.rb +6 -5
- data/spec/unit/veritas/logic/proposition/true/or_spec.rb +5 -4
- data/spec/unit/veritas/operation/binary/eql_spec.rb +29 -17
- data/spec/unit/veritas/operation/binary/hash_spec.rb +7 -9
- data/spec/unit/veritas/operation/binary/left_spec.rb +19 -6
- data/spec/unit/veritas/operation/binary/right_spec.rb +19 -6
- data/spec/unit/veritas/operation/unary/eql_spec.rb +17 -18
- data/spec/unit/veritas/operation/unary/hash_spec.rb +6 -8
- data/spec/unit/veritas/operation/unary/operand_spec.rb +18 -5
- data/spec/unit/veritas/optimizable/class_methods/optimizer_spec.rb +2 -4
- data/spec/unit/veritas/optimizer/algebra/extension/unoptimized_operand/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/algebra/extension/unoptimized_operand/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/algebra/join/equal_headers/optimize_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/algebra/projection/empty_operand/optimize_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/projection/projection_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/algebra/projection/unoptimized_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/algebra/rename/aliases_spec.rb +12 -7
- data/spec/unit/veritas/optimizer/algebra/rename/class_methods/union_aliases_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/rename/header_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/rename/limit_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/algebra/rename/offset_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/algebra/rename/projection_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/algebra/rename/{rename_operand_and_any_aliases → rename_operand}/optimizable_spec.rb +3 -10
- data/spec/unit/veritas/optimizer/algebra/rename/{rename_operand_and_any_aliases → rename_operand}/optimize_spec.rb +7 -3
- data/spec/unit/veritas/optimizer/algebra/rename/restriction_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/algebra/rename/unchanged_header/optimizable_spec.rb +27 -0
- data/spec/unit/veritas/optimizer/algebra/rename/unchanged_header/optimize_spec.rb +17 -0
- data/spec/unit/veritas/optimizer/algebra/rename/unoptimized_operand/optimize_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/algebra/restriction/class_methods/optimize_predicate_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/algebra/restriction/false_predicate/optimizable_spec.rb +2 -2
- data/spec/unit/veritas/optimizer/algebra/restriction/false_predicate/optimize_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/algebra/restriction/true_predicate/optimizable_spec.rb +2 -2
- data/spec/unit/veritas/optimizer/algebra/restriction/true_predicate/optimize_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/algebra/restriction/unoptimized_operand/optimizable_spec.rb +3 -3
- data/spec/unit/veritas/optimizer/algebra/restriction/unoptimized_operand/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/algebra/summarization/unoptimized_operand/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/algebra/summarization/unoptimized_operand/optimize_spec.rb +6 -2
- data/spec/unit/veritas/optimizer/class_methods/chain_spec.rb +6 -7
- data/spec/unit/veritas/optimizer/logic/connective/binary/redundant_left_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/logic/connective/binary/redundant_right_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/logic/connective/binary/unoptimized_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/logic/connective/conjunction/optimizable_to_exclusion/optimize_spec.rb +11 -4
- data/spec/unit/veritas/optimizer/logic/connective/conjunction/true_left_operand/optimizable_spec.rb +2 -2
- data/spec/unit/veritas/optimizer/logic/connective/conjunction/true_left_operand/optimize_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/connective/conjunction/true_right_operand/optimizable_spec.rb +2 -2
- data/spec/unit/veritas/optimizer/logic/connective/conjunction/true_right_operand/optimize_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/connective/disjunction/false_left_operand/optimizable_spec.rb +2 -2
- data/spec/unit/veritas/optimizer/logic/connective/disjunction/false_left_operand/optimize_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/connective/disjunction/false_right_operand/optimizable_spec.rb +2 -2
- data/spec/unit/veritas/optimizer/logic/connective/disjunction/false_right_operand/optimize_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/connective/disjunction/optimizable_to_inclusion/optimize_spec.rb +11 -4
- data/spec/unit/veritas/optimizer/logic/connective/negation/invertible_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/logic/predicate/comparable/never_comparable/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/comparable/never_equivalent/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/comparable/normalizable_operands/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/comparable/normalizable_operands/optimize_spec.rb +6 -2
- data/spec/unit/veritas/optimizer/logic/predicate/enumerable/empty_right_operand/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/enumerable/one_right_operand/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/enumerable/unoptimized_operand/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/enumerable/unoptimized_operand/optimize_spec.rb +21 -5
- data/spec/unit/veritas/optimizer/logic/predicate/equality/always_true/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/exclusion/empty_right_operand/optimize_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/exclusion/one_right_operand/optimize_spec.rb +26 -6
- data/spec/unit/veritas/optimizer/logic/predicate/greater_than/always_false/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/greater_than/always_true/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/greater_than_or_equal_to/always_false/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/greater_than_or_equal_to/always_true/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/inclusion/empty_right_operand/optimize_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/inclusion/one_right_operand/optimize_spec.rb +27 -6
- data/spec/unit/veritas/optimizer/logic/predicate/inequality/always_false/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/left_spec.rb +19 -6
- data/spec/unit/veritas/optimizer/logic/predicate/less_than/always_false/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/less_than/always_true/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/less_than_or_equal_to/always_false/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/less_than_or_equal_to/always_true/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/logic/predicate/right_spec.rb +19 -6
- data/spec/unit/veritas/optimizer/relation/operation/binary/unoptimized_operand/optimize_spec.rb +7 -3
- data/spec/unit/veritas/optimizer/relation/operation/combination/optimize_spec.rb +15 -0
- data/spec/unit/veritas/optimizer/relation/operation/limit/{inequal_limit_operand → limit_operand}/optimizable_spec.rb +6 -12
- data/spec/unit/veritas/optimizer/relation/operation/limit/{inequal_limit_operand → limit_operand}/optimize_spec.rb +15 -7
- data/spec/unit/veritas/optimizer/relation/operation/limit/unoptimized_operand/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/relation/operation/limit/unoptimized_operand/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/relation/operation/offset/offset_operand/optimize_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/relation/operation/offset/unoptimized_operand/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/relation/operation/offset/unoptimized_operand/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/relation/operation/order/order_operand/optimize_spec.rb +3 -1
- data/spec/unit/veritas/optimizer/relation/operation/order/unoptimized_operand/optimizable_spec.rb +1 -1
- data/spec/unit/veritas/optimizer/relation/operation/order/unoptimized_operand/optimize_spec.rb +4 -2
- data/spec/unit/veritas/optimizer/relation/operation/reverse/order_operand/optimize_spec.rb +5 -1
- data/spec/unit/veritas/optimizer/relation/operation/reverse/unoptimized_operand/optimize_spec.rb +6 -3
- data/spec/unit/veritas/relation/class_methods/new_spec.rb +10 -14
- data/spec/unit/veritas/relation/directions_spec.rb +10 -4
- data/spec/unit/veritas/relation/each_spec.rb +29 -14
- data/spec/unit/veritas/relation/element_reference_spec.rb +9 -5
- data/spec/unit/veritas/relation/empty/each_spec.rb +6 -5
- data/spec/unit/veritas/relation/empty/empty_spec.rb +3 -2
- data/spec/unit/veritas/relation/empty/header_spec.rb +6 -4
- data/spec/unit/veritas/relation/empty_spec.rb +8 -3
- data/spec/unit/veritas/relation/eql_spec.rb +50 -16
- data/spec/unit/veritas/relation/equal_value_spec.rb +48 -39
- data/spec/unit/veritas/relation/hash_spec.rb +10 -5
- data/spec/unit/veritas/relation/header/class_methods/coerce_spec.rb +13 -9
- data/spec/unit/veritas/relation/header/difference_spec.rb +7 -6
- data/spec/unit/veritas/relation/header/each_spec.rb +18 -13
- data/spec/unit/veritas/relation/header/element_reference_spec.rb +3 -2
- data/spec/unit/veritas/relation/header/empty_spec.rb +5 -3
- data/spec/unit/veritas/relation/header/eql_spec.rb +23 -49
- data/spec/unit/veritas/relation/header/equal_value_spec.rb +33 -31
- data/spec/unit/veritas/relation/header/hash_spec.rb +6 -6
- data/spec/unit/veritas/relation/header/index_spec.rb +8 -7
- data/spec/unit/veritas/relation/header/inspect_spec.rb +4 -3
- data/spec/unit/veritas/relation/header/intersect_spec.rb +5 -4
- data/spec/unit/veritas/relation/header/project_spec.rb +5 -3
- data/spec/unit/veritas/relation/header/rename_spec.rb +7 -6
- data/spec/unit/veritas/relation/header/to_ary_spec.rb +5 -4
- data/spec/unit/veritas/relation/header/union_spec.rb +7 -6
- data/spec/unit/veritas/relation/header_spec.rb +9 -6
- data/spec/unit/veritas/relation/materialize_spec.rb +7 -2
- data/spec/unit/veritas/relation/materialized/class_methods/new_spec.rb +6 -7
- data/spec/unit/veritas/relation/materialized/empty_spec.rb +4 -3
- data/spec/unit/veritas/relation/materialized/materialize_spec.rb +2 -1
- data/spec/unit/veritas/relation/materialized/size_spec.rb +5 -4
- data/spec/unit/veritas/relation/operation/binary/class_methods/new_spec.rb +4 -3
- data/spec/unit/veritas/relation/operation/binary/directions_spec.rb +8 -7
- data/spec/unit/veritas/relation/operation/binary/header_spec.rb +7 -6
- data/spec/unit/veritas/relation/operation/{combine → combination}/class_methods/combine_tuples_spec.rb +7 -5
- data/spec/unit/veritas/relation/operation/{combine → combination}/fixtures/classes.rb +3 -3
- data/spec/unit/veritas/relation/operation/combination/header_spec.rb +19 -0
- data/spec/unit/veritas/relation/operation/limit/class_methods/new_spec.rb +10 -2
- data/spec/unit/veritas/relation/operation/limit/each_spec.rb +10 -8
- data/spec/unit/veritas/relation/operation/limit/eql_spec.rb +31 -17
- data/spec/unit/veritas/relation/operation/limit/hash_spec.rb +15 -0
- data/spec/unit/veritas/relation/operation/limit/limit_spec.rb +13 -0
- data/spec/unit/veritas/relation/operation/limit/methods/first_spec.rb +14 -9
- data/spec/unit/veritas/relation/operation/limit/methods/last_spec.rb +12 -11
- data/spec/unit/veritas/relation/operation/limit/methods/take_spec.rb +8 -4
- data/spec/unit/veritas/relation/operation/offset/class_methods/new_spec.rb +10 -2
- data/spec/unit/veritas/relation/operation/offset/each_spec.rb +10 -8
- data/spec/unit/veritas/relation/operation/offset/eql_spec.rb +30 -17
- data/spec/unit/veritas/relation/operation/offset/hash_spec.rb +15 -0
- data/spec/unit/veritas/relation/operation/offset/methods/drop_spec.rb +8 -4
- data/spec/unit/veritas/relation/operation/offset/offset_spec.rb +13 -0
- data/spec/unit/veritas/relation/operation/order/ascending/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/relation/operation/order/ascending/class_methods/reverse_spec.rb +3 -1
- data/spec/unit/veritas/relation/operation/order/ascending/reverse_spec.rb +4 -3
- data/spec/unit/veritas/relation/operation/order/class_methods/new_spec.rb +20 -5
- data/spec/unit/veritas/relation/operation/order/descending/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/relation/operation/order/descending/class_methods/reverse_spec.rb +3 -1
- data/spec/unit/veritas/relation/operation/order/descending/reverse_spec.rb +4 -3
- data/spec/unit/veritas/relation/operation/order/direction/attribute_spec.rb +3 -3
- data/spec/unit/veritas/relation/operation/order/direction/call_spec.rb +6 -11
- data/spec/unit/veritas/relation/operation/order/direction/class_methods/coerce_spec.rb +10 -8
- data/spec/unit/veritas/relation/operation/order/direction/eql_spec.rb +16 -16
- data/spec/unit/veritas/relation/operation/order/direction/hash_spec.rb +5 -7
- data/spec/unit/veritas/relation/operation/order/direction/rename_spec.rb +4 -6
- data/spec/unit/veritas/relation/operation/order/direction/reverse_spec.rb +7 -7
- data/spec/unit/veritas/relation/operation/order/direction_set/attributes_spec.rb +4 -3
- data/spec/unit/veritas/relation/operation/order/direction_set/class_methods/coerce_spec.rb +14 -11
- data/spec/unit/veritas/relation/operation/order/direction_set/each_spec.rb +18 -14
- data/spec/unit/veritas/relation/operation/order/direction_set/empty_spec.rb +6 -4
- data/spec/unit/veritas/relation/operation/order/direction_set/eql_spec.rb +17 -16
- data/spec/unit/veritas/relation/operation/order/direction_set/equal_value_spec.rb +37 -16
- data/spec/unit/veritas/relation/operation/order/direction_set/hash_spec.rb +7 -7
- data/spec/unit/veritas/relation/operation/order/direction_set/project_spec.rb +6 -4
- data/spec/unit/veritas/relation/operation/order/direction_set/rename_spec.rb +8 -7
- data/spec/unit/veritas/relation/operation/order/direction_set/reverse_spec.rb +6 -5
- data/spec/unit/veritas/relation/operation/order/direction_set/sort_tuples_spec.rb +10 -29
- data/spec/unit/veritas/relation/operation/order/direction_set/to_ary_spec.rb +5 -4
- data/spec/unit/veritas/relation/operation/order/direction_set/union_spec.rb +7 -6
- data/spec/unit/veritas/relation/operation/order/directions_spec.rb +6 -7
- data/spec/unit/veritas/relation/operation/order/each_spec.rb +7 -4
- data/spec/unit/veritas/relation/operation/order/eql_spec.rb +30 -16
- data/spec/unit/veritas/relation/operation/order/hash_spec.rb +14 -0
- data/spec/unit/veritas/relation/operation/order/header_spec.rb +7 -8
- data/spec/unit/veritas/relation/operation/order/methods/order_spec.rb +14 -12
- data/spec/unit/veritas/relation/operation/reverse/class_methods/new_spec.rb +13 -2
- data/spec/unit/veritas/relation/operation/reverse/each_spec.rb +10 -8
- data/spec/unit/veritas/relation/operation/reverse/methods/reverse_spec.rb +4 -3
- data/spec/unit/veritas/relation/operation/set/class_methods/new_spec.rb +9 -8
- data/spec/unit/veritas/relation/operation/set/header_spec.rb +2 -2
- data/spec/unit/veritas/relation/operation/unary/directions_spec.rb +8 -7
- data/spec/unit/veritas/relation/operation/unary/header_spec.rb +7 -7
- data/spec/unit/veritas/tuple/class_methods/coerce_spec.rb +17 -7
- data/spec/unit/veritas/tuple/element_reference_spec.rb +3 -2
- data/spec/unit/veritas/tuple/eql_spec.rb +23 -47
- data/spec/unit/veritas/tuple/equal_value_spec.rb +28 -25
- data/spec/unit/veritas/tuple/extend_spec.rb +3 -2
- data/spec/unit/veritas/tuple/hash_spec.rb +6 -6
- data/spec/unit/veritas/tuple/header_spec.rb +5 -4
- data/spec/unit/veritas/tuple/inspect_spec.rb +3 -2
- data/spec/unit/veritas/tuple/join_spec.rb +3 -2
- data/spec/unit/veritas/tuple/project_spec.rb +4 -3
- data/spec/unit/veritas/tuple/to_ary_spec.rb +4 -3
- data/spec/unit/veritas/visitable/accept_spec.rb +16 -0
- data/tasks/quality/heckle.rake +8 -8
- data/tasks/spec.rake +0 -3
- data/veritas.gemspec +1339 -1311
- metadata +95 -57
- data/.gitignore +0 -34
- data/Gemfile.lock +0 -122
- data/spec/unit/veritas/abstract_class/fixtures/classes.rb +0 -7
- data/spec/unit/veritas/logic/proposition/fixtures/classes.rb +0 -8
- data/spec/unit/veritas/optimizer/relation/operation/combine/optimize_spec.rb +0 -15
- data/spec/unit/veritas/relation/operation/combine/header_spec.rb +0 -18
- data/spec/unit/veritas/relation/operation/limit/to_i_spec.rb +0 -12
- data/spec/unit/veritas/relation/operation/offset/to_i_spec.rb +0 -12
data/.autotest
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
%w[ fsevent growl ].each do |autotest_ext|
|
2
|
+
begin
|
3
|
+
require "autotest/#{autotest_ext}"
|
4
|
+
rescue LoadError
|
5
|
+
# do nothing
|
6
|
+
end
|
5
7
|
end
|
6
8
|
|
7
9
|
MATCH_ALL_SPECS = %r{\Aspec/.+_spec\.rb\z}.freeze
|
data/Gemfile
CHANGED
@@ -1,25 +1,36 @@
|
|
1
1
|
source :rubygems
|
2
2
|
|
3
|
-
|
3
|
+
group :development do
|
4
|
+
gem 'backports', '~> 2.0.2'
|
5
|
+
gem 'jeweler', '~> 1.5.2'
|
6
|
+
gem 'rake', '~> 0.8.7'
|
7
|
+
gem 'rspec', '~> 1.3.1'
|
8
|
+
end
|
9
|
+
|
10
|
+
group :jruby do
|
11
|
+
platform :jruby do
|
12
|
+
gem 'jruby-openssl', '~> 0.7.3'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
group :benchmarks do
|
17
|
+
gem 'rbench', '~> 0.2.3'
|
18
|
+
end
|
4
19
|
|
5
20
|
platforms :mri_18 do
|
6
21
|
group :quality do
|
7
|
-
gem 'activesupport', '~> 2.3.
|
8
|
-
gem 'flay', '~> 1.4.
|
9
|
-
gem 'flog', '~> 2.
|
22
|
+
gem 'activesupport', '~> 2.3.11'
|
23
|
+
gem 'flay', '~> 1.4.2'
|
24
|
+
gem 'flog', '~> 2.5.1'
|
10
25
|
gem 'heckle', '~> 1.4.3'
|
11
|
-
gem 'json', '~> 1.
|
12
|
-
gem 'metric_fu', '~> 2.
|
26
|
+
gem 'json', '~> 1.5.1'
|
27
|
+
gem 'metric_fu', '~> 2.1.1'
|
13
28
|
gem 'mspec', '~> 1.5.17'
|
14
29
|
gem 'rcov', '~> 0.9.9'
|
15
|
-
gem 'reek', '~> 1.2.8'
|
30
|
+
gem 'reek', '~> 1.2.8', :git => 'git://github.com/dkubb/reek.git'
|
16
31
|
gem 'roodi', '~> 2.1.0'
|
17
32
|
gem 'ruby2ruby', '= 1.2.2'
|
18
|
-
gem 'yard', '~> 0.6.
|
33
|
+
gem 'yard', '~> 0.6.4'
|
19
34
|
gem 'yardstick', '~> 0.2.0'
|
20
35
|
end
|
21
36
|
end
|
22
|
-
|
23
|
-
group :benchmarks do
|
24
|
-
gem 'rbench', '~> 0.2.3'
|
25
|
-
end
|
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -2,32 +2,6 @@
|
|
2
2
|
|
3
3
|
Simplifies querying of structured data using relational algebra
|
4
4
|
|
5
|
-
== Goals
|
6
|
-
|
7
|
-
The purpose of this project is to expand my knowledge of relational algebra by attempting to implement a simple query system using the primitive operations defined in relational algebra.
|
8
|
-
|
9
|
-
Most of the design is heavily inspired from koios[http://github.com/carllerche/koios] and arel[http://github.com/rails/arel]. The reason I decided to write my own and not just build on top of those systems was not so much because I don't like the code/API in those projects, it's more because I wanted to gain a depth of understanding that can only be earned by trying to solve the problem myself.
|
10
|
-
|
11
|
-
I should note though that I don't plan to just re-implement those systems with a different API, or different internals, I plan to make something that surpasses them in several areas. For example, I want to be able to join information from multiple datastores and represent it as a single relation. I want to be able to insert, update or delete from that relation and have those changes propagated back to the right datastore. This is not an easy feat, since it is basically the writable view problem that RDBMS' struggle with. While I do think there are some cases where relations will become read-only, I think it will be possible to propagate writes properly in this manner. I certainly think for the current use cases in DataMapper this should work quite well.
|
12
|
-
|
13
|
-
The ability to join data from multiple datastores and have it presented in a consistent manner will solve one of the longest standing problems in DataMapper, namely how do we do cross repository joins. It should be possible to construct one query for one datastore, and then another query for another datastore and then join them. Since they are using different engines veritas will know to perform each query *natively* and then join the results in-memory seamlessly. It should also be possible to reorganize the queries so that as much work as possible is done natively as opposed to in-memory, which is considered the last resort.
|
14
|
-
|
15
|
-
Not only does this work nicely with associations, but it will allow DataMapper to perform mapping in a more powerful way. You'll be able to construct a join from multiple datastores, and set that as the base for your model. Each DM Resource would work as normal, but again writes could be propagated back to the appropriate datastore. You'd be able to split your data up between different datastores, but assemble it into one coherent view.
|
16
|
-
|
17
|
-
=== Phase 1: In-Memory Operations
|
18
|
-
|
19
|
-
The first phase of this project will be to implement all the operations listed below using in-memory data structures. I'm focusing on the API, and making sure the specs ensure the desired results are obtained from each operation.
|
20
|
-
|
21
|
-
This has been marked as 90% complete for some time. In actuality most of the features below are completed besides the first examples for #extend and #summarize. Those will require a system to define functions as objects that can be introspected and walked to "visit" and generate SQL or other query languages from them. The Proc based functions are opaque and will probably never be possible to generate native queries from them. For this reason they will only be recommended when they depends on functionality not available in the datastore.
|
22
|
-
|
23
|
-
=== Phase 2: RDBMS Engines
|
24
|
-
|
25
|
-
The second phase of this project will be to add an RDBMS based engine, and move the in-memory matching to it's own engine. I'll also be working on a system where if the primary engine cannot carry out some operation, that it first look at alternate forms (eg. using a join instead of an intersection), and then fall-back to in-memory matching. I also want to look at re-arranging queries so that all the operations that can be performed natively are "pushed down" the hierarchy and then the in-memory matching is performed last.
|
26
|
-
|
27
|
-
=== Phase 3: DataMapper Integration
|
28
|
-
|
29
|
-
The third phase of this project will be to add a few NoSQL engines (like MongoDB[http://www.mongodb.org/] and CouchDB[http://couchdb.org/]) and then look at writing a DataMapper adapter that translates Query objects into Veritas relations. I want to make sure all the DM specs pass with this adapter and each engine, and if everything goes well I will look at updating DM to work directly on top of Veritas.
|
30
|
-
|
31
5
|
== Usage
|
32
6
|
|
33
7
|
relation = Veritas::Relation.new([ [ :id, Integer ] ], [ [ 1 ] ])
|
@@ -93,12 +67,15 @@ The third phase of this project will be to add a few NoSQL engines (like MongoDB
|
|
93
67
|
new_relation = relation.order([ relation[:a].desc, relation[:b] ])
|
94
68
|
new_relation = relation.order { |r| [ r[:a].desc, r[:b] ] }
|
95
69
|
|
96
|
-
#
|
97
|
-
new_relation = relation.
|
70
|
+
# reverse the relation (only allowed if ordered)
|
71
|
+
new_relation = relation.reverse
|
98
72
|
|
99
73
|
# offset (only allowed if ordered)
|
100
74
|
new_relation = relation.drop(5)
|
101
75
|
|
76
|
+
# limiting (only allowed if ordered)
|
77
|
+
new_relation = relation.take(10)
|
78
|
+
|
102
79
|
# get the first n tuples (only allowed if ordered)
|
103
80
|
new_relation = relation.first # default is 1
|
104
81
|
new_relation = relation.first(5)
|
@@ -107,9 +84,6 @@ The third phase of this project will be to add a few NoSQL engines (like MongoDB
|
|
107
84
|
new_relation = relation.last # default is 1
|
108
85
|
new_relation = relation.last(5)
|
109
86
|
|
110
|
-
# reverse the relation (only allowed if ordered)
|
111
|
-
new_relation = relation.reverse
|
112
|
-
|
113
87
|
# CRUD Operators
|
114
88
|
# --------------
|
115
89
|
|
@@ -118,6 +92,34 @@ The third phase of this project will be to add a few NoSQL engines (like MongoDB
|
|
118
92
|
new_relation = relation.update(:a => 'test', :b => 'other', :c => 'yet another')
|
119
93
|
new_relation = relation.delete
|
120
94
|
|
95
|
+
== Goals
|
96
|
+
|
97
|
+
The purpose of this project is to expand my knowledge of relational algebra by attempting to implement a simple query system using the primitive operations defined in relational algebra.
|
98
|
+
|
99
|
+
Most of the design is heavily inspired from koios[https://github.com/carllerche/koios] and arel[https://github.com/rails/arel]. The reason I decided to write my own and not just build on top of those systems was not so much because I don't like the code/API in those projects, it's more because I wanted to gain a depth of understanding that can only be earned by trying to solve the problem myself.
|
100
|
+
|
101
|
+
I should note though that I don't plan to just re-implement those systems with a different API, or different internals, I plan to make something that surpasses them in several areas. For example, I want to be able to join information from multiple datastores and represent it as a single relation. I want to be able to insert, update or delete from that relation and have those changes propagated back to the right datastore. This is not an easy feat, since it is basically the writable view problem that RDBMS' struggle with. While I do think there are some cases where relations will become read-only, I think it will be possible to propagate writes properly in this manner. I certainly think for the current use cases in DataMapper this should work quite well.
|
102
|
+
|
103
|
+
The ability to join data from multiple datastores and have it presented in a consistent manner will solve one of the longest standing problems in DataMapper, namely how do we do cross repository joins. It should be possible to construct one query for one datastore, and then another query for another datastore and then join them. Since they are using different engines veritas will know to perform each query *natively* and then join the results in-memory seamlessly. It should also be possible to reorganize the queries so that as much work as possible is done natively as opposed to in-memory, which is considered the last resort.
|
104
|
+
|
105
|
+
Not only does this work nicely with associations, but it will allow DataMapper to perform mapping in a more powerful way. You'll be able to construct a join from multiple datastores, and set that as the base for your model. Each DM Resource would work as normal, but again writes could be propagated back to the appropriate datastore. You'd be able to split your data up between different datastores, but assemble it into one coherent view.
|
106
|
+
|
107
|
+
=== Phase 1: In-Memory Operations
|
108
|
+
|
109
|
+
The first phase of this project will be to implement all the operations listed below using in-memory data structures. I'm focusing on the API, and making sure the specs ensure the desired results are obtained from each operation.
|
110
|
+
|
111
|
+
This is 100% complete now.
|
112
|
+
|
113
|
+
=== Phase 2: RDBMS Engines
|
114
|
+
|
115
|
+
The second phase of this project will be to add an RDBMS based engine, and move the in-memory matching to it's own engine. I'll also be working on a system where if the primary engine cannot carry out some operation, that it first look at alternate forms (eg. using a join instead of an intersection), and then fall-back to in-memory matching. I also want to look at re-arranging queries so that all the operations that can be performed natively are "pushed down" the hierarchy and then the in-memory matching is performed last.
|
116
|
+
|
117
|
+
This is 30% complete. I am currently working on the veritas-sql-compiler[https://github.com/dkubb/veritas-sql-compiler] which is a visitor that walks the AST and produces SQL. Most of the Unary options work, and I am about to begin work on the binary options. Further refactoring will need to be performed to keep the Visitor class from growing huge (it has one method for each "node type").
|
118
|
+
|
119
|
+
=== Phase 3: DataMapper Integration
|
120
|
+
|
121
|
+
The third phase of this project will be to add a few NoSQL engines (like MongoDB[http://www.mongodb.org/] and CouchDB[http://couchdb.org/]) and then look at writing a DataMapper adapter that translates Query objects into Veritas relations. I want to make sure all the DM specs pass with this adapter and each engine, and if everything goes well I will look at updating DM to work directly on top of Veritas.
|
122
|
+
|
121
123
|
== Note on Patches/Pull Requests
|
122
124
|
|
123
125
|
* If you want your code merged into the mainline, please discuss
|
@@ -128,7 +130,7 @@ The third phase of this project will be to add a few NoSQL engines (like MongoDB
|
|
128
130
|
them is laid, or may be more applicable in a plugin.
|
129
131
|
* Fork the project.
|
130
132
|
* Make your feature addition or bug fix.
|
131
|
-
* Follow this
|
133
|
+
* Follow this {style guide}[https://github.com/dkubb/styleguide].
|
132
134
|
* Add specs for it. This is important so I don't break it in a
|
133
135
|
future version unintentionally. Tests must cover all branches
|
134
136
|
within the code, and code must be fully covered.
|
@@ -140,4 +142,4 @@ The third phase of this project will be to add a few NoSQL engines (like MongoDB
|
|
140
142
|
|
141
143
|
== Copyright
|
142
144
|
|
143
|
-
Copyright (c)
|
145
|
+
Copyright (c) 2009-2011 Dan Kubb. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rake'
|
|
3
3
|
require File.expand_path('../lib/veritas/version', __FILE__)
|
4
4
|
|
5
5
|
begin
|
6
|
-
gem('jeweler', '~> 1.
|
6
|
+
gem('jeweler', '~> 1.5.2') if respond_to?(:gem, true)
|
7
7
|
require 'jeweler'
|
8
8
|
|
9
9
|
Jeweler::Tasks.new do |gem|
|
@@ -11,21 +11,16 @@ begin
|
|
11
11
|
gem.summary = 'Ruby Relational Algebra'
|
12
12
|
gem.description = 'Simplifies querying of structured data using relational algebra'
|
13
13
|
gem.email = 'dan.kubb@gmail.com'
|
14
|
-
gem.homepage = '
|
14
|
+
gem.homepage = 'https://github.com/dkubb/veritas'
|
15
15
|
gem.authors = [ 'Dan Kubb' ]
|
16
16
|
gem.has_rdoc = 'yard'
|
17
17
|
|
18
18
|
gem.version = Veritas::VERSION
|
19
|
-
|
20
|
-
gem.add_development_dependency 'rake', '~> 0.8.7'
|
21
|
-
gem.add_development_dependency 'rspec', '~> 1.3.1'
|
22
|
-
gem.add_development_dependency 'jeweler', '~> 1.4.0'
|
23
|
-
gem.add_development_dependency 'backports', '~> 1.18.2'
|
24
19
|
end
|
25
20
|
|
26
21
|
Jeweler::GemcutterTasks.new
|
27
22
|
|
28
23
|
FileList['tasks/**/*.rake'].each { |task| import task }
|
29
24
|
rescue LoadError
|
30
|
-
puts 'Jeweler
|
25
|
+
puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler -v 1.5.2'
|
31
26
|
end
|
data/TODO
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
+
* Raise an exception if a rename is going to duplicate and existing
|
2
|
+
header attribute.
|
3
|
+
|
4
|
+
* Raise an exception if a rename has aliases with duplicate names.
|
5
|
+
|
6
|
+
* Rename usage of "range" for attributes to "domain"
|
7
|
+
* Functions will have both a range and domain, but attributes
|
8
|
+
only have a domain.
|
9
|
+
|
1
10
|
* Add Extension and Summarization Functions
|
2
|
-
* Overview:
|
11
|
+
* Overview: https://gist.github.com/584588
|
3
12
|
|
4
13
|
* Remove Order, Reverse, Limit and Offset from the Relation inheritance chain
|
5
14
|
* Instead make it so they are proxy classes that wrap Relations, but
|
@@ -22,7 +31,12 @@
|
|
22
31
|
if any.
|
23
32
|
|
24
33
|
* Add further optimizations:
|
34
|
+
* Projection
|
35
|
+
* When it contains a Rename, if the renamed attributes are projected
|
36
|
+
away, then the rename can be removed.
|
25
37
|
* Operation Order:
|
38
|
+
* Projection containing an Order
|
39
|
+
* Should remove the Order, since it is a noop
|
26
40
|
* Projection should follow Rename
|
27
41
|
* When a Projection contains a Restriction, wrap the Projection
|
28
42
|
in the Restriction, projecting away any attributes not used in
|
@@ -86,6 +100,11 @@
|
|
86
100
|
with the remaining relation.
|
87
101
|
* Make sure the smallest relation (with a known size) is always the
|
88
102
|
right-most operation.
|
103
|
+
* When a restriction uses a unique index:
|
104
|
+
* Order can be factored out
|
105
|
+
* Limit with a limit >= 1 can be factored out
|
106
|
+
* Offset with an offset > 0 can be transformed into an empty
|
107
|
+
relation, since at most there can be only one match.
|
89
108
|
|
90
109
|
* Allow Inclusion match to accept a Relation
|
91
110
|
* Ensure that Inclusion can have the left/right be an Array of
|
data/config/flay.yml
CHANGED
data/config/roodi.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
AbcMetricMethodCheck: { score: 11 }
|
3
3
|
AssignmentInConditionalCheck: { }
|
4
4
|
CaseMissingElseCheck: { }
|
5
|
-
ClassLineCountCheck: { line_count:
|
5
|
+
ClassLineCountCheck: { line_count: 390 }
|
6
6
|
ClassNameCheck: { pattern: !ruby/regexp /\A[A-Z][a-z](?:[A-Z]?[a-z])+\z/ }
|
7
7
|
ClassVariableCheck: { }
|
8
8
|
CyclomaticComplexityBlockCheck: { complexity: 2 }
|
@@ -12,7 +12,7 @@ ForLoopCheck: { }
|
|
12
12
|
# TODO: decrease line_count to 5 to 10
|
13
13
|
MethodLineCountCheck: { line_count: 14 }
|
14
14
|
MethodNameCheck: { pattern: !ruby/regexp /\A(?:[a-z](?:_?[a-z])+[?!=]?|\[\]=?|==|<=>|[+*&|-])\z/ }
|
15
|
-
ModuleLineCountCheck: { line_count:
|
15
|
+
ModuleLineCountCheck: { line_count: 392 }
|
16
16
|
ModuleNameCheck: { pattern: !ruby/regexp /\A[A-Z][a-z](?:[A-Z]?[a-z])+\z/ }
|
17
17
|
# TODO: decrease parameter_count to 2 or less
|
18
18
|
ParameterNumberCheck: { parameter_count: 3 }
|
@@ -89,6 +89,33 @@ module Veritas
|
|
89
89
|
self
|
90
90
|
end
|
91
91
|
|
92
|
+
# Compare the Extension with other relation for equality
|
93
|
+
#
|
94
|
+
# @example
|
95
|
+
# extension.eql?(other) # => true or false
|
96
|
+
#
|
97
|
+
# @param [Relation] other
|
98
|
+
# the other relation to compare with
|
99
|
+
#
|
100
|
+
# @return [Boolean]
|
101
|
+
#
|
102
|
+
# @api public
|
103
|
+
def eql?(other)
|
104
|
+
super && extensions.eql?(other.extensions)
|
105
|
+
end
|
106
|
+
|
107
|
+
# Return the hash of the projection
|
108
|
+
#
|
109
|
+
# @example
|
110
|
+
# hash = extension.hash
|
111
|
+
#
|
112
|
+
# @return [Fixnum]
|
113
|
+
#
|
114
|
+
# @api public
|
115
|
+
def hash
|
116
|
+
super ^ extensions.hash
|
117
|
+
end
|
118
|
+
|
92
119
|
module Methods
|
93
120
|
|
94
121
|
# Return an extended relation
|
@@ -116,6 +143,8 @@ module Veritas
|
|
116
143
|
|
117
144
|
Relation.class_eval { include Methods }
|
118
145
|
|
146
|
+
memoize :hash
|
147
|
+
|
119
148
|
end # class Extension
|
120
149
|
end # module Algebra
|
121
150
|
end # module Veritas
|
data/lib/veritas/algebra/join.rb
CHANGED
@@ -3,7 +3,7 @@ module Veritas
|
|
3
3
|
|
4
4
|
# The join between relations
|
5
5
|
class Join < Relation
|
6
|
-
include Relation::Operation::
|
6
|
+
include Relation::Operation::Combination
|
7
7
|
|
8
8
|
# Instantiate a new Join
|
9
9
|
#
|
@@ -34,7 +34,7 @@ module Veritas
|
|
34
34
|
# @api private
|
35
35
|
def self.assert_joinable_headers(left, right)
|
36
36
|
if (left.header & right.header).empty?
|
37
|
-
raise InvalidHeaderError,
|
37
|
+
raise InvalidHeaderError, 'the headers must have common attributes'
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -75,7 +75,7 @@ module Veritas
|
|
75
75
|
left.each do |tuple|
|
76
76
|
right_tuples = index[join_tuple(tuple)]
|
77
77
|
if right_tuples
|
78
|
-
Relation::Operation::
|
78
|
+
Relation::Operation::Combination.combine_tuples(header, tuple, right_tuples, &block)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -3,7 +3,7 @@ module Veritas
|
|
3
3
|
|
4
4
|
# The cartesian product between relations
|
5
5
|
class Product < Relation
|
6
|
-
include Relation::Operation::
|
6
|
+
include Relation::Operation::Combination
|
7
7
|
|
8
8
|
# Instantiate a new Product
|
9
9
|
#
|
@@ -34,7 +34,7 @@ module Veritas
|
|
34
34
|
# @api private
|
35
35
|
def self.assert_disjointed_headers(left, right)
|
36
36
|
if (left.header & right.header).any?
|
37
|
-
raise InvalidHeaderError,
|
37
|
+
raise InvalidHeaderError, 'the headers must be disjointed'
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -56,7 +56,7 @@ module Veritas
|
|
56
56
|
# @api public
|
57
57
|
def each(&block)
|
58
58
|
left.each do |tuple|
|
59
|
-
Relation::Operation::
|
59
|
+
Relation::Operation::Combination.combine_tuples(header, tuple, right, &block)
|
60
60
|
end
|
61
61
|
self
|
62
62
|
end
|
@@ -18,7 +18,7 @@ module Veritas
|
|
18
18
|
def initialize(operand, attributes)
|
19
19
|
super(operand)
|
20
20
|
@header = @header.project(attributes.to_ary)
|
21
|
-
@directions =
|
21
|
+
@directions = Relation::Operation::Order::DirectionSet::EMPTY
|
22
22
|
end
|
23
23
|
|
24
24
|
# Iterate over each tuple in the set
|
@@ -44,6 +44,33 @@ module Veritas
|
|
44
44
|
self
|
45
45
|
end
|
46
46
|
|
47
|
+
# Compare the Projection with other relation for equality
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# projection.eql?(other) # => true or false
|
51
|
+
#
|
52
|
+
# @param [Relation] other
|
53
|
+
# the other relation to compare with
|
54
|
+
#
|
55
|
+
# @return [Boolean]
|
56
|
+
#
|
57
|
+
# @api public
|
58
|
+
def eql?(other)
|
59
|
+
super && header.eql?(other.header)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Return the hash of the projection
|
63
|
+
#
|
64
|
+
# @example
|
65
|
+
# hash = projection.hash
|
66
|
+
#
|
67
|
+
# @return [Fixnum]
|
68
|
+
#
|
69
|
+
# @api public
|
70
|
+
def hash
|
71
|
+
super ^ header.hash
|
72
|
+
end
|
73
|
+
|
47
74
|
module Methods
|
48
75
|
|
49
76
|
# Return a relation with only the attributes specified
|
@@ -90,7 +117,7 @@ module Veritas
|
|
90
117
|
header.project(attributes)
|
91
118
|
end
|
92
119
|
|
93
|
-
# Return a relation with only the
|
120
|
+
# Return a relation with only the attributes specified
|
94
121
|
#
|
95
122
|
# @param [Relation] operand
|
96
123
|
# the relation to project
|
@@ -108,6 +135,8 @@ module Veritas
|
|
108
135
|
|
109
136
|
Relation.class_eval { include Methods }
|
110
137
|
|
138
|
+
memoize :hash
|
139
|
+
|
111
140
|
end # class Projection
|
112
141
|
end # module Algebra
|
113
142
|
end # module Veritas
|
@@ -109,7 +109,6 @@ module Veritas
|
|
109
109
|
#
|
110
110
|
# @api public
|
111
111
|
def ==(other)
|
112
|
-
(kind_of?(other.class) || other.kind_of?(self.class)) &&
|
113
112
|
to_hash == other.to_hash
|
114
113
|
end
|
115
114
|
|
@@ -132,13 +131,13 @@ module Veritas
|
|
132
131
|
# Return the hash of the aliases
|
133
132
|
#
|
134
133
|
# @example
|
135
|
-
#
|
134
|
+
# hash = aliases.hash
|
136
135
|
#
|
137
|
-
# @return [
|
136
|
+
# @return [Fixnum]
|
138
137
|
#
|
139
138
|
# @api public
|
140
139
|
def hash
|
141
|
-
@aliases.hash
|
140
|
+
self.class.hash ^ @aliases.hash
|
142
141
|
end
|
143
142
|
|
144
143
|
# Convert the aliases to a Hash
|
@@ -63,6 +63,18 @@ module Veritas
|
|
63
63
|
super && aliases.eql?(other.aliases)
|
64
64
|
end
|
65
65
|
|
66
|
+
# Return the hash of the rename
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# hash = rename.hash
|
70
|
+
#
|
71
|
+
# @return [Fixnum]
|
72
|
+
#
|
73
|
+
# @api public
|
74
|
+
def hash
|
75
|
+
super ^ aliases.hash
|
76
|
+
end
|
77
|
+
|
66
78
|
module Methods
|
67
79
|
|
68
80
|
# Return a relation with the header renamed
|
@@ -84,6 +96,8 @@ module Veritas
|
|
84
96
|
|
85
97
|
Relation.class_eval { include Methods }
|
86
98
|
|
99
|
+
memoize :hash
|
100
|
+
|
87
101
|
end # class Rename
|
88
102
|
end # module Algebra
|
89
103
|
end # module Veritas
|
@@ -61,6 +61,18 @@ module Veritas
|
|
61
61
|
super && predicate.eql?(other.predicate)
|
62
62
|
end
|
63
63
|
|
64
|
+
# Return the hash of the restriction
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# hash = restriction.hash
|
68
|
+
#
|
69
|
+
# @return [Fixnum]
|
70
|
+
#
|
71
|
+
# @api public
|
72
|
+
def hash
|
73
|
+
super ^ predicate.hash
|
74
|
+
end
|
75
|
+
|
64
76
|
module Methods
|
65
77
|
|
66
78
|
# Return a relation with restricted tuples
|
@@ -91,6 +103,8 @@ module Veritas
|
|
91
103
|
|
92
104
|
Relation.class_eval { include Methods }
|
93
105
|
|
106
|
+
memoize :hash
|
107
|
+
|
94
108
|
end # class Restriction
|
95
109
|
end # module Algebra
|
96
110
|
end # module Veritas
|
@@ -64,6 +64,35 @@ module Veritas
|
|
64
64
|
self
|
65
65
|
end
|
66
66
|
|
67
|
+
# Compare the Summarization with other relation for equality
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# summarization.eql?(other) # => true or false
|
71
|
+
#
|
72
|
+
# @param [Relation] other
|
73
|
+
# the other relation to compare with
|
74
|
+
#
|
75
|
+
# @return [Boolean]
|
76
|
+
#
|
77
|
+
# @api public
|
78
|
+
def eql?(other)
|
79
|
+
super &&
|
80
|
+
summarize_by.eql?(other.summarize_by) &&
|
81
|
+
summarizers.eql?(other.summarizers)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Return the hash of the summarization
|
85
|
+
#
|
86
|
+
# @example
|
87
|
+
# hash = summarization.hash
|
88
|
+
#
|
89
|
+
# @return [Fixnum]
|
90
|
+
#
|
91
|
+
# @api public
|
92
|
+
def hash
|
93
|
+
super ^ summarize_by.hash ^ summarizers.hash
|
94
|
+
end
|
95
|
+
|
67
96
|
private
|
68
97
|
|
69
98
|
# Return the summaries for each tuple, grouped by the summarize_by header
|
@@ -161,6 +190,8 @@ module Veritas
|
|
161
190
|
|
162
191
|
Relation.class_eval { include Methods }
|
163
192
|
|
193
|
+
memoize :hash
|
194
|
+
|
164
195
|
end # class Summarization
|
165
196
|
end # module Algebra
|
166
197
|
end # module Veritas
|
@@ -63,7 +63,7 @@ module Veritas
|
|
63
63
|
#
|
64
64
|
# @api public
|
65
65
|
def valid_value?(value)
|
66
|
-
valid_or_optional?(value) { super && size.
|
66
|
+
valid_or_optional?(value) { super && size.cover?(value) }
|
67
67
|
end
|
68
68
|
|
69
69
|
# Test if the attribute can be joined with the other attribute
|
@@ -65,7 +65,7 @@ module Veritas
|
|
65
65
|
#
|
66
66
|
# @api public
|
67
67
|
def valid_value?(value)
|
68
|
-
valid_or_optional?(value) { super && length.
|
68
|
+
valid_or_optional?(value) { super && length.cover?(value.length) }
|
69
69
|
end
|
70
70
|
|
71
71
|
# Test if the attribute can be joined with the other attribute
|
data/lib/veritas/attribute.rb
CHANGED
@@ -19,7 +19,7 @@ module Veritas
|
|
19
19
|
|
20
20
|
# Abstract base class representing a type of data in a relation tuple
|
21
21
|
class Attribute
|
22
|
-
include AbstractClass, Immutable, ::Comparable
|
22
|
+
include AbstractClass, Immutable, ::Comparable, Visitable
|
23
23
|
|
24
24
|
# The attribute name
|
25
25
|
#
|
@@ -177,13 +177,13 @@ module Veritas
|
|
177
177
|
# Return the hash of the attribute
|
178
178
|
#
|
179
179
|
# @example
|
180
|
-
#
|
180
|
+
# hash = attribute.hash
|
181
181
|
#
|
182
|
-
# @return [
|
182
|
+
# @return [Fixnum]
|
183
183
|
#
|
184
184
|
# @api public
|
185
185
|
def hash
|
186
|
-
name.hash ^ options.hash
|
186
|
+
self.class.hash ^ name.hash ^ options.hash
|
187
187
|
end
|
188
188
|
|
189
189
|
# Return a string representing the attribute
|
@@ -4,7 +4,7 @@ module Veritas
|
|
4
4
|
# Abstract base class for logical expressions
|
5
5
|
class Expression
|
6
6
|
extend Aliasable
|
7
|
-
include AbstractClass, Optimizable, Immutable
|
7
|
+
include AbstractClass, Optimizable, Immutable, Visitable
|
8
8
|
|
9
9
|
# Evaluate the expression using the operands
|
10
10
|
#
|
@@ -73,9 +73,9 @@ module Veritas
|
|
73
73
|
# Return the hash of the expression
|
74
74
|
#
|
75
75
|
# @example
|
76
|
-
#
|
76
|
+
# hash = expression.hash
|
77
77
|
#
|
78
|
-
# @return [
|
78
|
+
# @return [Fixnum]
|
79
79
|
#
|
80
80
|
# @api public
|
81
81
|
def hash
|
@@ -5,6 +5,17 @@ module Veritas
|
|
5
5
|
# A mixin for predicates matching an enumerable
|
6
6
|
module Enumerable
|
7
7
|
|
8
|
+
# Return the method to test the enumerable with
|
9
|
+
#
|
10
|
+
# @param [#cover?, #include?] enumerable
|
11
|
+
#
|
12
|
+
# @return [Symbol]
|
13
|
+
#
|
14
|
+
# @api private
|
15
|
+
def self.compare_method(enumerable)
|
16
|
+
enumerable.respond_to?(:cover?) ? :cover? : :include?
|
17
|
+
end
|
18
|
+
|
8
19
|
# Initialize an Enumerable predicate
|
9
20
|
#
|
10
21
|
# @param [Object] left
|