class Axiom::Adapter::Arango::Visitor::Aggregate

Base class for aggregate visitors

Constants

LOCAL_NAME

Public Instance Methods

root() click to toggle source

Return root AQL node

@return [AQL::Node]

@api private

# File lib/axiom/adapter/arango/visitor/aggregate.rb, line 16
def root
  Node::Call.new(self.class::FUNCTION, [mapped])
end

Private Instance Methods

map_attribute() click to toggle source

Return attribute used for mapping

@return [AQL::Node::Attribute]

@api private

# File lib/axiom/adapter/arango/visitor/aggregate.rb, line 50
def map_attribute
  Node::Attribute.new(LOCAL_NAME, summarization_attribute)
end
map_attribute_name() click to toggle source

Return attribute name used for mapping

@return [AQL::Node::Name]

@api private

# File lib/axiom/adapter/arango/visitor/aggregate.rb, line 29
def map_attribute_name
  Node::Name.new(input.operand.name.to_s)
end
map_body() click to toggle source

Return map body

@return [AQL::Node::Block]

@api private

# File lib/axiom/adapter/arango/visitor/aggregate.rb, line 97
def map_body
  Node::Block.new([
    map_filter,
    map_return
  ])
end
map_filter() click to toggle source

Return map filter operation

@return [AQL::Node::Operation::Unary::Filter]

@api private

# File lib/axiom/adapter/arango/visitor/aggregate.rb, line 75
def map_filter
  Node::Operation::Unary::Filter.new(
    Node::Operator::Binary::Inequality.new(map_attribute, Node::Literal::Singleton::NULL)
  )
end
map_return() click to toggle source

Return map return operation

@return [AQL::Node::Operation::Unary::Return]

@api private

# File lib/axiom/adapter/arango/visitor/aggregate.rb, line 87
def map_return
  Node::Operation::Unary::Return.new(map_attribute)
end
mapped() click to toggle source

Return mapped collection

@return [AQL::Node::Operation::For]

@api private

# File lib/axiom/adapter/arango/visitor/aggregate.rb, line 61
def mapped
  Node::Operation::For.new(
    LOCAL_NAME,
    For::Summarization::COLLECT_NAME,
    map_body
  )
end
summarization_attribute() click to toggle source

Return summarization attribute

@return [AQL::Node::Attribute]

@api private

# File lib/axiom/adapter/arango/visitor/aggregate.rb, line 40
def summarization_attribute
  Node::Attribute.new(For::Summarization::LOCAL_NAME, map_attribute_name)
end