Search in sources :

Example 1 with PipeFunction

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

the class BackStepTest method test_g_v4_out_asXhereX_filterXlang_eq_javaX_backXhereX_propertyXnameX.

public void test_g_v4_out_asXhereX_filterXlang_eq_javaX_backXhereX_propertyXnameX() {
    super.test_g_v4_out_asXhereX_filterXlang_eq_javaX_backXhereX_propertyXnameX(new GremlinPipeline(g.getVertex(4)).out().as("here").filter(new PipeFunction<Vertex, Boolean>() {

        public Boolean compute(Vertex v) {
            return v.getProperty("lang").equals("java");
        }
    }).back("here").property("name"));
    super.test_g_v4_out_asXhereX_filterXlang_eq_javaX_backXhereX_propertyXnameX(new GremlinPipeline(g.getVertex(4)).optimize(false).out().as("here").filter(new PipeFunction<Vertex, Boolean>() {

        public Boolean compute(Vertex v) {
            return v.getProperty("lang").equals("java");
        }
    }).back("here").property("name"));
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) GremlinPipeline(com.tinkerpop.gremlin.java.GremlinPipeline) PipeFunction(com.tinkerpop.pipes.PipeFunction)

Example 2 with PipeFunction

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

the class FilterStepTest method test_g_v1_out_filterXage_gt_30X.

public void test_g_v1_out_filterXage_gt_30X() {
    super.test_g_v1_out_filterXage_gt_30X(new GremlinPipeline(g.getVertex(1)).out().filter(new PipeFunction<Vertex, Boolean>() {

        public Boolean compute(Vertex vertex) {
            Integer age = (Integer) vertex.getProperty("age");
            return age != null && age > 30;
        }
    }));
    super.test_g_v1_out_filterXage_gt_30X(new GremlinPipeline(g.getVertex(1)).optimize(false).out().filter(new PipeFunction<Vertex, Boolean>() {

        public Boolean compute(Vertex vertex) {
            Integer age = (Integer) vertex.getProperty("age");
            return age != null && age > 30;
        }
    }));
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) GremlinPipeline(com.tinkerpop.gremlin.java.GremlinPipeline) PipeFunction(com.tinkerpop.pipes.PipeFunction)

Example 3 with PipeFunction

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

the class GroupByStepTest method test_g_V_groupByXlang_nameX.

public void test_g_V_groupByXlang_nameX() {
    Map<?, List<?>> m = new HashMap<Object, List<?>>();
    super.test_g_V_groupByXlang_nameX(new GremlinPipeline(g.getVertices()).groupBy(m, new PipeFunction<Vertex, String>() {

        public String compute(Vertex vertex) {
            return (String) vertex.getProperty("lang");
        }
    }, new PipeFunction<Vertex, String>() {

        public String compute(Vertex vertex) {
            return (String) vertex.getProperty("name");
        }
    }), (Map) m);
    m = new HashMap<Object, List<?>>();
    super.test_g_V_groupByXlang_nameX(new GremlinPipeline(g.getVertices()).optimize(false).groupBy(m, new PipeFunction<Vertex, String>() {

        public String compute(Vertex vertex) {
            return (String) vertex.getProperty("lang");
        }
    }, new PipeFunction<Vertex, String>() {

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

Example 4 with PipeFunction

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

the class SelectStepTest method test_g_v1_asXaX_outXknowsX_asXbX_selectXnameX.

public void test_g_v1_asXaX_outXknowsX_asXbX_selectXnameX() {
    super.test_g_v1_asXaX_outXknowsX_asXbX_selectXnameX(new GremlinPipeline(g.getVertex(1)).as("a").out("knows").as("b").select(new PipeFunction<Vertex, String>() {

        public String compute(Vertex vertex) {
            return (String) vertex.getProperty("name");
        }
    }));
    super.test_g_v1_asXaX_outXknowsX_asXbX_selectXnameX(new GremlinPipeline(g.getVertex(1)).optimize(false).as("a").out("knows").as("b").select(new PipeFunction<Vertex, String>() {

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

Example 5 with PipeFunction

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

the class PathStepTest method test_g_v1_out_pathXage__nameX.

public void test_g_v1_out_pathXage__nameX() {
    super.test_g_v1_out_pathXage__nameX(new GremlinPipeline(g.getVertex(1)).out().path(new PipeFunction<Vertex, Integer>() {

        public Integer compute(Vertex vertex) {
            return (Integer) vertex.getProperty("age");
        }
    }, new PipeFunction<Vertex, String>() {

        public String compute(Vertex vertex) {
            return (String) vertex.getProperty("name");
        }
    }));
    super.test_g_v1_out_pathXage__nameX(new GremlinPipeline(g.getVertex(1)).optimize(false).out().path(new PipeFunction<Vertex, Integer>() {

        public Integer compute(Vertex vertex) {
            return (Integer) vertex.getProperty("age");
        }
    }, new PipeFunction<Vertex, String>() {

        public String compute(Vertex vertex) {
            return (String) vertex.getProperty("name");
        }
    }));
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) GremlinPipeline(com.tinkerpop.gremlin.java.GremlinPipeline) 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