0

I am new Gremlin and having trouble with filtering by property.

A -> B

Assume A and B are vertices and has edge between them with properties Created_on and deleted_on.

deleted_on property will be added only at the time of deletion.

How list by the edge property?

g.V(id).outE('Label').has('deleted_on', lt(timestamp.now())).outV().elementMap()

The above query returns empty, because the deleted_on property is not added to the edge yet.

How to handle this?

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
Thirumal
  • 8,280
  • 11
  • 53
  • 103

1 Answers1

1

I'm not completely sure but I think you are looking to find all connections where the deleted_on property is less than now or it does not exist. If that is the case then you can use the or() and hasNot() steps in Gremlin to accomplish this similar to the query below.

g.V(id).
  outE('Label').
  has('deleted_on', lt(timestamp.now())).
  or().
  hasNot('deleted_on').
  outV().
  elementMap()
bechbd
  • 6,206
  • 3
  • 28
  • 47