如何使用Gremlin在Titan中获取边缘日期属性大于上次访问日期的通知?

时间:2016-04-15 10:53:32

标签: graph titan edge gremlin rexster

我的用户顶点具有传入的通知边缘,如下所示:

代码用于获取通知

g.v(17929472).outE('Notification')

我得到的回应:

{
  "success": true,
  "results": [
    {
      "Type": "UserReaction",
      "PostedDate": "2016-04-15T09:03:42.8391677Z",
      "NotificationInitiatedByVertexId": "2304",
      "_id": "c7bb4-aoagw-sgl-aoao0",
      "_type": "edge",
      "_outV": 17929472,
      "_inV": 17929728,
      "_label": "Notification"
    }
  ],
  "version": "2.5.0",
  "queryTime": 15.310751
}

每当用户查看通知时,我都会保存上次查看的日期,并希望使用该日期获取该日期之后的所有通知。

我试过了:

g.v((5124096).outE).outE.has('PostedDate',T.gte, 2016-04-15T07:52:31.6979843Z).inV

但它给出了错误。

1 个答案:

答案 0 :(得分:3)

PostedDate似乎以字符串形式返回。请考虑将架构定义中的PostedDate定义为Long,然后与T.gte值进行Long比较。