/** * Returns the property key with the given name. If automatic type making is enabled, it will make the property key * using the configured default type maker if a key with the given name does not exist. * * @param name name of the property key to return * @return the property key with the given name * @throws IllegalArgumentException if a property key with the given name does not exist or if the * type with the given name is not a property key * @see PropertyKey */ public PropertyKey getPropertyKey(String name);
getPropertyKey方法将始终返回prpertyKey。
答案 0 :(得分:0)
要检查数据库中是否存在密钥,请使用:
mgmt.containsRelationType(keyToCheck)
答案 1 :(得分:0)
如果是最新版本的Titan(1.0.0),您可以使用com.thinkaurelius.titan.core.TitanTransaction
检查Titan数据库架构中是否存在属性键。 http://thinkaurelius.github.io/titan/javadoc/1.0.0/com/thinkaurelius/titan/core/TitanTransaction.html
示例:
TitanTransaction tt = TitanGraph.newTransaction();
boolean exists = tt.containsPropertyKey("keyName");