简体   繁体   中英

How to filter values based on a property of the node in gremlin

So i understand how to filter values on gremlin console but things like filter, gt etc dont work on gremlin.net. continuously get errors.

I would like to know how to use Filter in gremlin.net to filter out nodes or edges. I cant find documentation pertaining to how to do this in C# using the gremlin.net library

I tried writing the code i write on gremlin console but some of those functions were not recognized

I am trying to filter out all those nodes that have the property idnum greater than 5 : gV().Has("idnum", gt(5));

it keeps saying gt is not found under the current context.

Gremlin is largely the same regardless of the programming language you use. There are typically only minor differences in syntax as it relates to the idioms of the programming language itself (eg in Java we typically see the initial letter in method names lower cased whereas in C# they are upper cased). So, the general step documentation , though demonstrated in Groovy/Java style, typically gives you enough information on how steps work for you to then translate to your language of choice. Also in that same documentation, where necessary, there are specific notes on programming language specific differences that may be relevant.

That said, I assume your issue is related to the importing of P.gt() for C#:

using static Gremlin.Net.Process.Traversal.P;

You can read more about other Common Imports in the Reference Documentation here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM