Hello,
> I am trying my best to understand the deifference between: Pipe, Pipeline, GremlinPipeline and how to print the results for each if possible.
Pipe: a "mini function" that can be chained together with other Pipes to do some larger function.
Pipeline: a chain of Pipes with lots of extra helper methods beyond the Pipes interface.
GremlinPipeline: a fluent-pipeline representation for doing graph traversals + whatever is in Pipes.
Note that Pipes (
http://pipes.tinkerpop.com) has nothing to do with graphs. Gremlin (
http://gremlin.tinkerpop.com) adds "graph pipes" to Pipes. As such, Pipes is a general purpose dataflow framework.
> Code composed from examples:
> IndexableGraph g = TinkerGraphFactory.createTinkerGraph();
> GremlinPipeline pipe = new GremlinPipeline(g.getVertex(1)).out("knows");
> System.out.println("Vertex Count: " + pipe.count());
>
> This works fine, I used GremlinPipeline, becuase that's what I saw in the example.
> How do I go about printing the names in output as:
>
> Marko knows: (hopefully both values from the graph and not hardcoded, so that later I can also try all outer edges)
> Name: Josh, 32
> Name: Vadas, 27
Do this:
List results = new GremlinPipeline(g.getVertex(1)).out("knows").property("name").toList()
System.out.println(results) // non-lazy evaluation model
-or-
for(String name : new GremlinPipeline<Vertex,String>(g.getVertex(1)).out("knows").property("name")) {
System.out.println(name); // lazy evaluation model
}
You might have to fuggle with typing, but that is the basic idea.
HTH,
Marko.
http://markorodriguez.com