comparison src/sample/GremlinSample.java @ 13:0ef7268bbbac draft

create descendiangOrder(Graph,FileOutputStream) method.
author one
date Sat, 08 Sep 2012 04:12:19 +0900
parents 8e3bb1843beb
children
comparison
equal deleted inserted replaced
12:7e38484474f4 13:0ef7268bbbac
14 14
15 public class GremlinSample { 15 public class GremlinSample {
16 16
17 public static void main(String[] args) { 17 public static void main(String[] args) {
18 18
19 final String fileDB = "./resources/tinkerpopDB"; 19 // final String fileDB = "./resources/tinkerpopDB";
20 20 final String fileDB = "./resources/tinkerGraph100";
21 21
22 try { 22 try {
23 Graph graph = new TinkerGraph(); 23 Graph graph = new TinkerGraph();
24 FileInputStream in = new FileInputStream(new File(fileDB)); 24 FileInputStream in = new FileInputStream(new File(fileDB));
25 GraphMLReader.inputGraph(graph, in); 25 GraphMLReader.inputGraph(graph, in);
26 in.close(); 26 in.close();
27 LinkToVertex ltv = new LinkToVertex(graph); 27 LinkToVertex ltv = new LinkToVertex(graph);
28 28
29 String id = "21"; 29 final long AllVertexNumber = ltv.searchAllVertices();
30 GremlinPipeline pipe = new GremlinPipeline(); 30 System.out.println("AllVertexNumber = "+ AllVertexNumber);
31 pipe.start(graph.getVertex(id)).out("HasLink").property("pageTitle"); 31
32 pipe.setStarts(new SingleIterator<Vertex>(graph.getVertex(id))); 32 for (Vertex o : graph.getVertices()) {
33 System.out.println(o);
34 }
35 /*
36 GremlinPipeline pipe = new GremlinPipeline();
37 pipe.start(graph.getVertex(1));
38 */
39
40 /*
41 String id = "85956";
42 GremlinPipeline pipe = new GremlinPipeline();
43 pipe.start(graph.getVertex(id)).out("HasLink");//.property("pageTitle");
44 pipe.property("pageTitle");
45 // pipe.start(graph.getVertex(id)).out("HasLink");
46 // pipe.setStarts(new SingleIterator<Vertex>(graph.getVertex(id)));
47
33 for (Object title : pipe) { 48 for (Object title : pipe) {
34 System.out.println((String)title); 49 System.out.println(title);
35 } 50 }
36 51 */
37
38 } catch (NumberFormatException e){ 52 } catch (NumberFormatException e){
39 System.out.println("Program exit"); 53 System.out.println("Program exit");
40 } catch (Exception e) { 54 } catch (Exception e) {
41 e.printStackTrace(); 55 e.printStackTrace();
42 } finally { 56 } finally {