Hello!
I want to query Sparksee to get the friends of friends of a given person(P). From the friends of friends, I want to remove people who are already friends with P.
These are the steps that I have taken:
1) Get the friends of P
Objects friends = g.neighbors(nodeP, friendType, EdgesDirection.Outgoing);
2) Get the fof of U
Objects fof= g.explode(friends, friendType, EdgesDirection.Outgoing);
Here I use the explode since I need to perform an aggregate on the friends of friends, hence I cannot use the unique object identifiers returned by g.neighbors.
3) Now I need to remove friends from fof
it = fof.iterator();
while (it.hasNext())
{
long x=it.next();
EdgeData d=g.getEdgeData(x);
l=d.getHead();
if(friends.exists(l))
fof.remove(x);
}
This throws an exception:
An ObjectsIterator can't be used after it's Objects parent is closed or modified
What seems to be the problem here?
Also, ideally, it would be better to iterate the 'friends' instead of 'fof' and remove any objects, if it exists in fof. But I'm not sure how I can do this.
These are the two methods I can think of, please suggest alternate methods (if any) that will be more efficient.
Thanks!