本文整理匯總了Java中org.apache.tinkerpop.gremlin.structure.Vertex.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java Vertex.remove方法的具體用法?Java Vertex.remove怎麽用?Java Vertex.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.tinkerpop.gremlin.structure.Vertex
的用法示例。
在下文中一共展示了Vertex.remove方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldRemoveAVertexFromAnIndex
import org.apache.tinkerpop.gremlin.structure.Vertex; //導入方法依賴的package包/類
@Test
public void shouldRemoveAVertexFromAnIndex() {
final TinkerGraph g = TinkerGraph.open();
g.createIndex("name", Vertex.class);
g.addVertex("name", "marko", "age", 29);
g.addVertex("name", "stephen", "age", 35);
final Vertex v = g.addVertex("name", "stephen", "age", 35);
// a tricky way to evaluate if indices are actually being used is to pass a fake BiPredicate to has()
// to get into the Pipeline and evaluate what's going through it. in this case, we know that at index
// is used because only "stephen" ages should pass through the pipeline due to the inclusion of the
// key index lookup on "name". If there's an age of something other than 35 in the pipeline being evaluated
// then something is wrong.
assertEquals(new Long(2), g.traversal().V().has("age", P.test((t, u) -> {
assertEquals(35, t);
return true;
}, 35)).has("name", "stephen").count().next());
v.remove();
assertEquals(new Long(1), g.traversal().V().has("age", P.test((t, u) -> {
assertEquals(35, t);
return true;
}, 35)).has("name", "stephen").count().next());
}
示例2: shouldNotAddEdgeToAVertexThatWasRemoved
import org.apache.tinkerpop.gremlin.structure.Vertex; //導入方法依賴的package包/類
@Test(expected = IllegalStateException.class)
public void shouldNotAddEdgeToAVertexThatWasRemoved() {
final TinkerGraph graph = TinkerGraph.open();
final Vertex v = graph.addVertex();
v.property("name", "stephen");
assertEquals("stephen", v.value("name"));
v.remove();
v.addEdge("self", v);
}
示例3: shouldNotModifyAVertexThatWasRemoved
import org.apache.tinkerpop.gremlin.structure.Vertex; //導入方法依賴的package包/類
@Test(expected = IllegalStateException.class)
public void shouldNotModifyAVertexThatWasRemoved() {
final TinkerGraph graph = TinkerGraph.open();
final Vertex v = graph.addVertex();
v.property("name", "stephen");
assertEquals("stephen", v.value("name"));
v.remove();
v.property("status", 1);
}
示例4: shouldNotReadValueOfPropertyOnVertexThatWasRemoved
import org.apache.tinkerpop.gremlin.structure.Vertex; //導入方法依賴的package包/類
@Test(expected = IllegalStateException.class)
public void shouldNotReadValueOfPropertyOnVertexThatWasRemoved() {
final TinkerGraph graph = TinkerGraph.open();
final Vertex v = graph.addVertex();
v.property("name", "stephen");
assertEquals("stephen", v.value("name"));
v.remove();
v.value("name");
}
示例5: deleteVertex
import org.apache.tinkerpop.gremlin.structure.Vertex; //導入方法依賴的package包/類
private void deleteVertex(final Vertex toDelete) {
valueIndex.remove(toDelete);
toDelete.remove();
}
示例6: removeVertex
import org.apache.tinkerpop.gremlin.structure.Vertex; //導入方法依賴的package包/類
private void removeVertex(Graph graph, Vertex vertex) {
vertex.remove();
}
示例7: testLargeDegreePerformance
import org.apache.tinkerpop.gremlin.structure.Vertex; //導入方法依賴的package包/類
public void testLargeDegreePerformance() {
long ts = System.currentTimeMillis();
Vertex one = graph.addVertex();
one.property("one", "1");
Object oneId = one.id();
int numVertices = 10000; // 1000000;
Object[] vids = new Object[numVertices];
for (int i = 0; i < numVertices; i++) { // Change to 1M for perf
Vertex many = graph.addVertex();
many.property("many", "2");
addEdge(graph, one, many, "toMany");
vids[i] = many.id();
if (i % 1000 == 0) {
System.out.println(i + " 1000 in " + (System.currentTimeMillis() - ts));
ts = System.currentTimeMillis();
graph.tx().commit();
one = graph.vertices(oneId).next();
}
}
for (int i=0; i < numVertices; i++) {
Vertex v = getVertex(graph, vids[i]);
Iterator<Edge> iter = v.edges(Direction.BOTH);
assertTrue(iter.hasNext());
iter.next();
assertFalse(iter.hasNext());
v.remove();
if (i % 1000 == 0) {
System.out.println(i + " 1000 in " + (System.currentTimeMillis() - ts));
if (i % 5000 == 0) {
Iterator<Edge> iter2 = getVertex(graph, one.id()).edges(Direction.BOTH);
for (int j=0; j < numVertices - i - 1; j++) {
assertTrue(iter2.hasNext());
iter2.next();
}
assertFalse(iter.hasNext());
}
ts = System.currentTimeMillis();
graph.tx().commit();
}
}
graph.tx().commit();
}
示例8: testObsolescence
import org.apache.tinkerpop.gremlin.structure.Vertex; //導入方法依賴的package包/類
public void testObsolescence() {
IGraphStore store = ((BitsyGraph)graph).getStore();
// Create a vertex
Vertex v = graph.addVertex();
Object vid = v.id();
v.property("foo", "bar");
// Self edge
Edge e = v.addEdge("self", v);
Object eid = e.id();
graph.tx().commit();
Record v1MRec = new Record(RecordType.V, "{\"id\":\"" + vid + "\",\"v\":1,\"s\":\"M\"}");
assertFalse(v1MRec.checkObsolete(store, false, 1, null));
assertFalse(v1MRec.checkObsolete(store, true, 1, null));
Record e1MRec = new Record(RecordType.E, "{\"id\":\"" + eid + "\",\"v\":1,\"s\":\"M\",\"o\":\"" + vid + "\",\"l\":\"" + vid + "\",\"i\":\"" + vid + "\"}");
assertFalse(e1MRec.checkObsolete(store, false, 1, null));
assertFalse(e1MRec.checkObsolete(store, true, 1, null));
// Create a vertex
v = graph.vertices(vid).next();
v.property("foo", "baz");
e = v.edges(Direction.IN, "self").next();
e.property("foo", "baz");
graph.tx().commit();
Record v2MRec = new Record(RecordType.V, "{\"id\":\"" + vid + "\",\"v\":2,\"s\":\"M\"}");
Record v1DRec = new Record(RecordType.V, "{\"id\":\"" + vid + "\",\"v\":1,\"s\":\"D\"}");
assertTrue(v1MRec.checkObsolete(store, false, 1, null));
assertTrue(v1MRec.checkObsolete(store, true, 1, null));
assertFalse(v1DRec.checkObsolete(store, false, 1, null));
assertTrue(v1DRec.checkObsolete(store, true, 1, null));
assertFalse(v2MRec.checkObsolete(store, false, 1, null));
assertFalse(v2MRec.checkObsolete(store, true, 1, null));
Record e2MRec = new Record(RecordType.E, "{\"id\":\"" + eid + "\",\"v\":2,\"s\":\"M\",\"o\":\"" + vid + "\",\"l\":\"" + vid + "\",\"i\":\"" + vid + "\"}");
Record e1DRec = new Record(RecordType.E, "{\"id\":\"" + eid + "\",\"v\":1,\"s\":\"D\",\"o\":\"" + vid + "\",\"l\":\"" + vid + "\",\"i\":\"" + vid + "\"}");
assertTrue(e1MRec.checkObsolete(store, false, 1, null));
assertTrue(e1MRec.checkObsolete(store, true, 1, null));
assertFalse(e1DRec.checkObsolete(store, false, 1, null));
assertTrue(e1DRec.checkObsolete(store, true, 1, null));
assertFalse(e2MRec.checkObsolete(store, false, 1, null));
assertFalse(e2MRec.checkObsolete(store, true, 1, null));
// Delete vertex
v = graph.vertices(vid).next();
v.remove();
// Edge will get deleted automatically!
graph.tx().commit();
Record v2DRec = new Record(RecordType.V, "{\"id\":\"" + vid + "\",\"v\":1,\"s\":\"D\"}");
assertFalse(v2DRec.checkObsolete(store, false, 1, null));
assertTrue(v2DRec.checkObsolete(store, true, 1, null));
}