@GremlinGroovy("it.as('x').both('playerActive').as('f').both('playerActive').except('x').except('f')")
public Iterable<PlayerPresenceGraphTitan> getFriendsOfFriends();
'playerActive' is just another word for friends.
And we have to make sure it doesn't return those that are already friends and ourselves.
Right now it is returning all friends and friends of friends, and I can't seem to get rid of the friends. (Heck I feel the same in real life too)
What am I missing, besides the original font I started typing this in?
Thanks
Mark
GremlinGroovy("it.as('x').both('playerActive').as('f').out('playerActive').except('x').except('f')")
And it got real close. Issue I had this time is that there is a friend of a friend that is currently a friend that was also added.
I have a workaround where I then use Groovy to deleteAll {} comparing to my friends. But requires two queries to Titan, one for the above gremlin query and one to return the user, then grab their friends. Actually I think that is three calls to the db. I'll use that for now till something better comes along.Thank Mark
@GremlinGroovy("it.as('x').both('playerActive').as('f').both('playerActive').except('f','x')")
--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/a8417003-ee47-45b0-8d41-2b50c032947d%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/2b3a8128-333e-411c-9cb3-af86ca731521%40googlegroups.com.
Nick. Right now I am using that query, and then have to remove all the direct friends from the results in code. But I would love to be able to get the correct results in just one gremlin query.Mark
--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/d17e0b29-da4c-42cc-abc2-33964351d255%40googlegroups.com.
v = g.v(1); x = [] as Set; v.both('playerActive').fill(x)._().both('playerActive').except(x + v)
v.both('playerActive').both('playerActive').except([v]).filter {!it.both('playerActive').retain([v]).hasNext()}
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/148b1942-8701-4fad-aa7a-23554c999b60%40googlegroups.com.
//friends
@Adjacency(label=PLAYER_ACTIVE, direction=Direction.BOTH)
public Iterable<PlayerPresenceGraphTitan> getActiveFriends();
@Adjacency(label=PLAYER_ACTIVE, direction=Direction.OUT)
public Iterable<PlayerPresenceGraphTitan> addFriend(PlayerPresenceGraphTitan player);
@Adjacency(label=PLAYER_ACTIVE, direction=Direction.OUT)
public Iterable<PlayerPresenceGraphTitan> removeFriend(PlayerPresenceGraphTitan player);
@GremlinGroovy("it.as('x').both('playerActive').as('y').out('playerActive').as('z').except('y').except('x').dedup()")
public Iterable<PlayerPresenceGraphTitan> getFriendsOfFriends();
data.removeAll {PlayerPresenceGraphTitan toRemove ->
user.activeFriends.contains(toRemove)
}
@GremlinGroovy("it.as('me').both('playerActive').as('firstDegree').out('playerActive').as('secondDegree').except('firstDegree').except('me')")
Thanks
Mark
--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/e3b06246-374a-4e9e-8a4e-983090912e7b%40googlegroups.com.
Also, I don't really understand why Nick's first solution - something like
v3.both().as("first").both().except("first")
doesn't actually remove the first order friends. Anyone?
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/8feaa03a-f907-4254-af21-3ba4290dd94d%40googlegroups.com.