1

graph image

enter code here
(Query to find owner)
.inE().hasLabel('OwnedBy').outV().not(inE().hasLabel('AssignedTo').has('Status', 'InUse'))
.not(
inE()
.hasLabel('AssignedTo')
.has('Status', 'InUse')
).as('cards')

.inE()
.hasLabel('AssignedTo')
.has('Status', 'FutureUse')
.as('OwnedByRequestEdges')

.outV()
.as('OwnedByRequests')

.Select('card', 'OwnedByRequests', 'OwnedByRequestEdges', 'Owner')

I really want it to give me a list of the cards and the list of the requests.

I user can have multiple cards and cards can have multiple future reservations.

Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
HDatom
  • 21
  • 6
  • Pictures are nice, but could you please provide a Gremlin script that creates some sample data - here is an example https://stackoverflow.com/questions/51388315/gremlin-choose-one-item-at-random – stephen mallette Aug 09 '19 at 10:27

1 Answers1

0

In order to store all the values during traversal, you should use "store" and not "as".

Since you want the "select" to run once, you need to add fold() before it.

There was a redundant "not" filter (same filter).

(Query to find owner)
.inE().hasLabel('OwnedBy').outV()
.not(inE().hasLabel('AssignedTo').has('Status','InUse'))
.store('Cards')
.inE().hasLabel('AssignedTo').has('Status', 'FutureUse').outV()
.store('OwnedByRequests')
.fold()
.select('Cards', 'OwnedByRequests')
Kfir Dadosh
  • 1,411
  • 9
  • 9