admin管理员组文章数量:1353497
I have a query that sent as a string works and returns the result
var query = $"g.V('{brandEntityCode}')" +
$".has('{Affinity}', '{partition}')" +
$".optional(" +
$"outE('{relationshipType}')" +
$".has('{HierarchyCollection}', '{hierarchyCollection}')" +
$".has('{IsDeleted}', {IsDeletedValue})" +
$".inV()" +
$".has('{IsDeleted}', {IsDeletedValue})" +
$".optional(" +
$"outE('{relationshipType}')" +
$".has('{HierarchyCollection}', '{hierarchyCollection}')" +
$".has('{IsDeleted}', {IsDeletedValue})" +
$".inV()" +
$".has('{IsDeleted}', {IsDeletedValue})" +
$")" +
$")" +
$".values('{EntityCode}')";
Since I have Gremlin package I want to use their package to write the query, which looks like this
var query = Graph.V($"'{brandEntityCode}'")
.Has(Affinity, $"'{partition}'")
.Optional<GraphTraversal<object, Vertex>>(OutE($"'{relationshipType}'")
.Has(HierarchyCollection, $"'{hierarchyCollection}'")
//.Has(IsDeleted, $"{IsDeletedValue}")
.InV()
.Has(IsDeleted, $"{IsDeletedValue}")
.Optional<GraphTraversal<object, Vertex>>(OutE($"{relationshipType}")
.Has(HierarchyCollection, $"'{hierarchyCollection}'")
//.Has(IsDeleted, IsDeletedValue)
.InV()
//.Has(IsDeleted, IsDeletedValue)
))
.Values<string>($"{EntityCode}")
.ToGremlinQuery();
But this throw a runtime exception, that An item with the same key has already been added. Key: isDeleted_1
And if I remove the isDeleted key, then the query at runtime looks like this
{g.V(9e591e9f-de07-427c-8b9e-762caf9c86a6).has('_affinity', _affinity).optional(outE('isOwnedBy').has('hierarchyCollection', hierarchyCollection_1).has('isDeleted', isDeleted_1).inV().optional(outE('isOwnedBy').has('hierarchyCollection', hierarchyCollection_2).inV())).values('entityCode')}
Now the execution throws the exception
ServerEvaluationError:
ActivityId : aa76ea5f-a514-479c-b799-349ae4ca3b5c
ExceptionType : GraphCompileException
ExceptionMessage :
Gremlin Query Compilation Error: Unable to resolve symbol '_affinity' in the current context. @ line 1, column 62.
Unable to resolve symbol 'hierarchyCollection_1' in the current context. @ line 1, column 127.
Unable to resolve symbol 'isDeleted_1' in the current context. @ line 1, column 173.
Unable to resolve symbol 'hierarchyCollection_2' in the current context. @ line 1, column 240.
4 Error(s)
GremlinRequestId : bae1692c-2b04-4b09-8521-88a0a78a9c0a
Context : graphcompute
Scope : graphparse-translate-validatesymbolresolution
GraphInterOpStatusCode : QuerySyntaxError
HResult : 0x80131500
Is there a solution for this issue?
本文标签:
版权声明:本文标题:gremlinnet - Gremlin query throws runtime exception that An item with the same key has already been added - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743892768a2557229.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论