2014-09-12 3 views
0
 
/** 
    * 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.Как проверить PropertyKey уже существует в базе данных Titan

ответ

0

Чтобы проверить, если ключ существует в использовании базы данных:

mgmt.containsRelationType(keyToCheck) 
0

В случае последней версии Titan (1.0.0) можно использовать com.thinkaurelius.titan.core.TitanTransaction, чтобы проверить свойство ключа существует в Titan DB схемы , http://thinkaurelius.github.io/titan/javadoc/1.0.0/com/thinkaurelius/titan/core/TitanTransaction.html

Пример:

TitanTransaction tt = TitanGraph.newTransaction(); 
boolean exists = tt.containsPropertyKey("keyName");