Package com.thinkaurelius.titan.core

Examples of com.thinkaurelius.titan.core.TitanGraph


   * @return a new instance of the store
   */
  @Override
  public NotifyingSail createStore() {
    log.info("Initializing Backend: Titan Store");
    final TitanGraph graph = createTitanGraph();
    return new GraphSail(graph);
  }
View Full Code Here


        String c = args[i++];
        int v = Integer.valueOf(args[i++]);
        int e = Integer.valueOf(args[i++]);
        String o = args[i++];
        Schema s = new Schema.Builder(v, e).build();
        TitanGraph graph = TitanFactory.open(c);
        new GraphGenerator(s).generateTypesAndData(graph);
        OutputStream out = new GZIPOutputStream(new FileOutputStream(o));
        GraphGenerator.writeData(graph, out);
        out.close();
        graph.shutdown();
        System.exit(0);
    }
View Full Code Here

    }


    private static void codeSnippets() throws Exception {
        TitanGraph g = TitanFactory.open("/tmp/titan");
        g.createKeyIndex("name", Vertex.class);
        Vertex juno = g.addVertex(null);
        juno.setProperty("name", "juno");
        juno = g.getVertices("name", "juno").iterator().next();

        TransactionalGraph tx = g.newTransaction();
        Thread[] threads = new Thread[10];
        for (int i = 0; i < threads.length; i++) {
            //threads[i]=new Thread(new DoSomething(tx));
            threads[i].start();
        }
View Full Code Here

        index.setProperty(INDEX_BACKEND_KEY, "elasticsearch");
        index.setProperty("local-mode", true);
        index.setProperty("client-only", false);
        index.setProperty(STORAGE_DIRECTORY_KEY, directory + File.separator + "es");

        TitanGraph graph = TitanFactory.open(config);
        GraphOfTheGodsFactory.load(graph);
        return graph;
    }
View Full Code Here

    @Test
    public void testIDAssignment() {
        for (int trial = 0; trial < 100; trial++) {
            for (boolean flush : new boolean[]{true, false}) {
                TitanGraph graph = getInMemoryGraph();
                int numVertices = 100;
                List<TitanVertex> vertices = new ArrayList<TitanVertex>(numVertices);
                List<InternalRelation> relations = new ArrayList<InternalRelation>();
                TitanVertex old = null;
                for (int i = 0; i < numVertices; i++) {
                    TitanVertex next = (TitanVertex) graph.addVertex(null);
                    InternalRelation edge = null;
                    if (old != null) {
                        edge = (InternalRelation) graph.addEdge(null, old, next, "knows");
                    }
                    InternalRelation property = (InternalRelation) next.addProperty("age", 25);
                    if (flush) {
                        idAssigner.assignID((InternalVertex) next);
                        idAssigner.assignID(property);
                        if (edge != null) idAssigner.assignID(edge);
                    } else {
                        relations.add(property);
                        if (edge != null) relations.add(edge);
                    }
                    vertices.add(next);
                    old = next;
                }
                if (!flush) idAssigner.assignIDs(relations);
                if (trial == -1) {
                    for (TitanVertex v : vertices) {
                        System.out.println(idAssigner.getIDManager().getPartitionID(v.getID()));
                    }
                    System.out.println("_____________________________________________");
                }
                graph.rollback();
                graph.shutdown();
            }
        }
    }
View Full Code Here

    }

    @Override
    public Graph generateGraph() {
        TitanGraph graph = StorageSetup.getInMemoryGraph();
        return graph;
    }
View Full Code Here

        super(graphTest);
    }

    @Override
    public void testGraphQueryForVertices() {
        TitanGraph g = (TitanGraph) graphTest.generateGraph();
        if (g.getType("age") == null) {
            TitanKey age = g.makeKey("age").dataType(Integer.class).single().make();
        }
        g.shutdown();
        super.testGraphQueryForVertices();
    }
View Full Code Here

        super.testGraphQueryForVertices();
    }

    @Override
    public void testGraphQueryForEdges() {
        TitanGraph g = (TitanGraph) graphTest.generateGraph();
        if (g.getType("weight") == null) {
            TitanKey weight = g.makeKey("weight").dataType(Double.class).single().make();
        }
        g.shutdown();
        super.testGraphQueryForEdges();
    }
View Full Code Here

TOP

Related Classes of com.thinkaurelius.titan.core.TitanGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.