Module: Neo4j::Core::Cypher::Matchable

Included in:
NodeVar, Start
Defined in:
lib/neo4j-core/cypher/cypher.rb

Instance Method Summary collapse

Instance Method Details

#-(other) ⇒ MatchRelLeft, MatchNode

This operator means any direction related to

Parameters:

  • other (Symbol, #var_name, String)

    the relationship

Returns:



190
191
192
# File 'lib/neo4j-core/cypher/cypher.rb', line 190

def -(other)
  MatchRelLeft.new(self, other, expressions, :both)
end

#<(other) ⇒ MatchRelLeft, MatchNode

This operator means incoming related to

Parameters:

  • other (Symbol, #var_name, String)

    the relationship

Returns:



197
198
199
# File 'lib/neo4j-core/cypher/cypher.rb', line 197

def <(other)
  MatchRelLeft.new(self, other, expressions, :incoming)
end

#<<(other) ⇒ MatchRelLeft, MatchNode

Incoming relationship to other node

Parameters:

  • other (Symbol, #var_name)

    either a node (Symbol, #var_name)

Returns:



229
230
231
# File 'lib/neo4j-core/cypher/cypher.rb', line 229

def <<(other)
  MatchNode.new(self, other, expressions, :incoming)
end

#<=>(other) ⇒ MatchRelLeft, MatchNode

This operator means related to, without regard to type or direction.

Parameters:

  • other (Symbol, #var_name)

    either a node (Symbol, #var_name)

Returns:



176
177
178
# File 'lib/neo4j-core/cypher/cypher.rb', line 176

def <=>(other)
  MatchNode.new(self, other, expressions, :both)
end

#>(other) ⇒ MatchRelLeft, MatchNode

This operator means outgoing related to

Parameters:

  • other (Symbol, #var_name, String)

    the relationship

Returns:



183
184
185
# File 'lib/neo4j-core/cypher/cypher.rb', line 183

def >(other)
  MatchRelLeft.new(self, other, expressions, :outgoing)
end

#>>(other) ⇒ MatchRelLeft, MatchNode

Outgoing relationship to other node

Parameters:

  • other (Symbol, #var_name)

    either a node (Symbol, #var_name)

Returns:



204
205
206
# File 'lib/neo4j-core/cypher/cypher.rb', line 204

def >>(other)
  MatchNode.new(self, other, expressions, :outgoing)
end

#both(rel_type) ⇒ Object



220
221
222
223
224
# File 'lib/neo4j-core/cypher/cypher.rb', line 220

def both(rel_type)
  node = NodeVar.new(@expressions, @variables)
  MatchRelLeft.new(self, ":`#{rel_type}`", expressions, :both) < node
  node
end

#incoming(rel_type) ⇒ Object



214
215
216
217
218
# File 'lib/neo4j-core/cypher/cypher.rb', line 214

def incoming(rel_type)
  node = NodeVar.new(@expressions, @variables)
  MatchRelLeft.new(self, ":`#{rel_type}`", expressions, :incoming) < node
  node
end

#outgoing(rel_type) ⇒ Object



208
209
210
211
212
# File 'lib/neo4j-core/cypher/cypher.rb', line 208

def outgoing(rel_type)
  node = NodeVar.new(@expressions, @variables)
  MatchRelLeft.new(self, ":`#{rel_type}`", expressions, :outgoing) > node
  node
end

#where(&block) ⇒ Object



158
159
160
161
162
163
# File 'lib/neo4j-core/cypher/cypher.rb', line 158

def where(&block)
  x = block.call(self)
  expressions.delete(x)
  ExprOp.new(x, nil, "").binary!
  self
end

#where_not(&block) ⇒ Object



165
166
167
168
169
170
# File 'lib/neo4j-core/cypher/cypher.rb', line 165

def where_not(&block)
  x = block.call(self)
  expressions.delete(x)
  ExprOp.new(x, nil, "not").binary!
  self
end