© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Apache TinkerPopAT
Apache TinkerPop•3y ago•
3 replies
tdgabriel

Multiple labels not working in mergeV() syntax for conditional inserts in AWS Neptune

I know that multiple labels are an AWS Neptune specific feature and TinkerPop model does not allow for multiple labels, but maybe someone else has encountered the same problem.

While attempting to migrate conditional inserts (upserts) to the new mergeV/E() syntax, I encountered an issue with vertices that have multiple labels. It appears that creating a vertex with multiple labels only works with the addV() step, which was present in the fold()/coalesce()/unfold() pattern for conditional inserts. In the new syntax, the label property is specified in a map, and a string such as 'Label1::Label2::Label3' will be treated as a single label.
For example, the following code written in Gremlin-Java, creates a vertex with a single label called 'Label1::Label2', instead of 2 separate labels:
Map<Object, Object> mergeMap = Map.of(T.id, someId);
Map<Object, Object> createMap = new HashMap<>(
    Map.of(
        T.id, someId, T.label, "Label1::Label2"
    )
);

g.mergeV(mergeMap).option(Merge.onCreate, createMap)
Map<Object, Object> mergeMap = Map.of(T.id, someId);
Map<Object, Object> createMap = new HashMap<>(
    Map.of(
        T.id, someId, T.label, "Label1::Label2"
    )
);

g.mergeV(mergeMap).option(Merge.onCreate, createMap)

Are there any alternative approaches to this issue that make use of the new syntax for efficient upserts?
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Neptune - multiple labels
Apache TinkerPopATApache TinkerPop / questions
4y ago
.mergeV() with Javascript not working
Apache TinkerPopATApache TinkerPop / questions
2y ago
Integration tests for AWS Neptune DB
Apache TinkerPopATApache TinkerPop / questions
3y ago
Gremlin with AWS Neptune
Apache TinkerPopATApache TinkerPop / questions
2y ago