Using sack in has step

29 views
Skip to first unread message

Rajesh Paudel

unread,
Nov 14, 2022, 12:39:31 PM11/14/22
to Gremlin-users
Hi,
I am trying a simple query with sack which looks like
```
g.withSack('somevalue').V().outE().has('property1', sack())
```

This does not return data that equals to some value now if you use predicates in similar way. Take example
```
g.withSack(['somevalue1', 'somevalue2']).V().outE().has('property1', within(sack()))

g.withSack(['somevalue1', 'somevalue2']).V().outE().has('property1', within(sack().unfold()))
```
None of the above provide you with correct property. I am using neptune and performing similar query, I have attached screenshot for further elaboration
sack.png

Is there some other correct way to do this? I was trying to use sack to determine next traversal that it should go to.  Is there any other way to do this? Suppose this case
```
g.withSack('').V().where(....).repeat(
    choose(
        loops().is(0),
        outE().sack(assign).by(values('SESSION_ID')).inV(),
        outE().has('SESSION_ID', sack()).inV(),
     )
)
.until(
      outE().has('PLACE', 'somewhere').has('SESSION_ID', sack()).count().is(0)
)
.path()
```
That is where I want to use sack to determine where it should stop and where it should add value.


```
Reply all
Reply to author
Forward
0 new messages