public void propertyUnique ( P key , String value ) { GraphTraversal < Vertex , Vertex > traversal = tx ( ) . getTinkerTraversal ( ) . V ( ) . has ( key . name ( ) , value ) ; if ( traversal . hasNext ( ) ) { Vertex vertex = traversal . next ( ) ; if ( ! vertex . equals ( element ( ) ) || traversal . hasNext ( ) ) { if ( traversal . hasNext ( ) ) vertex = traversal . next ( ) ; throw PropertyNotUniqueException . cannotChangeProperty ( element ( ) , vertex , key , value ) ; } } property ( key , value ) ; }
Sets the value of a property with the added restriction that no other vertex can have that property .