Examples of iterators()


Examples of com.tinkerpop.gremlin.structure.Edge.iterators()

        int counter = 0;
        final Map<Vertex, Long> map = new HashMap<>();
        while (traversal.hasNext()) {
            counter++;
            final Edge edge = traversal.next();
            MapHelper.incr(map, edge.iterators().vertexIterator(Direction.OUT).next(), 1l);
        }
        assertEquals(3, map.size());
        assertEquals(5, counter);
        map.forEach((k, v) -> {
            if (k.id().equals(convertToVertexId("marko"))) {
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.Vertex.iterators()

            final Map<String, Object> m = new HashMap<>();
            m.put(GraphSONTokens.ID, vertex.id());
            m.put(GraphSONTokens.LABEL, vertex.label());
            m.put(GraphSONTokens.TYPE, GraphSONTokens.VERTEX);

            final Object properties = StreamFactory.stream(vertex.iterators().propertyIterator())
                    .collect(Collectors.groupingBy(vp -> vp.key()));
            final Object hiddens = StreamFactory.stream(vertex.iterators().hiddenPropertyIterator())
                    .collect(Collectors.groupingBy(vp -> vp.key()));
            m.put(GraphSONTokens.PROPERTIES, properties);
            m.put(GraphSONTokens.HIDDENS, hiddens);
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.Vertex.iterators()

            m.put(GraphSONTokens.LABEL, vertex.label());
            m.put(GraphSONTokens.TYPE, GraphSONTokens.VERTEX);

            final Object properties = StreamFactory.stream(vertex.iterators().propertyIterator())
                    .collect(Collectors.groupingBy(vp -> vp.key()));
            final Object hiddens = StreamFactory.stream(vertex.iterators().hiddenPropertyIterator())
                    .collect(Collectors.groupingBy(vp -> vp.key()));
            m.put(GraphSONTokens.PROPERTIES, properties);
            m.put(GraphSONTokens.HIDDENS, hiddens);

            if (directionalVertex.getDirection() == Direction.BOTH || directionalVertex.getDirection() == Direction.OUT) {
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.Vertex.iterators()

                    .collect(Collectors.groupingBy(vp -> vp.key()));
            m.put(GraphSONTokens.PROPERTIES, properties);
            m.put(GraphSONTokens.HIDDENS, hiddens);

            if (directionalVertex.getDirection() == Direction.BOTH || directionalVertex.getDirection() == Direction.OUT) {
                m.put(GraphSONTokens.OUT_E, StreamFactory.stream(vertex.iterators().edgeIterator(Direction.OUT)).collect(Collectors.toList()));
            }

            if (directionalVertex.getDirection() == Direction.BOTH || directionalVertex.getDirection() == Direction.IN) {
                m.put(GraphSONTokens.IN_E, StreamFactory.stream(vertex.iterators().edgeIterator(Direction.IN)).collect(Collectors.toList()));
            }
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.Vertex.iterators()

            if (directionalVertex.getDirection() == Direction.BOTH || directionalVertex.getDirection() == Direction.OUT) {
                m.put(GraphSONTokens.OUT_E, StreamFactory.stream(vertex.iterators().edgeIterator(Direction.OUT)).collect(Collectors.toList()));
            }

            if (directionalVertex.getDirection() == Direction.BOTH || directionalVertex.getDirection() == Direction.IN) {
                m.put(GraphSONTokens.IN_E, StreamFactory.stream(vertex.iterators().edgeIterator(Direction.IN)).collect(Collectors.toList()));
            }

            jsonGenerator.writeObject(m);
        }
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.Vertex.iterators()

        final Map<Vertex, Integer> deserializedMap = (Map<Vertex, Integer>) response.getResult().getData();
        assertEquals(1, deserializedMap.size());

        final Vertex deserializedMarko = deserializedMap.keySet().iterator().next();
        assertEquals("marko", deserializedMarko.iterators().valueIterator("name").next().toString());
        assertEquals(1, deserializedMarko.id());
        assertEquals(Vertex.DEFAULT_LABEL, deserializedMarko.label());
        assertEquals(new Integer(29), (Integer) deserializedMarko.iterators().valueIterator("age").next());
        assertEquals(2, StreamFactory.stream(deserializedMarko.iterators().propertyIterator()).count());
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.Vertex.iterators()

        final Vertex deserializedMarko = deserializedMap.keySet().iterator().next();
        assertEquals("marko", deserializedMarko.iterators().valueIterator("name").next().toString());
        assertEquals(1, deserializedMarko.id());
        assertEquals(Vertex.DEFAULT_LABEL, deserializedMarko.label());
        assertEquals(new Integer(29), (Integer) deserializedMarko.iterators().valueIterator("age").next());
        assertEquals(2, StreamFactory.stream(deserializedMarko.iterators().propertyIterator()).count());

        assertEquals(new Integer(1000), deserializedMap.values().iterator().next());
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.Vertex.iterators()

        final Vertex deserializedMarko = deserializedMap.keySet().iterator().next();
        assertEquals("marko", deserializedMarko.iterators().valueIterator("name").next().toString());
        assertEquals(1, deserializedMarko.id());
        assertEquals(Vertex.DEFAULT_LABEL, deserializedMarko.label());
        assertEquals(new Integer(29), (Integer) deserializedMarko.iterators().valueIterator("age").next());
        assertEquals(2, StreamFactory.stream(deserializedMarko.iterators().propertyIterator()).count());

        assertEquals(new Integer(1000), deserializedMap.values().iterator().next());
    }

    @Test
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.Vertex.iterators()

    @Test
    @LoadGraphWith(LoadGraphWith.GraphData.CREW)
    public void shouldDetachMultiPropertiesAndMetaProperties() {
        final Vertex v1 = convertToVertex(g, "marko");
        v1.iterators().propertyIterator("location").forEachRemaining(vp -> {
            final DetachedVertexProperty detached = DetachedVertexProperty.detach(vp);
            if (detached.value().equals("san diego")) {
                assertEquals(1997, (int) detached.value("startTime"));
                assertEquals(2001, (int) detached.value("endTime"));
                assertEquals(2, (int) StreamFactory.stream(detached.iterators().propertyIterator()).count());
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.Vertex.iterators()

    public void shouldExecuteScriptInSessionOnTransactionalGraph() throws Exception {
        final Cluster cluster = Cluster.build().create();
        final Client client = cluster.connect(name.getMethodName());

        final Vertex vertexBeforeTx = client.submit("v=g.addVertex(\"name\",\"stephen\")").all().get().get(0).getVertex();
        assertEquals("stephen", vertexBeforeTx.iterators().valueIterator("name").next());

        final Vertex vertexFromV = client.submit("g.V().next()").all().get().get(0).getVertex();
        assertEquals("stephen", vertexFromV.iterators().valueIterator("name").next());

        final Vertex vertexFromBinding = client.submit("v").all().get().get(0).getVertex();
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.