use of com.tinkerpop.blueprints.impls.orient.OrientEdge in project orientdb by orientechnologies.
the class TestDeleteEdge method testDeleteEdge.
@Test
public void testDeleteEdge() {
for (int i = 0; i < 10; i++) {
OrientVertex v1 = graph.addVertex("class:TestVertex");
OrientVertex v2 = graph.addVertex("class:TestVertex");
OrientVertex v3 = graph.addVertex("class:TestVertex");
OrientVertex v4 = graph.addVertex("class:TestVertex");
Map<String, Object> p1 = new HashMap<String, Object>();
p1.put("based_on", "0001");
OrientEdge e1 = v1.addEdge(null, v2, "TestEdge", null, p1);
e1.save();
Map<String, Object> p2 = new HashMap<String, Object>();
p2.put("based_on", "0002");
OrientEdge e2 = v3.addEdge(null, v4, "TestEdge", null, p2);
e2.save();
graph.commit();
graph.command(new OCommandSQL("delete edge TestEdge where based_on = '0001'")).execute();
Iterable<OrientVertex> edges = graph.command(new OCommandSQL("select count(*) from TestEdge where based_on = '0001'")).execute();
assertTrue(edges.iterator().hasNext());
assertEquals(edges.iterator().next().getProperty("count"), 0l);
}
}
use of com.tinkerpop.blueprints.impls.orient.OrientEdge in project orientdb by orientechnologies.
the class GraphDatabaseTest method testInsertOfEdgeWithInsertCommandUnsafe.
public void testInsertOfEdgeWithInsertCommandUnsafe() {
OrientEdge insertedEdge = database.command(new OCommandSQL("insert into E set in = #9:0, out = #9:1, a = 33 unsafe")).execute();
Assert.assertNotNull(insertedEdge);
Integer confirmDeleted = database.command(new OCommandSQL("delete from " + insertedEdge.getIdentity() + " unsafe")).execute();
Assert.assertEquals(confirmDeleted.intValue(), 1);
}
Aggregations