Package com.tinkerpop.gremlin.structure

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


            final JsonNode nodeLabel = json.get(GraphSONTokens._LABEL);
            final String label = nodeLabel == null ? EMPTY_STRING : nodeLabel.textValue();

            final Edge e = out.addEdge(label, in, T.id, edgeId);
            for (Map.Entry<String, Object> entry : props.entrySet()) {
                e.property(entry.getKey(), entry.getValue());
            }

            return e;
        }
View Full Code Here


                        readEdgeData(edgeData, detachedEdge -> {
                            final Vertex vOut = graph.v(detachedEdge.iterators().vertexIterator(Direction.OUT).next().id());
                            final Vertex vIn = graph.v(detachedEdge.iterators().vertexIterator(Direction.IN).next().id());
                            // batchgraph checks for edge id support and uses it if possible.
                            final Edge e = vOut.addEdge(edgeData.get(GraphSONTokens.LABEL).toString(), vIn, T.id, detachedEdge.id());
                            detachedEdge.iterators().propertyIterator().forEachRemaining(p -> e.<Object>property(p.key(), p.value()));
                            detachedEdge.iterators().hiddenPropertyIterator().forEachRemaining(p -> e.<Object>property(Graph.Key.hide(p.key()), p.value()));
                            return e;
                        });
                    }
                } else
View Full Code Here

                            final Vertex vOut = graph.v(detachedEdge.iterators().vertexIterator(Direction.OUT).next().id());
                            final Vertex vIn = graph.v(detachedEdge.iterators().vertexIterator(Direction.IN).next().id());
                            // batchgraph checks for edge id support and uses it if possible.
                            final Edge e = vOut.addEdge(edgeData.get(GraphSONTokens.LABEL).toString(), vIn, T.id, detachedEdge.id());
                            detachedEdge.iterators().propertyIterator().forEachRemaining(p -> e.<Object>property(p.key(), p.value()));
                            detachedEdge.iterators().hiddenPropertyIterator().forEachRemaining(p -> e.<Object>property(Graph.Key.hide(p.key()), p.value()));
                            return e;
                        });
                    }
                } else
                    throw new IllegalStateException(String.format("Unexpected token in GraphSON - %s", fieldName));
View Full Code Here

    public void serializeEdge() throws Exception {
        final Graph g = TinkerGraph.open();
        final Vertex v1 = g.addVertex();
        final Vertex v2 = g.addVertex();
        final Edge e = v1.addEdge("test", v2);
        e.property("abc", 123);

        final Iterable<Edge> iterable = g.E().toList();

        final ResponseMessage response = convert(iterable);
        assertCommon(response);
View Full Code Here

    public void serializeEdge() throws Exception {
        final Graph g = TinkerGraph.open();
        final Vertex v1 = g.addVertex();
        final Vertex v2 = g.addVertex();
        final Edge e = v1.addEdge("test", v2);
        e.property("abc", 123);

        final Iterable<Edge> iterable = g.E().toList();

        final ResponseMessage response = convert(iterable);
        assertCommon(response);
View Full Code Here

            final Vertex v = g.addVertex(T.id, "test", "something", "else");
            final Edge e = v.addEdge("self", v, T.id, "edge-id", "try", "this");
            tryCommit(g, c -> {
                assertNotNull(e);
                assertEquals("edge-id", e.id());
                assertFalse(e.property(strategy.getIdKey()).isPresent());
                assertEquals("this", e.property("try").value());

                final Edge found = g.e("edge-id");
                assertEquals("edge-id", found.id());
                assertFalse(found.property(strategy.getIdKey()).isPresent());
View Full Code Here

            final Edge e = v.addEdge("self", v, T.id, "edge-id", "try", "this");
            tryCommit(g, c -> {
                assertNotNull(e);
                assertEquals("edge-id", e.id());
                assertFalse(e.property(strategy.getIdKey()).isPresent());
                assertEquals("this", e.property("try").value());

                final Edge found = g.e("edge-id");
                assertEquals("edge-id", found.id());
                assertFalse(found.property(strategy.getIdKey()).isPresent());
                assertEquals("this", found.property("try").value());
View Full Code Here

                assertFalse(e.property(strategy.getIdKey()).isPresent());
                assertEquals("this", e.property("try").value());

                final Edge found = g.e("edge-id");
                assertEquals("edge-id", found.id());
                assertFalse(found.property(strategy.getIdKey()).isPresent());
                assertEquals("this", found.property("try").value());
            });
        }

        @Test
View Full Code Here

                assertEquals("this", e.property("try").value());

                final Edge found = g.e("edge-id");
                assertEquals("edge-id", found.id());
                assertFalse(found.property(strategy.getIdKey()).isPresent());
                assertEquals("this", found.property("try").value());
            });
        }

        @Test
        @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
View Full Code Here

            final Vertex v = g.addVertex(T.id, "test", "something", "else");
            final Edge e = v.addEdge("self", v, T.id, "edge-id", "try", "this", strategy.getIdKey(), "should be ok to set this as supportsEdgeId=false");
            tryCommit(g, c -> {
                assertNotNull(e);
                assertEquals("edge-id", e.id());
                assertEquals("this", e.property("try").value());
                assertEquals("should be ok to set this as supportsEdgeId=false", e.property(strategy.getIdKey()).value());

                final Edge found = g.e("edge-id");
                assertEquals("edge-id", found.id());
                assertEquals("this", found.property("try").value());
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.