I have a Neptune database in AWS with the following graph:
So there's a user that organizes a party and has created two invitations. But the user has withdrawn one of these invitations.
I'm looking for a query to count the number of invitations that haven't been withdrawn (1 in the case above).
I've found a way to get the invitations (I'm using the Gremlin package for Javascript):
const result = await g
.V("user#123")
.inE().hasLabel("createdBy")
.otherV()
.toList();
But I can't seem to find anything to filter those invitations out that have been withdrawn. I don't think I can traverse to the edges that are not withdrawnBy
because that would still return 2 (because we have a createdBy
and a withdrawnBy
edge).
Anyone have any pointers? I've found this answer, which recommends:
gremlin> g.V.filter{!it.bothE('knows').hasNext()}
This is Groovy I assume, but I'm using Javascript (Typescript actually). I've tried the .filter()
function, but this seems to throw an error:
.filter(function(this: any) {
return !this.bothE("isRevokedBy");
})