Unable to delete / delete multiple property keys on Vertex Titan 1.0 Tinkerpop 3

A very simple question,
I just updated my Titan from 0.54 to Titan 1.0 Hadoop 1 / TP3 version 3.01.

I have a problem deleting values

Property key: Cardinality.LIST/SET

Perhaps this is due to the upgrade process or just a misunderstanding of TP3.

 // ----- CODE ------:

tg = TitanFactory.open(c);

TitanManagement mg = tg.openManagement();

//create KEY (Cardinality.LIST) and commit changes
tm.makePropertyKey("myList").dataType(String.class).cardinality( Cardinality.LIST).make();
mg.commit();

//add vertex with multi properties

Vertex v = tg.addVertex();

v.property("myList", "role1");
v.property("myList", "role2");
v.property("myList", "role3");
v.property("myList", "role4");
v.property("myList", "role4");

Now I want to delete all the values ​​"role1, role2 ...."

// iterate over all values and try to remove the values 
 List<String> values = IteratorUtils.toList(v.values("myList"));
        for (String val : values) {
            v.property("myList", val).remove();
         }
  tg.tx().commit();

// ---------------- EXPECTED RESULT ----------: Empty vertex properties

But, unfortunately, the result is not empty:

System.out.println("Values After Delete" + IteratorUtils.toList(v.values("myList")));

// ------------------- OUTPUT --------------:

After removal, the values ​​are still obvious!

15:19:59,780  INFO ThriftKeyspaceImpl:745 - Detected partitioner org.apache.cassandra.dht.Murmur3Partitioner for keyspace titan

15:19:59,784  INFO Values After Delete [role1, role2, role3, role4, role4]

Any ideas?

+4
source share
2 answers

property(key, value) (javadoc). , VertexProperties (javadoc).

for (VertexProperty vp : v.properties("name")) {
    vp.remove();
}

@jbmusso , GraphTraversal.

+1

API Gremlin , API . for .

TinkerPop 3.0.1 Drop Step, Gremlin:

v = g.addV().next()
g.V(v).property("myList", "role1")
g.V(v).property("myList", "role2")
// ...
g.V(v).properties('myList').drop()
+7

All Articles