> and at some point I need return few values from query, for example record
id of b, c and d.
For this specific example you can use the path step, something like ".path{
it.getId() }
this should return [current_id, a_id, b_id, c_id, d_id] for each path.
if you need to edge and vertex data and have to process that data
differently, you can do something along the lines of
".path{ if (it.getElementType() == "Vertex") { [vertex stuff] } else {
[edge stuff] } }"
http://gremlindocs.com/#transform/path
If you are writing gremlin scripts and need even more complex processing,
you can use ".sideEffect{ }" to add data to a map or something as you go
traverse the path.
http://gremlindocs.com/#side-effect/sideeffect
On Thursday, April 23, 2015 at 4:39:34 AM UTC-7, Adrian Mihalcea wrote:
>
> Glad you asked. I have no answer though, just more (related) questions.
>
> I have been struggling with similar issue but using directly sql queries.
> My approach was to add to the projection list whatever details I wanted.
> for your example:
> a -> b -> c
>
> a query like:
> sql @this, out('a_to_b'), out('a_to_b').out('b_to_c') from a
>
> this seems to work until I got into other issues. Each element there can
> be a list, so naturally other questions appeared:
> - behavior seems to be: if one element, then return the element, else,
> return a list
> - cannot correlate between elements in the lists.
>
> my approach does not look right, so I'll be very happy with any new light
> on the matter.
>
> Thanks.
>
> On Thursday, April 23, 2015 at 1:12:56 PM UTC+3, [email protected] wrote:
>>
>> Hello. I have query like this:
>>
>> select GREMLIN("current.as('x').out('a_to_b').out('b_to_c').out('c_to_d')")
>> from a
>>
>> I have long string for gremlin, with filters etc.
>>
>> and at some point I need return few values from query, for example record
>> id of b, c and d.
>>
>> Is it possible?
>>
>>
>> Thanks.
>>
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.