温馨提示:本文翻译自stackoverflow.com,查看原文请点击:graph databases - String functions on Tinkerpop Query Language
amazon-neptune graph-databases gremlin tinkerpop3

graph databases - Tinkerpop查询语言上的字符串函数

发布于 2020-04-29 16:53:44

Tinkerpop文档中,我可以找到String函数的列表:

TextP.startingWith(string) - Does the incoming String start with the provided String?

TextP.endingWith(string) - Does the incoming String end with the provided String? 

TextP.containing(string) - Does the incoming String contain the provided String?

TextP.notStartingWith(string) - Does the incoming String not start with the provided String?

TextP.notEndingWith(string) - Does the incoming String not end with the provided String?

TextP.notContaining(string) - Does the incoming String not contain the provided String?

但是,我找不到使用它们的方法。我还尝试在http://tinkerpop.apache.org/javadocs/current/core/org/apache/tinkerpop/gremlin/process/traversal/TextP.html中查找有关TextP的Javadoc ,但也找不到任何好的信息在那边。

这样的查询过滤器工作正常:

g.V().has( label, within( 'cake', 'coffee' ) ).limit(3)

我测试过但无法使用的一些查询示例:

g.V().label().startingWith('c')
g.V().label().fold().startingWith('c')
g.V().label().fold().has(__.startingWith('c'))
g.V().has(label, startingWith('c'))
g.V().has(label, TextP.startingWith('c'))
g.V().has(label.startingWith('c'))

查看更多

提问者
Thiago Mata
被浏览
24
stephen mallette 2020-02-11 19:20

TextP意味着可以像其他任何方式一样工作,Predicate并且您列出的某些用法是正确的:

gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().has(label, startingWith("p")).label()
==>person
==>person
==>person
==>person
gremlin> g.V().has('name', endingWith("o")).values('name')
==>marko

附带一提,对于文档中没有任何示例,我感到有些惊讶-我打算添加一些示例。