QueryFactory

This class builds and executes a Cypher query, using information from the graph objects to determine
whether they need to be created simultaneously. It keeps the rel instance from being responsible for inspecting the nodes or talking with Shared::QueryFactory.

Constants

  • NODE_SYMBOLS

Methods

#build!

TODO: This feels like it should also wrap the rel, but that is handled in Neo4j::ActiveRel::Persistence at the moment. Builds and executes the query using the objects giving during init. It holds the process:

  • Execute node callbacks if needed
  • Create and execute the query
  • Mix the query response into the unpersisted objects given during init
def build!
  node_before_callbacks! do
    res = query_factory(rel, rel_id, iterative_query).query.unwrapped.return(*unpersisted_return_ids).first
    node_symbols.each { |n| wrap!(send(n), res, n) }
    @unwrapped_rel = res.send(rel_id)
  end
end
#from_node

Returns the value of attribute from_node

def from_node
  @from_node
end

#initialize

def initialize(from_node, to_node, rel)
  @from_node = from_node
  @to_node = to_node
  @rel = rel
end
#rel

Returns the value of attribute rel

def rel
  @rel
end
#to_node

Returns the value of attribute to_node

def to_node
  @to_node
end
#unwrapped_rel

Returns the value of attribute unwrapped_rel

def unwrapped_rel
  @unwrapped_rel
end