title: How to do left join in Azure Cosmos DB using gremlin API
body: <p>Im studying Gremlin API of Azure Cosmos DB and im trying to translate some SQL statements to Gremlin traversals.</p>
  
  <p>Commands below:</p>
  
  <pre><code>
  //add product vertex
  g.addV('product').property('id', 'product1')
  g.addV('product').property('id', 'product2')
  g.addV('product').property('id', 'product3')
  g.addV('product').property('id', 'product4')
  g.addV('product').property('id', 'product5')
  
  //add product_category vertex
  g.addV('product_category').property('id', 'category1')
  g.addV('product_category').property('id', 'category2')
  
  //connect product and product_categories
  
  g.V('product1').addE('belongs_to').to(g.V('category1'))
  g.V('product2').addE('belongs_to').to(g.V('category1'))
  g.V('product3').addE('belongs_to').to(g.V('category2'))
  g.V('product4').addE('belongs_to').to(g.V('category2'))
  g.V('product5').addE('belongs_to').to(g.V('category2'))
  
  //add image vertex
  g.addV('image').property('public_url', 'url_1').property('id', 'image1')
  g.addV('image').property('public_url', 'url_2').property('id', 'image2')
  
  
  //link products to images
  
  g.V('product1').addE('belongs_to').property('primary', true).to(g.V('image1'))
  g.V('product2').addE('belongs_to').property('primary', true).to(g.V('image2'))
  
  </code></pre>
  
  <p>Now as you can see not all products have images.</p>
  
  <p>I want to be able to select all the products with category and image property.
  If a product doesnt have an image, it should still be selected with a null image property.</p>
  
  <p>Im trying to do something similar to left join by following this link:
  <a href="http://sql2gremlin.com/#_left_join" rel="nofollow noreferrer">http://sql2gremlin.com/#_left_join</a></p>
  
  <p>But unfortunately Gremlin API of Azure Cosmos does not yet support match() step.</p>
  
  <p>My current query only selects products that have outgoing edge to image:</p>
  
  <pre><code>g.V()
  .has('label', 'product')
  .as('product')
  .outE('has_image')
  .has('primary', true)
  .inV()
  .as('primary_image')
  .in('has_image')
  .out('belongs_to')
  .as('category')
  .select('product','primary_image','category')
  .by(__.valueMap()).by(__.values('public_url')).by(__.values('name'))
  
  </code></pre>