Gremlin date properties filter 针对日期的properties进行过滤
Gremlin date properties filter
针对gremlin语法中如果需要针对日期的properties进行过滤
案例
如果一个图中的边有个属性time,是date类型。然后给定一个时间范围,需要过滤出时间范围内的边
gremlin语法
g.E().has('time',between('2020-01-19 00:00:00','2020-01-20 00:00:00'))).values('time')
输入上面的语法的话会报错:
Value [2020/01/19 00:00:00] is not an instance of the expected data type for property key [time] and cannot be converted. Expected: class java.util.Date, found: class java.lang.String
因此需要将上面的日期类型从string转为date
正确的gremlin语法如下
g.E().has('time',between(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse('2020-01-19 00:00:00'),new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse('2020-01-20 00: