Question: how to create a "where without" clause?
See original GitHub issueHello!
First wanted to thank you on creating this library, itās been super helpful as Iāve been starting to explore graph databases.
I currently have the following relationships set up:
User
- Follows
-> User
Iām trying to create a Recommendations query to grab a list of recommended Users
that Follows
Users
that the Current User
directly Follows
. So essentially User
vertices that are two-hops away on the Follows
edge.
However, I want to exclude the current User
from that list as well as any Users
that the Current User
directly Follows
(anything one-hop away on the Follows
edge)
I found within the tinkerpop documentation for Recommendations how to achieve this and was able to get the desired result with the following query (http://tinkerpop.apache.org/docs/current/recipes/#recommendation):
g.V().has('id', '{user_id}').as('self').out('Follows').aggregate('direct-follows').out('Follows').where(neq('self')).where(without('direct-follows'))
Trying to use Gremlinq, I came up with the following:
await _g
.V<User>(userId)
.As((_, self) => _
.Out<Follows>()
.Aggregate((__, directFollows) => __
.Out<Follows>()
.OfType<User>()
.Where(x => x != self
&& !directFollows.Contains(x)))) // How to exclude directFollows?
.OfType<User>()
.ToArrayAsync();
which works up until the directFollows.Contains(x)
expression in which case it returns the ExpressionNotSupportedException.
Iāve been able to replicate it by combining the results of two separate queries but that seems inefficient:
Is this the correct way to approach this or is there a better way? Or is this functionality just not yet supported?
Thanks š
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Worked as expected with the original query as expected! Thank you š
Well, it should work as intendedā¦will investigate in a couple of days.