Using the Neo4j plugin that allows for creating fake data with the "faker library": plugin over here
foreach (i in range(1,5000) |
create (p:Person { id : i })
set p += fkr.person('1940-01-01','2020-05-15')
set p.healthstatus = fkr.stringElement("Sick,Healthy")
set p.confirmedtime = datetime()-duration("P"+toInteger(round(rand()*100))+"DT"+toInteger(round(rand()*10))+"H")
set p.birthDate = datetime(p.birthDate)
set p.addresslocation = point({x: toFloat(51.210197+rand()/100), y: toFloat(4.402771+rand()/100)})
set p.name = p.fullName
remove p.fullName
);
foreach (i in range(1,100) |
create (p:Place { id: i, name: "Place nr "+i})
set p.type = fkr.stringElement("Grocery shop,Theater,Restaurant,School,Hospital,Mall,Bar,Park")
set p.location = point({x: toFloat(51.210197+rand()/100), y: toFloat(4.402771+rand()/100)})
);
create index on :Place(id);
create index on :Place(location);
create index on :Place(name);
create index on :Person(id);
create index on :Person(name);
create index on :Person(healthstatus);
create index on :Person(confirmedtime);
with range(1,5000) as range
unwind range as iteration
match (p:Person {id: toInteger(rand()*500)+1}), (pl:Place {id:toInteger(rand()*100)+1 })
create (p)-[:PERFORMS_VISIT]->(v:Visit { id: iteration})-[:LOCATED_AT]->(pl)
create (p)-[virel:VISITS]->(pl)
set v.starttime = datetime()-duration("P"+toInteger(round(rand()*100))+"DT"+toInteger(round(rand()*10))+"H")
set virel.starttime = v.starttime
set v.endtime = v.starttime + duration("PT"+toInteger(round(rand()*10))+"H"+toInteger(round(rand()*60))+"M")
set virel.endtime = v.endtime;
match (vi:Visit)
set vi:Purchase
remove vi:Visit
remove vi.duration
remove vi.endtime
set vi.purchasetime = vi.starttime
remove vi.starttime;
match (pl:Place)
set pl:Product
remove pl:Place
set pl.name = replace(pl.name, 'Place', 'Product')
remove pl.location
remove pl.type;
match (n)-[v:VISITS]->(m)
create (n)-[p:PURCHASES]->(m)
set p.purchasetime = v.starttime
delete v;
match (n)-[la:LOCATED_AT]->(m)
create (n)-[:OF_PRODUCT]->(m)
delete la;
match (n)-[pv:PERFORMS_VISIT]->(m)
create (n)-[:PERFORMS_PURCHASE]->(m)
delete pv;
Person 1 and person2 have 1 product purchase in common. person 2 has bought something that person 1 has not bought (yet)
match path = (p1:Person)-[:PURCHASES]->(pr1:Product)<-[:PURCHASES]-(p2:Person)-[:PURCHASES]->(pr2:Product)
where not exists( (p1)-[:PURCHASES]->(pr2) )
return path
limit 10;
Person 1 and person 2 have purchased 2 products in common - but there’s a 3rd product that person 2 has bought and person 1 has not bought (yet)
match path1 = (p1:Person)-[:PURCHASES]->(pr1:Product)<-[:PURCHASES]-(p2:Person)-[:PURCHASES]->(pr2:Product)<-[:PURCHASES]-(p1),
path2 = (p2)-[:PURCHASES]->(pr3:Product)
where not exists ((p1)-[:PURCHASES]->(pr3))
return path1, path2
limit 10;