1

On an Azure cosmosDB gremlin instance,

I have 2 vertices A and B linked by and edge E. Both vertices has a 'name' property.

I'd like to run a query which will take A's name and put it in B

when I run

g.V("AId").as("a").oute().inv().hasLabel('B').property("name",select('a').values('name'))

I get the following error :

GraphRuntimeException ExceptionMessage : Gremlin Query Execution Error: Cannot create ValueField on non-primitive type GraphTraversal.

It looks like the select operator is not correctly used.

Thank you for your help

ATM
  • 160
  • 2
  • 10

1 Answers1

1

EDITED based on discussion in comments

You have oute and inv in lower case. In general, the steps use camelCase naming, such as outE and inV (outside of specific GLVs), but in the comments it was mentioned that CosmosDB will accept all lower case step names. Assuming therefore, that is not the issue here, the query as written looks fine in terms of generic Gremlin. The example below was run using TinkerGraph, and uses the same select mechanism to pick the property value.

gremlin> g.V(3).as("a").outE().inV().has('code','LHR').property("name",select('a').values('city')) 
==>v[49]

gremlin> g.V(49).values('name')
==>Austin  

What you are observing may be specific to CosmosDB and it's probably worth contacting their support folks to double check.

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
  • The interpreter within Azure cosmos is not case sensitive, you can write both inv and inV – ATM Sep 01 '22 at 16:31
  • OK then, unfortunately it looks like you have encountered a limitation with the CosmosDB Gremlin support, as other than the casing point, the query is fine and works on TinkerGraph. – Kelvin Lawrence Sep 01 '22 at 18:28
  • One other thought, it looks as if the query engine is perhaps not actually executing the `select` anonymous traversal. I'm not too hopeful but you could try changing it to `__.select(...)` or even adding a `.next()` after the select. Neither should be needed in Gremlin, but I'm not sure what the restrictions might be with the implementation you are using. – Kelvin Lawrence Sep 01 '22 at 18:39
  • 2
    Thanks for the response. Indeed it's a bit weird because the select operator returns the correct vertex when I write the following query : ```g.V("AId").as("a").oute().inv().hasLabel('B').select('a')``` I'll try to ask directly to the support, thanks again – ATM Sep 02 '22 at 19:41