cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

sum relationships in bloom

I’m new in neo4j and I need some help

I have two nodes end relationship between them as invoice with invoice amount, there are a lot of invoices between two company-nodes, I need to summarize relationships amounts and use this syfer in bloom

I tried to write down this query

match (n:company {comp_ID:$parameter})-[r:invoice]->(m:company)

with n, m, sum(r.amount) as total, collect(r) as relationships

where size(relationships) > 1

with total, head(relationships) as keep, tail(relationships) as delete

set keep.w = total

10 REPLIES 10

Hello @iliaeli 🙂

What is the problem of the query?

Regards,
Cobra

unfortunately i cant get results in bloom 😞 

iliaeli_0-1660309004234.png

this is the amounts of invoices, i want to sum relationships but

bloom can not find any results by parameter search

It looks like your store the total in the w property. Can you verify that the property exists using Neo4j Desktop?

when I run this query in neo4j desktop :

match (n:company)-[r:invoice]->(m:company)

with n, m, sum(r.amount) as total, collect(r) as relationships

where size(relationships) > 1

with total, head(relationships) as keep, tail(relationships) as delete

set keep.w = total

it says that

‘Set 1 property, completed after 2 ms.’

After I run all nodes and it shows me this

iliaeli_0-1660310991782.png

 

Where amount 700 000 is collected new relationship and unnamed relationships are old ones

So it sums everything in the same relation?

I don't know well but i want in bloom to be left only summarized relationship

Then delete other relationships?

I don't need them to be deleted, just hide or something like this, and i dont know how to execute this query in bloom because its not working

iliaeli
Node

1

is it possible in bloom to ad this query in scene action and get some results?

match(n:piri)-[r:miwodeba]->(m:piri)
where id(n) in $nodes
with n, m, sum(r.Rirebuleba) as total, collect(r) as relationships
where size(relationships) > 1
with total, head(relationships) as keep, tail(relationships) as delete
set keep.w = total
foreach(r in delete | delete r)
return *