neo4j - Cypher: what parts of a pattern can be bound to a variable? -


I can get all users nodes in this way:

  MATCH (N: User) Returns N  

In this case, the n is linked to the node. But suppose I want to write a cipher query with the code name with the label code of every code node user and the key name , and it's Return the username as I write:

  MATCH (n: user {name: username}) returns user name  

but it does not seem possible: the cipher does not parser Is the identifier usernames accepted at that place of the pattern? Is there another way to do this? Which positions of a pattern are possible to keep an identifier? Just nodes and relationships?

(Yes, I know that I can bind to the node, check that there is no name property, and if so, remove that value. Pattern is more elegant to match.)

To answer the question in the headline: < / P>

  MATCH P = (N) - [ 

Specifically, paths, nodes, and relationships MATCH R] - (M) < / Code>

After the match section, the combination of with section In the field, any identifier can be compelled to:

  MATCH P = (N) - [R] - (M) with n.name as the identifier  

or

  MATCH P = (n) - [r] - (m) with (ara) some_organist  

or

Pre>

etc.

Use with if you want to pair anything with a path, node, or an identifier Your specific example demonstrates a misunderstanding of the role of curly braces inside a MATCH clause, there are those who prefer to call me "shortcodes WHERE conditioning". Curly braces allow you to bet on the node and relationship properties, instead of conditioning instead of the "code" MATCH section later in the WHERE clause.

  MATCH (N: User {name: "Alice"}) Returns n  

and

  Matt (n) : User) Where n.name = "Alice" returns n  

are similar. This is a feature of priority / priority.

TL; DR - No, you can not bind property to an identifier username match section to do this with n Name Username .


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -