Class: Neo4j::Cypher::MatchStart::RelRightMatchContext

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

Constant Summary collapse

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

Instance Attribute Summary

Attributes included from Context

#clause

Instance Method Summary collapse

Methods included from Algorithms

#shortest_path, #shortest_paths

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, rel_var, to, dir) ⇒ RelRightMatchContext

Returns a new instance of RelRightMatchContext.



255
256
257
258
259
260
261
262
263
264
265
# File 'lib/neo4j-cypher/match.rb', line 255

def initialize(match_start, from, rel_var, to, dir)
  super(match_start)
  @from = from
  convert_create_clauses(from)
  convert_create_clauses(to)
  join_previous! if @from.kind_of?(MatchContext) && @from.join_previous?
  @rel_var = rel_var
  @dir = dir
  convert_create_clauses(to)
  @to = NodeVar.as_var(match_start.clause_list, to)
end

Instance Method Details

#to_cypher_joinObject



271
272
273
# File 'lib/neo4j-cypher/match.rb', line 271

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

#to_cypher_no_joinObject



267
268
269
# File 'lib/neo4j-cypher/match.rb', line 267

def to_cypher_no_join
  "(#{@from.match_value})#{FIRST_DIR_OP[@dir]}[#{@rel_var.match_value}]#{SECOND_DIR_OP[@dir]}(#{@to.match_value})"
end