Graph 如何使用Gremlin获取边缘日期属性大于Titan中上次访问日期的通知?
我正在使用具有传入通知边的用户顶点,如下所示: 我用来获取通知的代码Graph 如何使用Gremlin获取边缘日期属性大于Titan中上次访问日期的通知?,graph,gremlin,titan,rexster,Graph,Gremlin,Titan,Rexster,我正在使用具有传入通知边的用户顶点,如下所示: 我用来获取通知的代码 g.v(17929472).outE('Notification') 我得到的答复是: { "success": true, "results": [ { "Type": "UserReaction", "PostedDate": "2016-04-15T09:03:42.8391677Z", "NotificationInitiatedByVertexId": "2304
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
但它给出了错误。
PostedDate
似乎作为字符串返回。考虑在schema定义中定义<代码> PoestDeDe>代码>作为<代码>长<代码>,然后将T.gte
与Long
值进行比较。我是否需要删除以前的测试数据,或者如果我只是将另一个属性作为PostedDateLong与现有属性一起添加,它是否会起作用?请继续尝试,我已经添加了一个具有以下属性类型的边缘:WallPostNotification PostedDate:2016-04-15T15:01:21.1012501Z PostedDateLong:635963292811012501通知由VertexID:17928960发起(u id:c7lmo-1s0-sgl-aoetc g.E.has('PostedDateLong',T.gte,0)但查询。。。g、 E.has('PostedDateLong',T.gte,0)正在返回空集。您的代码表明您正在使用TinkerPop 2.x。我强烈建议改为使用TinkerPop 3+,这是一个功能更强大的API的完全重写。