Looking in the Tinkerpop doc, I could find a list of String functions:
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?
But, I could not find a way to use them. I also try looking the Javadoc about the TextP in http://tinkerpop.apache.org/javadocs/current/core/org/apache/tinkerpop/gremlin/process/traversal/TextP.html, but also could not find any good information over there.
Query filters like this bellow are working fine:
g.V().has( label, within( 'cake', 'coffee' ) ).limit(3)
Some examples of queries that I have tested and did not worked:
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
is meant to work like any other Predicate
and some of the usage you listed is correct:
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
As a side note I'm a bit surprised to see no examples in the documentation - I intend to get some added.
I try to test this command on the github.com/bricaud/gremlin-server-3.2.5-REST and it did not work.
[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]
Also, it does not work with AWS Neptune. What probably is one more limitation in the Amazon implementation.
TextP
was added to TinkerPop 3.4.x so I think you could expect it not to work on gremlin-server-3.2.5-REST which is based on TinkerPop 3.2.x.TextP
should work on Neptune - see examples here: aws.amazon.com/blogs/database/…Looks like it is an AWS issue. These queries does not work on my current Neptune cluster using the offical gremlin client
g.V().has(label,startingWith('o')).limit(3)
,g.V().has(label,TextP.startingWith('o')).limit(3)
while this worksg.V().has(label,within('o')).limit(3)
. I am going to open a ticket with them about this.