String lastValueRemoved = v.removeProperty(foo); assertNotNull(lastValueRemoved); assertTrue(values.contains(lastValueRemoved)); lastValueRemoved = v.removeProperty(foo); assertNotNull(lastValueRemoved); assertTrue(values.contains(lastValueRemoved));
String lastValueRemoved = v.removeProperty(foo); assertNotNull(lastValueRemoved); assertTrue(values.contains(lastValueRemoved)); lastValueRemoved = v.removeProperty(foo); assertNotNull(lastValueRemoved); assertTrue(values.contains(lastValueRemoved));
public TitanProperty setProperty(TitanVertex vertex, final PropertyKey key, Object value) { verifyWriteAccess(vertex); Preconditions.checkNotNull(key); if (key.getCardinality()!=Cardinality.SINGLE) throw new UnsupportedOperationException("Not a single key: "+key+". Use addProperty instead"); TransactionLock uniqueLock = FakeLock.INSTANCE; try { if (config.hasVerifyUniqueness()) { //Acquire uniqueness lock, remove and add uniqueLock = getLock(vertex, key, Direction.OUT); } uniqueLock.lock(LOCK_TIMEOUT); if (config.hasVerifyUniqueness() && ((InternalRelationType)key).getConsistencyModifier()==ConsistencyModifier.LOCK) { vertex.removeProperty(key); } else { //Only delete in-memory InternalVertex v = (InternalVertex) vertex; for (InternalRelation r : v.it().getAddedRelations(new Predicate<InternalRelation>() { @Override public boolean apply(@Nullable InternalRelation p) { return p.getType().equals(key); } })) { r.remove(); } } return addPropertyInternal(vertex, key, value, false); } finally { uniqueLock.unlock(); } }
@Test public void testPropertyIndexPersistence() { final String propName = "favorite_color"; final String sharedValue = "blue"; makeStringPropertyKey(propName); TitanVertex alice = tx.addVertex(); TitanVertex bob = tx.addVertex(); alice.addProperty(propName, sharedValue); clopen(); alice = tx.getVertex(alice.getID()); bob = tx.getVertex(bob.getID()); assertEquals(sharedValue, alice.getProperty(propName)); assertEquals(null, bob.getProperty(propName)); alice.removeProperty(propName); bob.addProperty(propName, sharedValue); clopen(); }
@Test public void testPropertyIndexPersistence() { final String propName = "favorite_color"; final String sharedValue = "blue"; tx.makePropertyKey(propName).dataType(String.class).make(); TitanVertex alice = tx.addVertex(); TitanVertex bob = tx.addVertex(); alice.addProperty(propName, sharedValue); clopen(); alice = tx.getVertex(alice.getLongId()); bob = tx.getVertex(bob.getLongId()); assertEquals(sharedValue, alice.getProperty(propName)); assertEquals(null, bob.getProperty(propName)); alice.removeProperty(propName); bob.addProperty(propName, sharedValue); clopen(); }
v1.removeProperty(name); v1.setProperty(address, "xyz"); Edge edge = tx2.addEdge(1, v2, v1, "parent"); v1.removeProperty(address); tx3.commit();
vs[3] = tx.getVertex(vs[3].getLongId()); vs[3].setProperty("name","Bad Boy Badsy"); vs[3].removeProperty("age"); newTx(); vs[0] = tx.getVertex(vs[0].getLongId());