Hello,

I am aware that all of this will be improved in TinkerPop 4. 

Suggestion to introduce type predicates in TinkerPop 3:

`...is(P.vertexType())...` or `...is(P.type(Type.vertex))...`

with imports:

`...is(vertexType())...` or `...is(P.type(vertex))...`

TinkerPop 3 type system depends on the implementation, but there are some 
common types like Vertex, Edge, Map, List, String...

Depending on the type, different steps are required to perform similar 
operations. For example, access by index:

* `values(i)` to get property from vertex or edge
* `select(i)` to get value from map

In complex traversals, it might be complicated to track type. This might be 
improved by introducing type predicates:

`...select('unknown').choose(mapType(), select('p'), values('p'))` 

Another use case - filter path elements. For example, getting all vertices from 
path with mixed order of elements 
`g.V().limit(1).out().out().inE().outV().path().as('myPath)` is not trivial  
task. This could be achieved by:

`...select('myPath').unfold().is(vertexType())`

Some steps depend on type:

`g.V().values('prop1').max()` will fail with `java.lang.Integer cannot be cast 
to java.lang.String` if `prop1` has different types. This could be addressed:

`g.V().values('prop1').is(numericType()).max()`

This requirement is actual for Cypher for Gremlin. I am very interested to know 
if this requirement is language translation specific, or have other use cases.

Please share your opinion on this.

Regards,
Dmitry

Reply via email to