Method: Neo4j::Core::Query#union_cypher

Defined in:
lib/neo4j-core/query.rb

#union_cypher(other, options = {}) ⇒ String

Returns a CYPHER query specifying the union of the callee object’s query and the argument’s query

Examples:

# Generates cypher: MATCH (n:Person) UNION MATCH (o:Person) WHERE o.age = 10
q = Neo4j::Core::Query.new.match(o: :Person).where(o: {age: 10})
result = Neo4j::Core::Query.new.match(n: :Person).union_cypher(q)

Parameters:

  • other (Query)

    Second half of UNION

  • options (Hash) (defaults to: {})

    Specify true to use UNION ALL

Returns:

  • (String)

    Resulting UNION cypher query string



384
385
386
# File 'lib/neo4j-core/query.rb', line 384

def union_cypher(other, options = {})
  "#{to_cypher} UNION#{options[:all] ? ' ALL' : ''} #{other.to_cypher}"
end