Package com.tinkerpop.blueprints

Examples of com.tinkerpop.blueprints.KeyIndexableGraph.addVertex()


    }

    public void testReIndexingOfElements() {
        KeyIndexableGraph graph = (KeyIndexableGraph) graphTest.generateGraph();
        if (graph.getFeatures().supportsVertexKeyIndex) {
            Vertex vertex = graph.addVertex(null);
            vertex.setProperty("name", "marko");
            assertEquals(count(graph.getVertices("name", "marko")), 1);
            assertEquals(graph.getVertices("name", "marko").iterator().next(), vertex);
            graph.createKeyIndex("name", Vertex.class);
            assertEquals(count(graph.getVertices("name", "marko")), 1);
View Full Code Here


            assertEquals(count(graph.getVertices("name", "marko")), 1);
            assertEquals(graph.getVertices("name", "marko").iterator().next(), vertex);
        }

        if (graph.getFeatures().supportsEdgeKeyIndex) {
            Edge edge = graph.addEdge(null, graph.addVertex(null), graph.addVertex(null), graphTest.convertLabel("knows"));
            edge.setProperty("date", 2012);
            assertEquals(count(graph.getEdges("date", 2012)), 1);
            assertEquals(graph.getEdges("date", 2012).iterator().next(), edge);
            graph.createKeyIndex("date", Edge.class);
            assertEquals(count(graph.getEdges("date", 2012)), 1);
View Full Code Here

            assertEquals(count(graph.getVertices("name", "marko")), 1);
            assertEquals(graph.getVertices("name", "marko").iterator().next(), vertex);
        }

        if (graph.getFeatures().supportsEdgeKeyIndex) {
            Edge edge = graph.addEdge(null, graph.addVertex(null), graph.addVertex(null), graphTest.convertLabel("knows"));
            edge.setProperty("date", 2012);
            assertEquals(count(graph.getEdges("date", 2012)), 1);
            assertEquals(graph.getEdges("date", 2012).iterator().next(), edge);
            graph.createKeyIndex("date", Edge.class);
            assertEquals(count(graph.getEdges("date", 2012)), 1);
View Full Code Here

    public void testNoConcurrentModificationException() {
        KeyIndexableGraph graph = (KeyIndexableGraph) graphTest.generateGraph();
        if (graph.getFeatures().supportsEdgeKeyIndex) {
            graph.createKeyIndex("key", Edge.class);
            for (int i = 0; i < 25; i++) {
                graph.addEdge(null, graph.addVertex(null), graph.addVertex(null), graphTest.convertLabel("test")).setProperty("key", "value");
            }
            if (graph.getFeatures().supportsVertexIteration) assertEquals(count(graph.getVertices()), 50);
            if (graph.getFeatures().supportsEdgeIteration) assertEquals(count(graph.getEdges()), 25);
            int counter = 0;
            for (final Edge edge : graph.getEdges("key", "value")) {
View Full Code Here

    public void testNoConcurrentModificationException() {
        KeyIndexableGraph graph = (KeyIndexableGraph) graphTest.generateGraph();
        if (graph.getFeatures().supportsEdgeKeyIndex) {
            graph.createKeyIndex("key", Edge.class);
            for (int i = 0; i < 25; i++) {
                graph.addEdge(null, graph.addVertex(null), graph.addVertex(null), graphTest.convertLabel("test")).setProperty("key", "value");
            }
            if (graph.getFeatures().supportsVertexIteration) assertEquals(count(graph.getVertices()), 50);
            if (graph.getFeatures().supportsEdgeIteration) assertEquals(count(graph.getEdges()), 25);
            int counter = 0;
            for (final Edge edge : graph.getEdges("key", "value")) {
View Full Code Here

    public void testKeyIndicesConsistentWithElementRemoval() throws Exception {
        KeyIndexableGraph graph = (KeyIndexableGraph) graphTest.generateGraph();

        graph.createKeyIndex("foo", Vertex.class);

        Vertex v1 = graph.addVertex(null);
        v1.setProperty("foo", "42");
        vertexCount(graph, 1);

        graph.removeVertex(v1);
        vertexCount(graph, 0);
View Full Code Here

        graph.createKeyIndex("name", Vertex.class);
        if (graph instanceof TransactionalGraph)
            ((TransactionalGraph) graph).commit();

        Vertex v1 = graph.addVertex(null);
        v1.setProperty("name", "marko");
        assertEquals(v1.getProperty("name"), "marko");
        vertexCount(graph, 1);
        if (graph instanceof TransactionalGraph)
            ((TransactionalGraph) graph).commit();
View Full Code Here

        assertTrue(graph.getIndexedKeys(Edge.class).isEmpty());
        assertTrue(graph.getIndexedKeys(Vertex.class).size() == 1);
        assertTrue(graph.getIndexedKeys(Vertex.class).contains("name"));

        ((SparkseeGraph) graph).label.set("people");
        Vertex v1 = graph.addVertex(null);
        v1.setProperty("name", "foo");
        Vertex v2 = graph.addVertex(null);
        v2.setProperty("name", "boo");

        ((SparkseeGraph) graph).label.set("thing");
View Full Code Here

        assertTrue(graph.getIndexedKeys(Vertex.class).contains("name"));

        ((SparkseeGraph) graph).label.set("people");
        Vertex v1 = graph.addVertex(null);
        v1.setProperty("name", "foo");
        Vertex v2 = graph.addVertex(null);
        v2.setProperty("name", "boo");

        ((SparkseeGraph) graph).label.set("thing");
        Vertex v10 = graph.addVertex(null);
        v10.setProperty("name", "foo");
View Full Code Here

        v1.setProperty("name", "foo");
        Vertex v2 = graph.addVertex(null);
        v2.setProperty("name", "boo");

        ((SparkseeGraph) graph).label.set("thing");
        Vertex v10 = graph.addVertex(null);
        v10.setProperty("name", "foo");
        Vertex v20 = graph.addVertex(null);
        v20.setProperty("name", "boo");

        ((SparkseeGraph) graph).label.set("people");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.