Created
February 14, 2014 11:25
-
-
Save fabriziofortino/8999540 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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