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.

Multiple Paths Interaction

Hi all,

I am facing an issue while writing the cypher query for below graph, here I have such paths for different months and many more such paths are there like 01-08-2021, 01-09-2021, 01-10-2021, 01-11-2021 and so on:

I want to write a cypher query that will help me in assigning a property value from 01-08-2021 path node to the next path node which is 01-09-2021.

I tried this if it helps me identify the next path basis the previous path, then I will set the property etc. but this doesn;t work

match p=(v:Production)-[j:transport]->(x:Storage)-[q:transport]->(c:Storage)-[b:transport]->(d:Storage)

with  min(v.date) as dt

match p=(v:Production)-[j:transport]->(x:Storage)-[q:transport]->(c:Storage)-[b:transport]->(d:Storage)

where v.date=dt

optional match  s=(m:Production)-[n:transport]->(u:Storage)-[o:transport]->(x:Storage)-[z:transport]->(f:Storage)

where m.date=dt+duration('P1M')

return s;

Thanks,
Pragya

1 ACCEPTED SOLUTION

Check the result for 'dt'
match p1=(v1:Production)-[j:transport]->(x:Storage)-[q:transport]->(c:Storage)-[b:transport]->(d:Storage)
 with min(v1.date) as dt
return dt
Post the result .

View solution in original post

2 REPLIES 2

I tried this,

 match p1=(v1:Production)-[j:transport]->(x:Storage)-[q:transport]->(c:Storage)-[b:transport]->(d:Storage)
 with min(v1.date) as dt
 match p2=(v2:Production)-[j:transport]->(x:Storage)-[q:transport]->(c:Storage)-[b:transport]->(d:Storage)
 where v2.date=dt+duration('P1M') 
 set v2.Opening_Inv_Physical=v1.Opening_Inv_Physical
 return p2;

Check the result for 'dt'
match p1=(v1:Production)-[j:transport]->(x:Storage)-[q:transport]->(c:Storage)-[b:transport]->(d:Storage)
 with min(v1.date) as dt
return dt
Post the result .