Need help starting with Fraud detection and modeling time data as chains

I've been digging in to Neo4j over the last 2 weeks. My goal is to analyze log data for fraudulent activities. In some of the Neo4j youtube videos, it was suggested that having the Time based log data related in a Chain was the best approach. I have some test data imported (CSV) but I'm not sure how to get the data imported in a chain of relations.

Any assistance would be greatly appreciated :slight_smile:


You can use the APOC library to make a linked sequence, if that is what you mean:

MATCH (nodeToLink:Label)
WITH nodesToLink
ORDER BY nodesToLink.dateTimeProperty ASC
WITH collect(nodesToLink) as nodesToLinkCollection
1 Like

This worked!!
...but there's a quirk. My nodes are connected with the relationships pointing in the wrong direction.
I tried using DESC instead of ASC but that did not change anything.

This is my specific query:

MATCH (dt:Time)
ORDER BY dt.dateTimeProperty ASC
WITH collect(dt) as dtCollection
RETURN dtCollection


Changing order should work! Is the property a datetime/temporal type?

Yes it is. ( I did a conversion from a really ugly string when importing)

Deleted all "NEXT" relations and tried again.
Using DESC in this attempt.

The Time nodes are ordered in Descending order and the relationship arrows are going in the correct direction.

This is not what I need.
I will need the Time nodes in ASC order and the arros pointing in an ASCending direction.
I will delete the NEXT relations and try again (maybe I did something weird the first time?)

I made an error in the ORDER line.
I did not have my specific "dateTimePropery" name entered.
Replacing "dateTimePropery" with the actial name "DateTime" worked like a charm.

Thank you for all your help :slight_smile:

1 Like