public final void verifyAccess(TitanVertex... vertices) { verifyOpen(); for (TitanVertex v : vertices) { Preconditions.checkArgument(v instanceof InternalVertex, "Invalid vertex: %s", v); if (!(v instanceof SystemRelationType) && this != ((InternalVertex) v).tx()) throw new IllegalStateException("The vertex or type is not associated with this transaction [" + v + "]"); if (v.isRemoved()) throw new IllegalStateException("The vertex or type has been removed [" + v + "]"); } }
if (keys.contains(r.getType())) { TitanVertex v = ((TitanVertexProperty) r).element(); if (!v.isRemoved()) vertexSet.add(v);
if (iterator.next().isRemoved()) iterator.remove();
TitanRelation findRelation(TitanTransaction tx) { TitanVertex v = ((StandardTitanTx)tx).getInternalVertex(outVertexId); if (v == null || v.isRemoved()) return null; TitanVertex typeVertex = tx.getVertex(typeId); if (typeVertex == null) return null; if (!(typeVertex instanceof RelationType)) throw new IllegalArgumentException("Invalid RelationIdentifier: typeID does not reference a type"); RelationType type = (RelationType) typeVertex; Iterable<? extends TitanRelation> rels; if (((RelationType) typeVertex).isEdgeLabel()) { Direction dir = Direction.OUT; TitanVertex other = ((StandardTitanTx)tx).getInternalVertex(inVertexId); if (other==null || other.isRemoved()) return null; if (((StandardTitanTx) tx).isPartitionedVertex(v) && !((StandardTitanTx) tx).isPartitionedVertex(other)) { //Swap for likely better performance TitanVertex tmp = other; other = v; v = tmp; dir = Direction.IN; } rels = ((VertexCentricQueryBuilder) v.query()).noPartitionRestriction().types((EdgeLabel) type).direction(dir).adjacent(other).edges(); } else { rels = ((VertexCentricQueryBuilder) v.query()).noPartitionRestriction().types((PropertyKey) type).properties(); } for (TitanRelation r : rels) { //Find current or previous relation if (r.longId() == relationId || ((r instanceof StandardRelation) && ((StandardRelation) r).getPreviousID() == relationId)) return r; } return null; }
v21 = getV(tx, v21); v3 = getOnlyElement(v21.query().direction(Direction.OUT).labels("link").vertices()); assertFalse(v3.isRemoved()); v3.remove(); newTx(); v21 = getV(tx, v21); v3 = getOnlyElement(v21.query().direction(Direction.OUT).labels("link").vertices()); assertFalse(v3.isRemoved()); newTx(); v21 = getV(tx3, v21); v3 = getOnlyElement(v21.query().direction(Direction.OUT).labels("link").vertices()); assertTrue(v3.isRemoved()); tx3.commit();
public final void verifyAccess(TitanVertex... vertices) { verifyOpen(); for (TitanVertex v : vertices) { Preconditions.checkArgument(v instanceof InternalVertex, "Invalid vertex: %s", v); if (!(v instanceof SystemRelationType) && this != ((InternalVertex) v).tx()) throw new IllegalStateException("The vertex or type is not associated with this transaction [" + v + "]"); if (v.isRemoved()) throw new IllegalStateException("The vertex or type has been removed [" + v + "]"); } }
public final void verifyAccess(TitanVertex... vertices) { verifyOpen(); for (TitanVertex v : vertices) { Preconditions.checkArgument(v instanceof InternalVertex, "Invalid vertex: %s", v); if (!(v instanceof SystemRelationType) && this != ((InternalVertex) v).tx()) throw new IllegalStateException("The vertex or type is not associated with this transaction [" + v + "]"); if (v.isRemoved()) throw new IllegalStateException("The vertex or type has been removed [" + v + "]"); } }
if (iterator.next().getValue().isRemoved()) iterator.remove();
if (iterator.next().isRemoved()) iterator.remove();
if (keys.contains(r.getType())) { TitanVertex v = ((TitanVertexProperty) r).element(); if (!v.isRemoved()) vertexSet.add(v);
if (keys.contains(r.getType())) { TitanVertex v = ((TitanProperty) r).getVertex(); if (!v.isRemoved()) vertexSet.add(v);
TitanRelation findRelation(TitanTransaction tx) { TitanVertex v = ((StandardTitanTx)tx).getInternalVertex(outVertexId); if (v == null || v.isRemoved()) return null; TitanVertex typeVertex = tx.getVertex(typeId); if (typeVertex == null) return null; if (!(typeVertex instanceof RelationType)) throw new IllegalArgumentException("Invalid RelationIdentifier: typeID does not reference a type"); RelationType type = (RelationType)typeVertex; Iterable<? extends TitanRelation> rels; if (((RelationType) typeVertex).isEdgeLabel()) { Direction dir = Direction.OUT; TitanVertex other = ((StandardTitanTx)tx).getInternalVertex(inVertexId); if (other==null || other.isRemoved()) return null; if (((StandardTitanTx)tx).isPartitionedVertex(v) && !((StandardTitanTx)tx).isPartitionedVertex(other)) { //Swap for likely better performance TitanVertex tmp = other; other = v; v = tmp; dir = Direction.IN; } rels = ((VertexCentricQueryBuilder)v.query()).noPartitionRestriction().types((EdgeLabel) type).direction(dir).adjacent(other).titanEdges(); } else { rels = ((VertexCentricQueryBuilder)v.query()).noPartitionRestriction().types((PropertyKey)type).properties(); } for (TitanRelation r : rels) { //Find current or previous relation if (r.getLongId() == relationId || ((r instanceof StandardRelation) && ((StandardRelation)r).getPreviousID()==relationId)) return r; } return null; }
TitanRelation findRelation(TitanTransaction tx) { TitanVertex v = ((StandardTitanTx)tx).getInternalVertex(outVertexId); if (v == null || v.isRemoved()) return null; TitanVertex typeVertex = tx.getVertex(typeId); if (typeVertex == null) return null; if (!(typeVertex instanceof RelationType)) throw new IllegalArgumentException("Invalid RelationIdentifier: typeID does not reference a type"); RelationType type = (RelationType) typeVertex; Iterable<? extends TitanRelation> rels; if (((RelationType) typeVertex).isEdgeLabel()) { Direction dir = Direction.OUT; TitanVertex other = ((StandardTitanTx)tx).getInternalVertex(inVertexId); if (other==null || other.isRemoved()) return null; if (((StandardTitanTx) tx).isPartitionedVertex(v) && !((StandardTitanTx) tx).isPartitionedVertex(other)) { //Swap for likely better performance TitanVertex tmp = other; other = v; v = tmp; dir = Direction.IN; } rels = ((VertexCentricQueryBuilder) v.query()).noPartitionRestriction().types((EdgeLabel) type).direction(dir).adjacent(other).edges(); } else { rels = ((VertexCentricQueryBuilder) v.query()).noPartitionRestriction().types((PropertyKey) type).properties(); } for (TitanRelation r : rels) { //Find current or previous relation if (r.longId() == relationId || ((r instanceof StandardRelation) && ((StandardRelation) r).getPreviousID() == relationId)) return r; } return null; }
if (txNo!=2) { assertTrue(txNo+ " - " + v2,v2==null || v2.isRemoved());
v21 = tx.getVertex(v21.getID()); v3 = (TitanVertex) Iterables.getOnlyElement(v21.getVertices(OUT, "link")); assertFalse(v3.isRemoved()); v3.remove(); newTx(); v21 = tx.getVertex(v21.getID()); v3 = (TitanVertex) Iterables.getOnlyElement(v21.getVertices(OUT, "link")); assertFalse(v3.isRemoved()); newTx(); v21 = tx3.getVertex(v21.getID()); v3 = (TitanVertex) Iterables.getOnlyElement(v21.getVertices(OUT, "link")); assertTrue(v3.isRemoved()); tx3.commit();
v21 = tx.getVertex(v21.getLongId()); v3 = (TitanVertex) Iterables.getOnlyElement(v21.getVertices(OUT, "link")); assertFalse(v3.isRemoved()); v3.remove(); newTx(); v21 = tx.getVertex(v21.getLongId()); v3 = (TitanVertex) Iterables.getOnlyElement(v21.getVertices(OUT, "link")); assertFalse(v3.isRemoved()); newTx(); v21 = tx3.getVertex(v21.getLongId()); v3 = (TitanVertex) Iterables.getOnlyElement(v21.getVertices(OUT, "link")); assertTrue(v3.isRemoved()); tx3.commit();