Arangodb update properties depend on edge type
Asked Answered
C

1

6

I am trying to use AQL to update the whole node collection , named Nodes, depend on the type of edges they have .

Requirement:

  • Basically, if 2 entity in Nodes has relation type= "Same", they would be updated with unique groupid properties (same for more than 2)
  • This would only run one time in the beginning (to populate groupid)

My concept approach:

  • Use AQL
  • For each entity inside Node, query out all connectable nodes with type=SAME
  • Generate an groupid and Update all of them
  • Write to an lookup object those id
  • For next entity, do a lookup, skip the entity if their id is there.

What I tried

FOR v,e,p
In 1..10
ANY v
EntityRelationTest
OPTIONS {uniqueVertices:"global",bfs:true}
FILTER p.edges[*].relationType[0]== "EQUALS"
UPDATE v WITH { typeName2:"test1"} IN EntityTest 
return NEW

But I am quite new to arangodb AQL, is something like above possible?

Carborundum answered 18/7, 2017 at 16:30 Comment(0)
C
0

In the end, what I use is a customize traversal object running directly inside Foxx in order to get the best of both world: performance and correctness. It seemed that we cannot do the above with only AQL

Carborundum answered 23/8, 2017 at 13:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.