Module: Neo4j::Cypher::MatchStart::MatchContext

Included in:
NodeMatchContext, RelLeftMatchContext, RelRightMatchContext
Defined in:
lib/neo4j-cypher/match.rb

Instance Method Summary collapse

Instance Method Details

#clauseObject



85
86
87
# File 'lib/neo4j-cypher/match.rb', line 85

def clause
  @match_start
end

#convert_create_clauses(to_or_from) ⇒ Object



76
77
78
79
80
81
82
83
# File 'lib/neo4j-cypher/match.rb', line 76

def convert_create_clauses(to_or_from)
  # perform a create operation in a match clause ?
  c = to_or_from.respond_to?(:clause) ? to_or_from.clause : to_or_from
  if c.respond_to?(:clause_type) && c.clause_type == :create
    clause_list.delete(c)
    c.as_create_path!
  end
end

#initialize(match_start) ⇒ Object



70
71
72
73
74
# File 'lib/neo4j-cypher/match.rb', line 70

def initialize(match_start)
  super(match_start)
  @match_start = match_start
  @match_start.match_list << self
end

#join_previous!Object



89
90
91
92
# File 'lib/neo4j-cypher/match.rb', line 89

def join_previous!
  @join_previous = true
  self
end

#join_previous?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/neo4j-cypher/match.rb', line 94

def join_previous?
  @join_previous
end

#lengthObject

returns the length of the path



123
124
125
126
# File 'lib/neo4j-cypher/match.rb', line 123

def length
  clause.referenced!
  Property.new(clause, 'length').to_function!
end

#nodesObject

Generates a x in nodes(m3) cypher expression.

Examples:

p.nodes.all? { |x| x[:age] > 30 }


110
111
112
# File 'lib/neo4j-cypher/match.rb', line 110

def nodes
  Entities.new(clause.clause_list, "nodes", self).eval_context
end

#notObject



128
129
130
# File 'lib/neo4j-cypher/match.rb', line 128

def not
  clause.not
end

#relsObject

Generates a x in relationships(m3) cypher expression.

Examples:

p.relationships.all? { |x| x[:age] > 30 }


118
119
120
# File 'lib/neo4j-cypher/match.rb', line 118

def rels
  Entities.new(clause.clause_list, "relationships", self).eval_context
end

#to_cypherObject



98
99
100
101
102
103
104
# File 'lib/neo4j-cypher/match.rb', line 98

def to_cypher
  if join_previous?
    to_cypher_join
  else
    to_cypher_no_join
  end
end