Return specific properties of vertices in a simplepath using Gremlin API cosmosDB

0

I am selecting a vertex based on a property and then want to find all vertices that have a link in a path 'upstream' from the start vertex. Which I can do fine, but I only want to return the vertex id and a couple of other properties.

g.V('1').repeat(out('UPSTREAM')).until(outE('UPSTREAM').count().is(0)).simplepath()

The above works fine but how do I return only the properties I want?

I've tried:

g.V('1').repeat(out('UPSTREAM')).until(outE('UPSTREAM').count().is(0)).simplepath().by('id').by('name')

but get the exception

Error

Failed to execute query: g.V('1').repeat(out('UPSTREAM')).until(outE('UPSTREAM').count().is(0)).simplepath().by('id').by('name'): 
Error with status code: 499. Message: 
ActivityId : 5a41d663-b1f1-41a4-b11e-abd258f17b01 ExceptionType : 
GraphNotYetImplementedException ExceptionMessage :
Not Yet Implemented: ModulateBy(traversal) Source : 
Microsoft.Azure.Graphs GremlinRequestId : 5a41d663-b1f1-41a4-b11e-abd258f17b01 Context : graphcompute Scope : 
graphcmd-invoke GraphInterOpStatusCode : InvalidRequestArguments HResult : 0x80131500
path
azure-cosmosdb
gremlin
asked on Stack Overflow Oct 30, 2018 by SAB

1 Answer

2

simplePath() is a filter-step which is just filtering vertices so just use valueMap(), project(), etc.:

g.V('1').
  repeat(out('UPSTREAM')).
    until(outE('UPSTREAM').count().is(0)).
  simplepath().
  valueMap('id','name')
answered on Stack Overflow Oct 30, 2018 by stephen mallette

User contributions licensed under CC BY-SA 3.0