【发布时间】:2016-08-01 16:05:21
【问题描述】:
非常基本的问题,
我刚刚将我的 Titan 从 0.54 升级到 Titan 1.0 Hadoop 1 / TP3 版本 3.01。
我遇到了删除值的问题
Property key: Cardinality.LIST/SET
可能是因为升级过程或者只是我对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");
现在,我想删除所有值“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();
//---------------- 预期结果 ----------: 空顶点属性
但不幸的是结果不是空的:
System.out.println("Values After Delete" + IteratorUtils.toList(v.values("myList")));
//------------------- 输出 --------------:
删除后,值仍然很明显!
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]
有什么想法吗?
【问题讨论】:
-
虽然 Titan 相关问题带有
neo4j标签,但应告知读者建议的答案适用于 Neo4j
标签: titan gremlin tinkerpop tinkerpop3