Class: Neo4j::Cypher::MatchStart::NodeMatchContext

Inherits:
Object
  • Object
show all
Includes:
Alias, Context, JoinableMatchContext, MatchContext, Returnable, Variable
Defined in:
lib/neo4j-cypher/match.rb

Constant Summary collapse

DIR_OPERATORS =
{:outgoing => "-->", :incoming => "<--", :both => '--'}

Instance Attribute Summary

Attributes included from Context

#clause

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JoinableMatchContext

#-, #<, #<<, #<=>, #>, #>>, #next_new_node, #next_new_rel

Methods included from MatchContext

#clause, #convert_create_clauses, #join_previous!, #join_previous?, #length, #nodes, #not, #rels, #to_cypher

Methods included from Context

#clause_list

Constructor Details

#initialize(match_start, from, to, dir) ⇒ NodeMatchContext

Returns a new instance of NodeMatchContext.



288
289
290
291
292
293
294
295
# File 'lib/neo4j-cypher/match.rb', line 288

def initialize(match_start, from, to, dir)
  super(match_start)
  @from = from
  @to = to
  convert_create_clauses(from)
  convert_create_clauses(to)
  @dir = dir
end

Class Method Details

.new_first(match_start, from, to, dir) ⇒ Object



298
299
300
301
302
# File 'lib/neo4j-cypher/match.rb', line 298

def self.new_first(match_start, from, to, dir)
  from_var = NodeVar.as_var(match_start.clause_list, from)
  to_var = NodeVar.as_var(match_start.clause_list, to)
  NodeMatchContext.new(match_start, from_var, to_var, dir)
end

Instance Method Details

#to_cypher_joinObject



309
310
311
# File 'lib/neo4j-cypher/match.rb', line 309

def to_cypher_join
  "#{DIR_OPERATORS[@dir]}(#{@to.match_value})"
end

#to_cypher_no_joinObject



304
305
306
307
# File 'lib/neo4j-cypher/match.rb', line 304

def to_cypher_no_join
  x = @to.match_value
  "(#{@from.match_value})#{DIR_OPERATORS[@dir]}(#{x})"
end