# HG changeset patch # User one # Date 1346766473 -32400 # Node ID 08f01b5c4d4a8eb931f04d041c8af800c2654288 # Parent 22466c5df7f4716e758089336509836feae8e323 add libraries and java files diff -r 22466c5df7f4 -r 08f01b5c4d4a .classpath --- a/.classpath Tue Sep 04 21:56:36 2012 +0900 +++ b/.classpath Tue Sep 04 22:47:53 2012 +0900 @@ -6,5 +6,6 @@ + diff -r 22466c5df7f4 -r 08f01b5c4d4a lib/blueprints-core-2.2.0-SNAPSHOT-javadoc.jar Binary file lib/blueprints-core-2.2.0-SNAPSHOT-javadoc.jar has changed diff -r 22466c5df7f4 -r 08f01b5c4d4a lib/blueprints-core-2.2.0-SNAPSHOT-sources.jar Binary file lib/blueprints-core-2.2.0-SNAPSHOT-sources.jar has changed diff -r 22466c5df7f4 -r 08f01b5c4d4a lib/blueprints-core-2.2.0-SNAPSHOT.jar Binary file lib/blueprints-core-2.2.0-SNAPSHOT.jar has changed diff -r 22466c5df7f4 -r 08f01b5c4d4a src/sample/CreateTinkerGraph.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/sample/CreateTinkerGraph.java Tue Sep 04 22:47:53 2012 +0900 @@ -0,0 +1,44 @@ +package sample; + +import com.tinkerpop.blueprints.Direction; +import com.tinkerpop.blueprints.Edge; +import com.tinkerpop.blueprints.Graph; +import com.tinkerpop.blueprints.Vertex; +import com.tinkerpop.blueprints.impls.tg.TinkerGraph; +import com.tinkerpop.blueprints.impls.tg.TinkerGraphFactory; + +public class CreateTinkerGraph { + + public static void main(String[] args) { + + createTest(); +// readTest(); + } + + + public static void outputGraph() { + Graph graph = new TinkerGraph("./resources/"); + + } + + public static void createTest() { + Graph graph = new TinkerGraph("/tmp/tinkergraph"); + Vertex a = graph.addVertex(null); + Vertex b = graph.addVertex(null); + a.setProperty("name", "mariko"); + b.setProperty("name", "Peter"); + Edge e = graph.addEdge(null, a, b, "knows"); + System.out.println(e.getVertex(Direction.OUT).getProperty("name") + "--" + e.getLabel() + + "-->" + e.getVertex(Direction.IN).getProperty("name")); + + } + + public static void readTest() { + Graph graph = new TinkerGraph("/tmp/tinkergraph"); + Vertex aa = graph.getVertex("1"); + System.out.println("vertex " + aa.getId() + " has name " + aa.getProperty("name")); + for(Edge ee : aa.getEdges(Direction.OUT)) { + System.out.println(ee); + } + } +} diff -r 22466c5df7f4 -r 08f01b5c4d4a src/sample/SimpleGraph.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/sample/SimpleGraph.java Tue Sep 04 22:47:53 2012 +0900 @@ -0,0 +1,49 @@ +package sample; + +import com.tinkerpop.blueprints.Direction; +import com.tinkerpop.blueprints.Edge; +import com.tinkerpop.blueprints.Graph; +import com.tinkerpop.blueprints.Vertex; +import com.tinkerpop.blueprints.impls.tg.TinkerGraph; +import com.tinkerpop.blueprints.impls.tg.TinkerGraphFactory; + +public class SimpleGraph { + + public static void main(String[] args) { +/* + Graph graph = new TinkerGraph(); + Vertex a = graph.addVertex(null); + Vertex b = graph.addVertex(null); + a.setProperty("name", "mariko"); + b.setProperty("name", "Peter"); + Edge e = graph.addEdge(null, a, b, "knows"); + System.out.println(e.getVertex(Direction.OUT).getProperty("name") + "--" + e.getLabel() + + "-->" + e.getVertex(Direction.IN).getProperty("name")); + + + + testIteratingGraph(); +*/ + Graph graph = TinkerGraphFactory.createTinkerGraph(); + Vertex aa = graph.getVertex("1"); + System.out.println("vertex " + aa.getId() + " has name " + aa.getProperty("name")); + for(Edge ee : aa.getEdges(Direction.OUT)) { + System.out.println(ee); + } + + } + + public static void testIteratingGraph() { + Graph graph = TinkerGraphFactory.createTinkerGraph(); + System.out.println("Vertices of " + graph); + for (Vertex vertex : graph.getVertices() ){ + System.out.println(vertex); + } + System.out.println("Edges of " + graph); + for (Edge edge : graph.getEdges()) { + System.out.println(edge); + } + + } + +}