changeset 1:08f01b5c4d4a draft

add libraries and java files
author one
date Tue, 04 Sep 2012 22:47:53 +0900
parents 22466c5df7f4
children 1744340f8be6
files .classpath lib/blueprints-core-2.2.0-SNAPSHOT-javadoc.jar lib/blueprints-core-2.2.0-SNAPSHOT-sources.jar lib/blueprints-core-2.2.0-SNAPSHOT.jar src/sample/CreateTinkerGraph.java src/sample/SimpleGraph.java
diffstat 6 files changed, 94 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.classpath	Tue Sep 04 21:56:36 2012 +0900
+++ b/.classpath	Tue Sep 04 22:47:53 2012 +0900
@@ -6,5 +6,6 @@
 			<attribute name="owner.project.facets" value="java"/>
 		</attributes>
 	</classpathentry>
+	<classpathentry kind="lib" path="lib/blueprints-core-2.2.0-SNAPSHOT.jar"/>
 	<classpathentry kind="output" path="build/classes"/>
 </classpath>
Binary file lib/blueprints-core-2.2.0-SNAPSHOT-javadoc.jar has changed
Binary file lib/blueprints-core-2.2.0-SNAPSHOT-sources.jar has changed
Binary file lib/blueprints-core-2.2.0-SNAPSHOT.jar has changed
--- /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);
+		}
+	}
+}
--- /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);
+		}
+		
+	}
+	
+}