在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'))
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
附带一提,对于文档中没有任何示例,我感到有些惊讶-我打算添加一些示例。
我尝试在github.com/bricaud/gremlin-server-3.2.5-REST上测试此命令,但它不起作用。
[WARN] HttpGremlinEndpointHandler - Invalid request - responding with 500 Internal Server Error and No signature of method: org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.endingWith() is applicable for argument types: (java.lang.String) values: [vertex]
此外,它不适用于AWS Neptune。Amazon实施中可能还有另一个限制。
TextP
已添加到TinkerPop 3.4.x中,因此我想您可以期望它不能在基于TinkerPop 3.2.x的gremlin-server-3.2.5-REST上运行。TextP
应该可以在Neptune上工作-在此处查看示例:aws.amazon.com/blogs/database/…看起来这是一个AWS问题。这些查询不起作用使用官方客户端小鬼我目前海王星集群上
g.V().has(label,startingWith('o')).limit(3)
,g.V().has(label,TextP.startingWith('o')).limit(3)
而这个作品g.V().has(label,within('o')).limit(3)
。我要和他们一起开一张票。