I have a part vertex and a used_by edge which a property called quantity.
I am currently starting with something like the following
MATCH (a:part {part_num: '123')-[u:used_by*]->(b:part {part_num: '456')
RETURN [x IN u::jsonb | x.properties.quantity] AS quantities
the array comprehension returns an array of quantities. there is one path from a-[*]->b but there are multiple hops. the u edges returned from the match are for each of the various hop paths and not just the one that connects a to b (longest path).
Once i have the array I need to sum the values in it.
I am not sure if this is possible in agensgraph
Supposing you have a graph with the following setup:
You would then end up with the following graph:
Using your base query, we get back a JSON array
Finally, we just need to utilize the hybrid SQL/Cypher capabilities of AgensGraph to convert that array using
jsonb_array_elements_textand thenSUMup that subquery.