J
JanusGraph2mo ago
smp

Custom Vertex ID and coalesce

I am trying to find a vertex by ID if it exists update a property otherwise create a vertex with the ID. ConfiguredGraphFactory.open("tenant51").traversal(). V().hasId('45gjttOlN2+udTmQcJnHpp').fold() .coalesce( unfold().property('attribute_7', 'value_7'), addV().property('id', '45gjttOlN2+udTmQcJnHpp').property('attribute_7', 'value_7') ) I couldn't find a way to pass id for the vertex in coalesce. java.lang.IllegalArgumentException: Must provide vertex id at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143) at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.addVertex(StandardJanusGraphTx.java:638) at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsTransaction.addVertex(JanusGraphBlueprintsTransaction.java:138) at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.addVertex(JanusGraphBlueprintsGraph.java:143) at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.addVertex(JanusGraphBlueprintsGraph.java:59) @Bo Am I missing something.
2 Replies
Bo
Bo2mo ago
Try T.id
smp
smpOP3w ago
@Bo It worked thanks
Want results from more Discord servers?
Add your server