Class: Neo4j::Cypher::MatchStart

Inherits:
Object
  • Object
show all
Includes:
Clause
Defined in:
lib/neo4j-cypher/match.rb

Defined Under Namespace

Modules: Algorithms, JoinableMatchContext, MatchContext Classes: Entities, NodeMatchContext, RelLeftMatchContext, RelRightMatchContext

Constant Summary

Constants included from Clause

Clause::NAME, Clause::ORDER

Instance Attribute Summary collapse

Attributes included from Clause

#clause_list, #clause_type, #expr, #insert_order

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Clause

#<=>, #alias_name, #as_alias, #as_alias?, #clause_position, #create_clause_args_for, #match_value, #match_value=, #prefix, #referenced!, #referenced?, #return_value, #separator, #to_prop_string, #valid_clause?, #var_name, #var_name=

Constructor Details

#initialize(from) ⇒ MatchStart

Returns a new instance of MatchStart.



10
11
12
13
14
# File 'lib/neo4j-cypher/match.rb', line 10

def initialize(from)
  super(from.clause_list, :match)
  @from = from
  @match_list = []
end

Instance Attribute Details

#algorithmObject

Returns the value of attribute algorithm.



8
9
10
# File 'lib/neo4j-cypher/match.rb', line 8

def algorithm
  @algorithm
end

#match_listObject (readonly)

Returns the value of attribute match_list.



7
8
9
# File 'lib/neo4j-cypher/match.rb', line 7

def match_list
  @match_list
end

Class Method Details

.new_match_node(from, to, dir) ⇒ Object



54
55
56
# File 'lib/neo4j-cypher/match.rb', line 54

def self.new_match_node(from, to, dir)
  MatchStart.new(from).new_match_node(from, to, dir)
end

Instance Method Details

#eval_contextObject



37
38
39
# File 'lib/neo4j-cypher/match.rb', line 37

def eval_context
  @match_list.last
end

#new_match_node(from, to, dir) ⇒ Object



16
17
18
19
# File 'lib/neo4j-cypher/match.rb', line 16

def new_match_node(from, to, dir)
  NodeMatchContext.new_first(self, from, to, dir)
  self
end

#new_match_rel(rel) ⇒ Object



21
22
23
24
# File 'lib/neo4j-cypher/match.rb', line 21

def new_match_rel(rel)
  RelLeftMatchContext.new(self, @from).set_rel(rel)
  self
end

#new_match_rels(rels) ⇒ Object



26
27
28
29
# File 'lib/neo4j-cypher/match.rb', line 26

def new_match_rels(rels)
  RelLeftMatchContext.new(self, @from).set_rels(rels)
  self
end

#new_match_rels?(rels) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/neo4j-cypher/match.rb', line 31

def new_match_rels?(rels)
  RelLeftMatchContext.new(self, @from).set_rels?(rels)
  self
end

#notObject

negate this match



43
44
45
46
# File 'lib/neo4j-cypher/match.rb', line 43

def not
  clause_list.delete(self)
  Operator.new(clause_list, self, nil, "not").unary!
end

#to_cypherObject



48
49
50
51
52
# File 'lib/neo4j-cypher/match.rb', line 48

def to_cypher
  match_string = @match_list.map(&:to_cypher).join
  match_string = algorithm ? "#{algorithm}(#{match_string})" : match_string
  referenced? ? "#{var_name} = #{match_string}" : match_string
end