cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

How to properly update depreciated query?

marcelix161
Node Clone

I have a query that does what I want.
Yet, it runs with warnings, but when I'm trying to adjust it to the new syntax, it doesn't work (the result is different).

Why? What am I doing wrong?

Depreciated query

match (g:Id {start_marker: 1})-[MINST*]->(leaf)
where not (leaf)-[:MINST]->()
return leaf

Result

Suggested Fix:

Binding a variable length relationship pattern to a variable ('rel') 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 rel

Fixed query

match p = (g:Id {start_marker: 1})-[MINST]->(leaf)
with *, relationships(p) as MINST
where not (leaf)-[:MINST]->()
return leaf

1 ACCEPTED SOLUTION

anthapu
Graph Fellow

First, I feel you are missing a ":" in the relationship part in the path. Because of that it is going to give all relationships.

Also for other aspect you might have to add EXISTS

Can you try this?

match p = (g:Id {start_marker: 1})-[:MINST*]->(leaf)
where not EXISTS ((leaf)-[:MINST]->())
return leaf

View solution in original post

1 REPLY 1

anthapu
Graph Fellow

First, I feel you are missing a ":" in the relationship part in the path. Because of that it is going to give all relationships.

Also for other aspect you might have to add EXISTS

Can you try this?

match p = (g:Id {start_marker: 1})-[:MINST*]->(leaf)
where not EXISTS ((leaf)-[:MINST]->())
return leaf