supercoal
supercoal
ATApache TinkerPop
Created by supercoal on 5/7/2024 in #questions
Gremlin with AWS Neptune
Hey Friends, I am working on a project using AWS Neptune with gremlin query language on gremlingo driver. I realize the latest version of neptune is 1.3.1, and tinkerpop version is 3.6.4. I want to write a query to batch upsert property and then build edge. The relationship looks like the following: (User) -> [:HAS_USER_ACCOUNT] -> (GremlinUser) I am trying to use mergeV to upsert vertice and mergeE to upsert edge g. MergeV(map[interface{}]interface{}{ gremlingo.T.Id: universalId, }). Option(gremlingo.Merge.OnCreate, gremlinUserOnCreate). Option(gremlingo.Merge.OnMatch, gremlinUserOnMatch). Id(). MergeV(map[interface{}]interface{}{ gremlingo.T.Id: userUUID, gremlingo.T.Label: "User", "email": user["email"], }). Option(gremlingo.Merge.OnCreate, parentUserOnCreate). Option(gremlingo.Merge.OnMatch, parentUserOnMatch). Id(). MergeE(map[interface{}]interface{}{ gremlingo.T.Label: "HAS_USER_ACCOUNT", gremlingo.Direction.Out: gremlingo.Merge.OutV, gremlingo.Direction.In: gremlingo.Merge.InV, }). Option(gremlingo.Merge.OutV, map[interface{}]interface{}{ gremlingo.T.Label: "User", "email": user["email"], }). Option(gremlingo.Merge.InV, map[interface{}]interface{}{ gremlingo.T.Label: "GremlinUser", "email": user["email"], }). Id().Next() Conditions I have: 1. if the email can not be found, i am expecting to silent ignoe it, there is scenario that email can not be found for mergeE scenario 2. mergeV/mergeE does not handle single cardinality properly, it always add property to a set, I can not find a neat way to by pass it in tinkerpop 3.6.4
6 replies