azuregraphazure-cosmosdb-gremlinapi

Get information from two vertices in Azure CosmosDB Graph (GREMLIN API)


enter image description here

I would like to create a query which gets information from two vertices. I have Vertex A and Vertex B and I need from Vertex A the value of property label and of properties array the value schema. From Vertex B I only would like to get the value of property name. I tried multiple queries to get the result like:

[
  {
     "label" : "anySubTypeName",
     "schema": ".....",
     "name"  : "anyTypeName"
   },
   ...
]

I was able to get properties name of each vertex but not schema with following query:

g.V().hasLabel("subtype").as("subtype")
     .outE("typeof").inV().as("type")
     .select("subtype", "type").by("id")
____________________

Result:

[
  {
    "subtype": "anySubTypeName",
    "type"   :  "anyTypeName"
  }
]

Can anyone help me that I also can get schema as part of the result?


Solution

  • I found an answer to get the expected result with the following query:

    g.V().haslabel("subtype").as("subtype")
         .outE("typeof").inV().as("type")
         .select("subtype", "type").by("id")