[
{
'students':[
{
'id': 'student-1',
'name': 'john'
'subjects': [
{'id': 'subject-1', 'sequence': 1},
{'id': 'subject-2', 'sequence': 2 }
]
},
// more students and subjects here
]
}
]
query = g.V().hasLabel("student").match( __.as('stu').id().as('id'), __.as_('stu').coalesce(__.values('name'),constant('')).as('name'), __.as_('stu').union( __.outE('has_subject').match( __.as('stu-rel').inV().id().as('subject_id'), __.as_('stu-rel').coalesce(__.values('sequence'),constant('')).as('sequence') ).select('subject_id', 'sequence') ).fold().as('subjects')).select('id', 'name', 'subjects')
g.V().hasLabel("student").project("id","name","subjects").by(id).by("name").by(outE("has_subject").project("id","sequence").by(inV().id()).by("sequence").fold())
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/8540e4a9-418f-4f63-927d-5f1c570baa23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
g.V().hasLabel("student").
project("id","name","teacher").
by(id).
by("name").
by(in("teaches").
project("name").
by("name").
fold())
g.V().hasLabel("student").
project("id","name","subjects").
by(id).
by("name").
by(out("has_subject").
project("level").
by("level").
fold())
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/4bfaeda6-9006-494f-b576-11177111e11a%40googlegroups.com.
Sometimes Getting Started docs are really worth a look.