abstract Gremlin question

34 views
Skip to first unread message

Adolfo Rodriguez

unread,
Oct 6, 2011, 11:32:02 AM10/6/11
to Gremlin-users
Hi, I am trying to customize a generic Java adapter running Gremlin
queries.

In my experience, I have just seen a bunch of Gremlin use cases, but I
am aware of my ignorance in probably many other use cases so I prefer
to post my question to Gremlin experts before guessing wrong general
rules.

Assuming all the umbrella of possible Gremlin functions (imagine a
kind of 'Gremlin's pipeline signature'):

1* what would be the possible outputs? As far as I understand, output
can be steps (at any position) and/or bound variables (as operators in
the pipeline). Is that correct?

2* how many output params can be defined in a single function? Is it
expected to have Gremlin functions with multiple outputs? Where are
them according to 1?

3* is possible to reduce all functions to a simple use case having the
output in the last pipeline? Is >>> considered an step?

Thanks, I am unable to figure out this responses as they require lot
of Gremlin experience.

Adolfo

Pierre De Wilde

unread,
Oct 6, 2011, 12:00:13 PM10/6/11
to gremli...@googlegroups.com

Hey,

By defining variables outside Gremlin statement and using multiples .sideEffect{}, you may use as many output variables as you want within Gremlin statement. Use last >>-1 to force last iteration.

Hth,

Pierre

Marko Rodriguez

unread,
Oct 6, 2011, 12:06:47 PM10/6/11
to gremli...@googlegroups.com
Hi,

By defining variables outside Gremlin statement and using multiples .sideEffect{}, you may use as many output variables as you want within Gremlin statement. Use last >>-1 to force last iteration.



Or you can use table and column functions.

Marko.

Marko Rodriguez

unread,
Oct 6, 2011, 12:10:31 PM10/6/11
to gremli...@googlegroups.com
Hello,

Assuming all the umbrella of possible Gremlin functions (imagine a
kind of 'Gremlin's pipeline signature'):

1* what would be the possible outputs? As far as I understand, output
can be steps (at any position) and/or bound variables (as operators in
the pipeline). Is that correct?

Yes. Using table()
Or, as Pierre said, setting external variables.


2* how many output params can be defined in a single function? Is it
expected to have Gremlin functions with multiple outputs? Where are
them according to 1?

You can have "multiple" outputs if its a List of objects that is returned.

3* is possible to reduce all functions to a simple use case having the
output in the last pipeline? Is >>> considered an step?

If you use table() you can cap() the table pipe to yield the sideEffect instead of the identity. Any SideEffectPipe has a method called getSideEffect(). If you "cap" (SideEffectCapPipe) then that pipe returns the side effect of the previous pipe... e.g.. table.cap >> 1 will return the Table.


Thanks, I am unable to figure out this responses as they require lot
of Gremlin experience.

Adolfo Rodriguez

unread,
Oct 6, 2011, 12:19:10 PM10/6/11
to Gremlin-users
Hello,

so, aggregating both responses, output can be:

* any bound variable (Map or List) at any step in the pipeline
(Pierre)

* any step (of those steps having output) itself at any position in
the pipeline (Marko)

This gives a pretty large number of cases to cover.

At the moment I am not able to figure out a subset of Gremlin
expressions, covering all functional requirements, and, at the same
time, narrowing down syntax to just a small set of cases. Kind of
synthesis. I do not think is possible.

Thanks for your inputs, I really needed them. I think I will revisit
this thread in future,

Adolfo

James Thornton

unread,
Oct 6, 2011, 1:03:58 PM10/6/11
to gremli...@googlegroups.com
> so, aggregating both responses, output can be: 
> * any bound variable (Map or List) at any step in the pipeline 
> * any step (of those steps having output) itself at any position in 
> the pipeline 

Output can be any Java/JVM construct, external queue, or datastore -- you're really not limited by much. You can output to Redis (https://groups.google.com/d/topic/gremlin-users/xhqP-0wIg5s/discussion), Memcached, Octobot, RabbitMQ, ZeroMQ... 

- James


Adolfo Rodriguez

unread,
Oct 6, 2011, 6:21:28 PM10/6/11
to Gremlin-users
Hi James, thanks for pointing out Redis and the other options.

After giving a thought, I came to the conclusion that, my problem or,
what I wanted to do, is not how to collect the different outputs from
the pipeline (as you suggest), but how should I declare the outputs in
the input call, so the Java adapter knows how to elaborate the
response.

Adolfo
Reply all
Reply to author
Forward
0 new messages