cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple relationships between two nodes all become duplicates

First, I create multiple relationships between pairs of nodes to represent the jobs a Director held at a Company. When I check for duplicate relationships, result is zero.

MATCH (a:Director)-[r]->(b:Company)
with a, b, type(r) as tr, properties(r) as pr, count(properties(r)) as cpr
where cpr>1 and b.fraud=true
return sum(cpr-1) as numDuplicateRelationships

Then, I traverse the graph to set properties on Directors and Companies. When I check again for duplicate relationships, all pairs of nodes that have more than one relationship are now all duplicates. In other words, if a pair of nodes had 3 relationships, there are now 3 identical relationships.

I am at a loss why initially different relationships all become identical!

=====
Neo4j Browser version: 3.1.14
Neo4j Server version: [3.4.1] (community)
Traversing using cypher http endpoint
Checking duplicates with cypher browser

debug.log

[...]
2019-03-26 06:21:17.036+0000 INFO [o.n.k.i.s.c.CountsTracker] Rotated counts store at transaction 2607741 to [/var/lib/neo4j/data/databases/graph.db/neostore.counts.db.b], from [/var/lib/neo4j/data/databases/graph.db/neostore.counts.db.a].
2019-03-26 06:21:17.044+0000 INFO [o.n.k.i.t.l.c.CheckPointerImpl] Checkpoint triggered by scheduler for tx count threshold @ txId: 2607741 checkpoint completed in 19ms
2019-03-26 06:21:17.044+0000 INFO [o.n.k.i.t.l.p.LogPruningImpl] Pruned log versions 21446-21446, last checkpoint was made in version 21448
2019-03-26 06:21:27.044+0000 INFO [o.n.k.i.t.l.c.CheckPointerImpl] Checkpoint triggered by scheduler for tx count threshold @ txId: 2607744 checkpoint started...
2019-03-26 06:21:27.057+0000 INFO [o.n.k.i.s.c.CountsTracker] Rotated counts store at transaction 2607744 to [/var/lib/neo4j/data/databases/graph.db/neostore.counts.db.a], from [/var/lib/neo4j/data/databases/graph.db/neostore.counts.db.b].

3 REPLIES 3

Can you show the code you use to traverse and set the properties?

Actually I believe this is being caused by py2neo OGM which does not support multiple relationships of the same type between a pair of nodes.

I thought that dropping down to cypher for relationship creation and then back to py2neo would be fine. Somehow, py2neo is defaulting the relationships to a single value.

I will test this tonight and report back

David

I was indeed correct in my assumption, namely that using py2neo caused the relationships between a pair of nodes to reset to the same value. Once I used cypher to traverse the graph and set various properties, the original multiple relationships remained the same.

Thanks for your quick reply, @elaine.rosenberg

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.