非常基础的问题,
我刚将我的Titan升级从0.54到。
我遇到一个删除数值的问题。
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]
有什么想法吗?
neo4j
标签的 Titan 相关问题,但读者应该知道所提出的答案适用于 Neo4j。 - jbmusso