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

0

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', if it does not already exist:

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?

已提問 1 年前檢視次數 76 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南