Skip to content

Instantly share code, notes, and snippets.

@fabriziofortino
Created February 14, 2014 11:25
Show Gist options
  • Save fabriziofortino/8999540 to your computer and use it in GitHub Desktop.
Save fabriziofortino/8999540 to your computer and use it in GitHub Desktop.
import java.util.HashMap;
import java.util.Map;
import com.orientechnologies.orient.core.command.OCommandResultListener;
import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientEdge;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientVertex;
public class OrientdbTest2 {
public static void main(String[] args) {
final OrientGraph graph = new OrientGraph("remote:localhost/mydb",
"admin", "admin");
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> properties = new HashMap<String, Object>();
properties.put("weight", 1);
OrientEdge e1 = v1.addEdge(null, v2, "TestEdge", null, properties);
e1.save();
OrientEdge e2 = v3.addEdge(null, v4, "TestEdge", null, properties);
e2.save();
graph.commit();
graph.command(
new OCommandSQL(
"delete edge TestEdge")).execute();
graph.shutdown();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment