Hi There,
I am a beginner and I am trying to write a query to filter my results using the date property of my relationship. But it doesn't seem to work.
CREATE (U1:Person {UID:1,Name:'Person1'}),
(U2:Person {UID:2,PName:'Person2'}),
(U3:Person {UID:3,PName:'Person3'}),
(U4:Person {UID:4,PName:'Person4'}),
(U5:Person {UID:5,PName:'Person5'}),
(U6:Person {UID:6,PName:'Person6'}),
(U7:Person {UID:7,PName:'Person7'}),
(U8:Person {UID:8,PName:'Person8'}),
(U9:Person {UID:9,PName:'Person9'}),
(U10:Person {UID:10,PName:'Person10'})
MATCH (P1:Person {UID:1}), (P2:Person {UID:2}), (P3:Person {UID:3})
CREATE (P1)-[:Met {date:datetime("2020-04-25T14:00")}]->(P2),
(P1)-[:Met {date:datetime("2020-04-25T14:00")}]->(P3)
MATCH (P2:Person {UID:2}), (P4:Person {UID:4}), (P5:Person {UID:5})
CREATE (P2)-[:Met {Date:datetime('2020-04-26T10:00')}]->(P4),
(P2)-[:Met {Date:datetime('2020-04-26T10:00')}]->(P5)
MATCH (P3:Person {UID:3}),(P6:Person {UID:6}), (P7:Person {UID:7})
CREATE (P3)-[:Met {Date:datetime('2020-04-26T14:00')}]->(P6),
(P3)-[:Met {Date:datetime('2020-04-26T14:00')}]->(P7)
MATCH (P4:Person {UID:4}), (P8:Person {UID:8}), (P9:Person {UID:9})
CREATE (P4)-[:Met {Date:datetime('2020-04-27T8:00')}]->(P8),
(P4)-[:Met {Date:datetime('2020-04-27T8:00')}]->(P9)
MATCH (P8:Person {UID:8}),(P10:Person {UID:10})
CREATE (P8)-[:Met {Date:datetime('2020-04-27T10:00')}]->(P10)
MATCH (P2:Person {UID:2}),(P4:Person {UID:4})
CREATE (P2)-[:Met {Date:datetime('2020-04-28T14:00')}]->(P11:Person {UID:11,PName:'Person11'}),
(P2)-[:Met {Date:datetime('2020-04-28T14:00')}]->(P4)
Match Query
Match Query 1:
MATCH p = (a:Person {UID:2})-[rels:Met*]-(b:Person) WHERE All(r IN rels WHERE datetime(r.date) < datetime("2020-04-30T00:00Z")) RETURN a.UID AS PersonID, b.UID AS FriendID,p , length(p) AS depth Order by depth
This returns only 2 rows, while all dates in my relationship are below 2020-04-30.
Match Query 2:
MATCH p = (a:Person {UID:2})-[rels:Met*]-(b:Person) WHERE All(r IN rels WHERE datetime(r.date) < datetime("2020-04-28T00:00Z")) RETURN a.UID AS PersonID, b.UID AS FriendID,p , length(p) AS depth Order by depth
This also returns only 2 rows, which is ok. But something seems to not work.
Match Query 3:
MATCH p = (a:Person {UID:2})-[rels:Met*]-(b:Person) RETURN a.UID AS PersonID, b.UID AS FriendID,p , length(p) AS depth Order by depth
returns all rows
Kindly help. Many thanks in advance...