S.D. vehicles proximity

S.D vehicles proximity. Return all S.D. vehicles close (connected by a path of length <= 3 hops) to a given S.D. vehicle after a given time instant.

T-Cypher query:

RIGHT_SLICE 2019-01-01T08:00:00Z

MATCH (SDvehicle {ID:’X’})

–[CONTINUOUS(p:isCloseTo*1..3)]-> (vf:SDvehicle)

RETURN vf, p, duration(p@T)


Cypher query:

MATCH (SDvehicle)-[p:`isCloseTo`]->(vf:`SDvehicle`) WHERE p.tEnd >= 1546329600000 RETURN vf, p, myFunctions.duration([p.tStart, p.tEnd]) AS `duration(p@T)` UNION MATCH (SDvehicle)-[r0:`isCloseTo`]->(n0)-[r1:`isCloseTo`]->(vf:`SDvehicle`) WHERE (r0.tEnd >= 1546329600000 AND r1.tEnd >= 1546329600000 AND (myFunctions.min([r0.tEnd, r1.tEnd]) – myFunctions.max([r0.tStart, r1.tStart])) > 0) RETURN vf, [r0, n0, r1] AS p, myFunctions.duration([myFunctions.min([r0.tStart, r1.tStart]), myFunctions.max([r0.tEnd, r1.tEnd])]) AS `duration(p@T)` UNION MATCH (SDvehicle)-[r0:`isCloseTo`]->(n0)-[r1:`isCloseTo`]->(n1)-[r2:`isCloseTo`]->(vf:`SDvehicle`) WHERE (r0.tEnd >= 1546329600000 AND r1.tEnd >= 1546329600000 AND r2.tEnd >= 1546329600000 AND (myFunctions.min([r0.tEnd, r1.tEnd, r2.tEnd]) – myFunctions.max([r0.tStart, r1.tStart, r2.tStart])) > 0) RETURN vf, [r0, n0, r1, n1, r2] AS p, myFunctions.duration([myFunctions.min([r0.tStart, r1.tStart, r2.tStart]), myFunctions.max([r0.tEnd, r1.tEnd, r2.tEnd])]) AS `duration(p@T)`


Interpretation:

As mentioned in the dataset description, a temporary relationship is created between the S.D. vehicles if the distance separating them is less than a threshold (1 meter e.g.). Let’s suppose that, S.D.vehicles connected to the given S.D. vehicle with a path of length up to 3 are considered close. Hence, the ‘1..3’ in the T-Cypher query indicates the variable length of the relationship pattern. This temporal path is considered as continuous since the time intervals of the relationships should intersect to consider the vehicles close. Intuitively, a vehicle A is close to a vehicle C if A is close to B at the same time when B was close to C.

Comments are closed.