Search in sources :

Example 16 with PipeFunction

use of com.tinkerpop.pipes.PipeFunction in project gremlin by tinkerpop.

the class GatherStepTest method test_g_v1_out_gatherXget0X.

public void test_g_v1_out_gatherXget0X(final Pipe<Vertex, Vertex> pipe) {
    super.test_g_v1_out_gatherXget0X(new GremlinPipeline(g.getVertex(1)).out().gather(new PipeFunction<List, Vertex>() {

        public Vertex compute(List argument) {
            return (Vertex) argument.get(0);
        }
    }));
    super.test_g_v1_out_gatherXget0X(new GremlinPipeline(g.getVertex(1)).optimize(false).out().gather(new PipeFunction<List, Vertex>() {

        public Vertex compute(List argument) {
            return (Vertex) argument.get(0);
        }
    }));
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) GremlinPipeline(com.tinkerpop.gremlin.java.GremlinPipeline) PipeFunction(com.tinkerpop.pipes.PipeFunction) List(java.util.List)

Example 17 with PipeFunction

use of com.tinkerpop.pipes.PipeFunction in project gremlin by tinkerpop.

the class GroupCountStepTest method test_g_V_outXcreatedX_groupCountXm__nameX.

public void test_g_V_outXcreatedX_groupCountXm__nameX() {
    Map<String, Number> m = new HashMap<String, Number>();
    super.test_g_V_outXcreatedX_groupCountXm__nameX(new GremlinPipeline(g.getVertices()).out("created").groupCount(m, new PipeFunction<Vertex, String>() {

        public String compute(Vertex vertex) {
            return (String) vertex.getProperty("name");
        }
    }), m);
    m = new HashMap<String, Number>();
    super.test_g_V_outXcreatedX_groupCountXm__nameX(new GremlinPipeline(g).optimize(false).V().out("created").groupCount(m, new PipeFunction<Vertex, String>() {

        public String compute(Vertex vertex) {
            return (String) vertex.getProperty("name");
        }
    }), m);
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) GremlinPipeline(com.tinkerpop.gremlin.java.GremlinPipeline) HashMap(java.util.HashMap) PipeFunction(com.tinkerpop.pipes.PipeFunction)

Aggregations

PipeFunction (com.tinkerpop.pipes.PipeFunction)17 GremlinPipeline (com.tinkerpop.gremlin.java.GremlinPipeline)13 Vertex (com.tinkerpop.blueprints.Vertex)11 VertexWrapper (org.apache.atlas.catalog.VertexWrapper)5 Projection (org.apache.atlas.catalog.projection.Projection)4 ProjectionResult (org.apache.atlas.catalog.projection.ProjectionResult)4 ResourceComparator (org.apache.atlas.catalog.ResourceComparator)3 HashMap (java.util.HashMap)2 List (java.util.List)2 TermPath (org.apache.atlas.catalog.TermPath)2 Edge (com.tinkerpop.blueprints.Edge)1 TermVertexWrapper (org.apache.atlas.catalog.TermVertexWrapper)1