P.Within method in Gremlin.net does not translate the array correctly

99 Views Asked by At

Suppose I have the following code in 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());

As the code implies, I have multiple values in CT list (which is a List<string>).

But when running the code, it throws an exception:

Error: System.AggregateException: One or more errors occurred. (One or more errors occurred. (ScriptEvaluationError:

ActivityId : 29d7649d-0694-4089-9567-26506c67a010
ExceptionType : GraphSyntaxException
ExceptionMessage : Gremlin query syntax error: Unexpected token: '`'

The array is translated to System.Collections.Generic.List which I don't see why.

I have tried to pass the list itself, using the .ToArray() method or casting like in the code shown above. All results are the same.

I am using gremlin.net version 3.4.13 as it is the latest version supported by Azure CosmosDb.

I do have an executor which sends the query as string.

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

Any suggestions?

0

There are 0 best solutions below