title: Efficient way to replace SET/LIST property in Janusgraph
body: <p>In JanusGraph, I want to replace entire value of SET(or LIST) property.
  Accoding to <a href="https://stackoverflow.com/questions/36540170/updating-the-entire-value-of-vertex-property-with-list-cardinality-in-titan-grap">this article</a>, both storage backend and index backend (ES, Solr) behavior MUST be taken into account for consistency and efficiency though, the article was written about Titan 1.0.</p>
  
  <p>Currently, I have two option to do it as follows. Which one is better ? Or is there best way to update SET/LIST property in JanusGraph.</p>
  
  <ul>
  <li>JanusGraph version: github master</li>
  <li>Gremlin version: 3.2.6</li>
  </ul>
  
  <h2>Sample schema</h2>
  
  <pre><code>mgmt = graph.openManagement()
  person = mgmt.makeVertexLabel('Person').make()
  name = mgmt.makePropertyKey('name').dataType(String.class).cardinality(SET).make()
  mgmt.buildIndex('i_person_name', Vertex.class).addKey(name, Mapping.STRING.asParameter()).buildMixedIndex('elastic-search')
  mgmt.commit()
  
  person = g.addV('Person').property('name', 'Alexander').property('name', 'Alex').next()
  g.tx().commit()
  </code></pre>
  
  <h2>Solution 1</h2>
  
  <p>Drop entire property values, and then set new values.</p>
  
  <pre><code>new_names = ['Alex', 'Alexander Emmanuel Rodriguez'] as Set
  
  v = g.V().hasLabel('Person').has('name', 'Alexander').next()
  g.V(v).properties('name').drop().iterate()
  new_names.each{
      v.property('name', it)
  }
  
  g.tx().commit()
  </code></pre>
  
  <h2>Solution 2</h2>
  
  <p>Drop only old values and set only new values.</p>
  
  <pre><code>new_names = ['Alex', 'Alexander Emmanuel Rodriguez'] as Set
  
  v = g.V().hasLabel('Person').has('name', 'Alexander').next()
  v.properties('name').each {
      new_names.remove(it.value()) ? null : it.remove()
  }
  new_names.each {
      v.property('name', it)
  }
  
  g.tx().commit()
  </code></pre>