Package com.tinkerpop.gremlin.structure

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


        @Test
        @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
        public void shouldReturnWrappedVertexPropertyToString() {
            final StrategyWrappedGraph swg = new StrategyWrappedGraph(g);
            final Vertex v1 = swg.addVertex(T.label, "Person", "age", "one");
            final VertexProperty age = v1.property("age");
            final Vertex originalVertex = ((StrategyWrappedVertex) v1).getBaseVertex();
            final VertexProperty originalVertexProperty = originalVertex.property("age");
            swg.getStrategy().setGraphStrategy(strategy);
            assertEquals(StringFactory.graphStrategyPropertyString(strategy, originalVertexProperty), age.toString());
        }
View Full Code Here


        public void shouldReturnWrappedVertexPropertyToString() {
            final StrategyWrappedGraph swg = new StrategyWrappedGraph(g);
            final Vertex v1 = swg.addVertex(T.label, "Person", "age", "one");
            final VertexProperty age = v1.property("age");
            final Vertex originalVertex = ((StrategyWrappedVertex) v1).getBaseVertex();
            final VertexProperty originalVertexProperty = originalVertex.property("age");
            swg.getStrategy().setGraphStrategy(strategy);
            assertEquals(StringFactory.graphStrategyPropertyString(strategy, originalVertexProperty), age.toString());
        }

        @Test
View Full Code Here

                public UnaryOperator<Supplier<Void>> getRemoveVertexStrategy(final Strategy.Context<StrategyWrappedVertex> ctx) {
                    return (t) -> () -> {
                        final Vertex v = ctx.getCurrent().getBaseVertex();
                        v.bothE().remove();
                        v.properties().forEachRemaining(Property::remove);
                        v.property("deleted", true);
                        return null;
                    };
                }
            });
View Full Code Here

            final Vertex toRemove = g.addVertex("name", "pieter");
            toRemove.addEdge("likes", g.addVertex("feature", "Strategy"));

            assertEquals(1, toRemove.properties().count().next().intValue());
            assertEquals(new Long(1), toRemove.bothE().count().next());
            assertFalse(toRemove.property("deleted").isPresent());

            swg.v(toRemove.id()).remove();

            final Vertex removed = g.v(toRemove.id());
            assertNotNull(removed);
View Full Code Here

            final Vertex removed = g.v(toRemove.id());
            assertNotNull(removed);
            assertEquals(1, removed.properties().count().next().intValue());
            assertEquals(new Long(0), removed.bothE().count().next());
            assertTrue(removed.property("deleted").isPresent());
        }

        @Test
        @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
        public void shouldNotCallBaseFunctionThusNotRemovingTheEdge() throws Exception {
View Full Code Here

    @Test
    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
    public void shouldNotAllowVertexPropertyRemoval() {
        final Vertex v = g.addVertex();
        v.property("test", "test");
        final Property<String> p = v.property("test");
        assertEquals("test", p.value());

        assertException(g -> {
            final VertexProperty<Object> prop = g.V().next().iterators().propertyIterator("test").next();
View Full Code Here

    @Test
    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
    public void shouldNotAllowVertexPropertyRemoval() {
        final Vertex v = g.addVertex();
        v.property("test", "test");
        final Property<String> p = v.property("test");
        assertEquals("test", p.value());

        assertException(g -> {
            final VertexProperty<Object> prop = g.V().next().iterators().propertyIterator("test").next();
            prop.remove();
View Full Code Here

        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
        public void shouldWrap() {
            final StrategyWrappedGraph swg = new StrategyWrappedGraph(g);
            swg.strategy.setGraphStrategy(GraphStrategy.DefaultGraphStrategy.INSTANCE);
            final Vertex v = swg.addVertex();
            final VertexProperty vp = v.property("property", "on-property", "food", "taco", Graph.Key.hide("food"), "burger", "more", "properties", Graph.Key.hide("more"), "hidden");

            final AtomicBoolean atLeastOne = new AtomicBoolean(false);
            assertTrue(streamGetter.apply(swg, vp).allMatch(p -> {
                atLeastOne.set(true);
                return p instanceof StrategyWrappedProperty;
View Full Code Here

                writer.write(NullWritable.get(), v);

                Vertex vertex = v.getBaseVertex();
                assertEquals(Integer.class, vertex.id().getClass());

                Object value = vertex.property("name");
                if (null != value && ((Property) value).value().equals("SUGAR MAGNOLIA")) {
                    foundKeyValue = true;
                    assertEquals(92, count(vertex.outE().toList()));
                    assertEquals(77, count(vertex.inE().toList()));
                }
View Full Code Here

    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
    public void shouldAppendPartitionToVertex() {
        final Vertex v = g.addVertex("any", "thing");

        assertNotNull(v);
        assertEquals("thing", v.property("any").value());
        assertEquals("A", v.property(partition).value());
    }

    @Test
    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
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.