Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-06-2020 05:30 AM
Hi, I am trying to add an overlap relationship to my nodes.
Each node has its own waferID, fromtime, totime,WORK.
And in each WORK, there are small nodes to record the detail time of the job.
I want to search for work nodes that overlap each other.
Then find which detail node has overlap relation.
EX:
WORK node A1 is overlap WORK node B1.
And I want to find those detail nodes in A1 that have overlap with B1.
This my data sample.
Work Node :
WAFERID | fromtime | totime | WORK |
---|---|---|---|
A1 | 10:00 | 10:05 | process A |
B1 | 10:02 | 10:06 | process B |
Detail Node :
WAFERID | fromtime | totime | WORK | STEP |
---|---|---|---|---|
A1 | 10:00 | 10:01 | process A | 1 |
A1 | 10:01 | 10:03 | process A | 2 |
A1 | 10:03 | 10:05 | process A | 3 |
B1 | 10:02 | 10:04 | process B | 1 |
B1 | 10:04 | 10:05 | process B | 2 |
B1 | 10:05 | 10:05 | process B | 3 |
I am thinking about that do I need to add an overlap relationship from WORK node to detail node?
Or maybe have some queries that I can find it without adding overlap relation to detail node?
Like using diff time?
Thanks!
Solved! Go to Solution.
03-06-2020 08:54 PM
Hi,
I used below dataset
name,from,to
A,10:00,10:05
B,10:00,10:08
C,10:05,10:08
D,11:00,11:05
Ingestion Query
load csv with headers from 'file:///Overlap.csv' as line Create (n:Wafer{name:line.name,from:localtime({hour:toInteger(split(line.from,':')[0]), minute:toInteger(split(line.from,':')[1])}),to:localtime({hour:toInteger(split(line.to,':')[0]), minute:toInteger(split(line.to,':')[1])})}) return n
Match Query
match(n:Wafer) match(m:Wafer) Where n.to>=m.from>=n.from and n.name<>m.name return distinct n.name,m.name
Output
|n.name|m.name|
|n.name|m.name|
|"A"|"B"|
|"A"|"C"|
|"B"|"A"|
|"B"|"C"|
Only problem I see that I am getting duplicate records too for an example AB and BA
03-06-2020 08:54 PM
Hi,
I used below dataset
name,from,to
A,10:00,10:05
B,10:00,10:08
C,10:05,10:08
D,11:00,11:05
Ingestion Query
load csv with headers from 'file:///Overlap.csv' as line Create (n:Wafer{name:line.name,from:localtime({hour:toInteger(split(line.from,':')[0]), minute:toInteger(split(line.from,':')[1])}),to:localtime({hour:toInteger(split(line.to,':')[0]), minute:toInteger(split(line.to,':')[1])})}) return n
Match Query
match(n:Wafer) match(m:Wafer) Where n.to>=m.from>=n.from and n.name<>m.name return distinct n.name,m.name
Output
|n.name|m.name|
|n.name|m.name|
|"A"|"B"|
|"A"|"C"|
|"B"|"A"|
|"B"|"C"|
Only problem I see that I am getting duplicate records too for an example AB and BA
03-08-2020 06:29 AM
Thank for your reply.
It work!
What if I want to give relationships based on the same WAFERID and FROMTIME order of their occurrence?
E.g..
node:
WAFERID | fromtime | totime | WORK | STEP |
---|---|---|---|---|
A1 | 10:00 | 10:01 | process A | 1 |
A1 | 10:01 | 10:03 | process A | 2 |
A1 | 10:03 | 10:05 | process A | 3 |
I want to set the relation like.
Relation:
WAFERID | fromtime | totime | WORK | STEP | next_fromtime | next_step |
---|---|---|---|---|---|---|
A1 | 10:00 | 10:01 | process A | 1 | 10:01 | 2 |
A1 | 10:01 | 10:03 | process A | 2 | 10:03 | 3 |
Thank again for your reply!
All the sessions of the conference are now available online