cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Receiving a warning "This feature is deprecated..." when using `()-[]->()`

bmalbusca
Node Clone

I'm didn't find a good and, at the same time, clean way to search complete paths that constains a specific node. The solution that I reach is giving me the following warning:

  • This feature is deprecated and will be removed in future versions.
    Binding relationships to a list in a variable length pattern is deprecated. (Binding a variable length relationship pattern to a variable ('r1') is deprecated and will be unsupported in a future version. The recommended way is to bind the whole path to a variable, then extract the relationships: MATCH p = (...)-[...]-(...) WITH *, relationships(p) AS r1)
EXPLAIN MATCH p=(n1:WaterNode)-[r1:CONNECTED*]->(n:WaterNode{name:"Pisão", type:"Barragem"})-[r2:CONNECTED*]->(n2:WaterNode)
                              ^
1 ACCEPTED SOLUTION

Hi @bmalbusca

Variables are only used for Where comparisons and returns.
If you don't use them, you don't need variables.

  • gives all the link between 2 nodes

Yes
If the depth of the graph is predictable, it is best to write down the limit.

-[r1:CONNECTED*..30]->

View solution in original post

3 REPLIES 3

Hi @bmalbusca

What variable do you want to return? All?
If all you want in the return value is p, then you don't need any other variables.

EXPLAIN MATCH p=(:WaterNode)-[:CONNECTED*]->(:WaterNode{name:"Pisão", type:"Barragem"})-[:CONNECTED*]->(:WaterNode)

Hello @koji , I'm trying to collect all paths p which uses the relation CONNECTED and contains a specific node WaterNode{name:"Pisão", type:"Barragem

// Find all full paths that contains a specific water node
// Ex. name:"Pisão", type:"Barragem"
MATCH p=(n1:WaterNode)-[r1:CONNECTED*]->(n:WaterNode{name:"Pisão", type:"Barragem"})-[r2:CONNECTED*]->(n2:WaterNode)
RETURN collect(p)

I'm not sure about what i'm doing wrong when you say then you don't need any other variables..

I'm new with this, but * gives all the link between 2 nodes, rigth? With (n1:WaterNode)-[r1:CONNECTED*]->(n:WaterNode{name:"Pisão", type:"Barragem"}) I'm getting all paths from back of the node and with (n:WaterNode{name:"Pisão", type:"Barragem"})-[r2:CONNECTED*]->(n2:WaterNode) I'm getting all paths upfront.
Thank you

Hi @bmalbusca

Variables are only used for Where comparisons and returns.
If you don't use them, you don't need variables.

  • gives all the link between 2 nodes

Yes
If the depth of the graph is predictable, it is best to write down the limit.

-[r1:CONNECTED*..30]->