© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Apache TinkerPopAT
Apache TinkerPop•2y ago•
5 replies
supercoal

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()
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
Solution
note that Neptune 1.3.2.1 now supports the functionality of TinkerPop 3.7.x. You can read more about it at https://aws.amazon.com/blogs/database/exploring-new-features-of-apache-tinkerpop-3-7-x-in-amazon-neptune/
Amazon Web Services
Exploring new features of Apache TinkerPop 3.7.x in Amazon Neptune ...
Amazon Neptune 1.3.2.0 now supports the Apache TinkerPop 3.7.x release line, introducing many major new features and improvements. In this post, we highlight the features that have the greatest impact on Gremlin developers using Neptune, to help you understand the implications of upgrading to these versions of Neptune and TinkerPop.
Exploring new features of Apache TinkerPop 3.7.x in Amazon Neptune ...
Jump to solution
Apache TinkerPop banner
Apache TinkerPopJoin
Apache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.
1,376Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

AWS Neptune and gremlin-javascript versions
Apache TinkerPopATApache TinkerPop / questions
3y ago
Neptune, Gremlin Java & Bindings
Apache TinkerPopATApache TinkerPop / questions
13mo ago
Hiring a Neptune/Gremlin Administrator
Apache TinkerPopATApache TinkerPop / questions
10mo ago
gremlin-go, MergeE, and Neptune
Apache TinkerPopATApache TinkerPop / questions
3y ago