Here is my simple code:
g.addV('person').property('name', 'Mike').as('mike')
.addV('class').property('name', 'math').property('aval', 'true').as('math')
.addV('class').property('name', 'bio').property('aval', 'false').as('bio')
.addE('takes').from('mike').to('math').property('TA', 'true').property('Role', 'Admin')
.addE('takes').from('mike').to('bio').property('TA', 'false').property('Role', 'Help')
My query is:
g.V().hasLabel('person').limit(1).project('Takes').by(outE('takes').group().by().by(valueMap('Role', 'TA')))
Output:
[{
"Takes": {
"e[abf8c9fd-daec-4d12-a630-6f8903146349]080366ec-2fa1-4f30-9574-bb66cd70324f(person)-takes->db088937-bea1-4cd1-b6e8-193dff7f22ff(class)": {
"Role": "Admin",
"TA": "true"
},
"e[c22f0ae3-81bf-4ad5-a7f9-8f75db940cb8]080366ec-2fa1-4f30-9574-bb66cd70324f(person)-takes->db306807-7639-4000-b272-bbd5fef5e170(class)": {
"Role": "Help",
"TA": "false"
}
}
}]
But what i need is:
[{
"Takes": {
{
"Role": "Admin",
"TA": "true"
},
{
"Role": "Help",
"TA": "false"
}
}
}]
Basically i want to get properties from all 'takes' edges, project them as an array to 'Takes' property. I need to figure out how to get rid of the grouping header and just return an array of props.
Thanks.