Gremlin.net 中的 P.Within 方法无法正确转换数组

问题描述 投票:0回答:0

假设我在 gremlin.net 中有以下代码:


 var graphQuery = graph.V(source.ToString());

            var graphOutCondition = __.OutE().HasLabel("Transport");
            foreach (var filter in filters)
            {
                if (filter.Key.StartsWith("C"))
                {

                    graphOutCondition = graphOutCondition.Has("C", P.Within(Clist));
                }
               
                if (filter.Key.StartsWith("CT"))
                {

                    graphOutCondition = graphOutCondition.Has(filter.Key,filter.Value);
                }
                
                if (filter.Key.StartsWith("TU"))
                {
             
                    graphOutCondition = graphOutCondition.Where(__.Properties<string>().HasKey("EP_" + filter.Value.Clean()));
                }
            }
            graphQuery.Repeat(graphOutCondition.InV().SimplePath())
            .Until(__.HasId(destination.ToString()));

            graphQuery.Path()
            .By(__.Id()).By(__.Id());

正如代码所暗示的,我在

CT
列表中有多个值(这是一个
List<string>
)。

但是运行代码时,抛出异常:

错误:System.AggregateException:发生一个或多个错误。 (发生一个或多个错误。(ScriptEvaluationError:

活动ID:29d7649d-0694-4089-9567-26506c67a010
异常类型:GraphSyntaxException
ExceptionMessage:Gremlin 查询语法错误:意外的标记:'`'

数组被转换为

System.Collections.Generic.List
,我不明白为什么。

我尝试使用

.ToArray()
方法或像上面所示的代码一样进行转换来传递列表本身。所有结果都一样。

我使用的是 gremlin.net 版本 3.4.13,因为它是 Azure CosmosDb 支持的最新版本。

我确实有一个执行器,它将查询作为字符串发送。

var result = gremlinClient.SubmitAsync<dynamic>(query.ToString()).Result

有什么建议吗?

gremlin azure-cosmosdb-gremlinapi gremlinnet
© www.soinside.com 2019 - 2024. All rights reserved.