2016-04-15 69 views
1

我在这有来电通知边缘如下用户顶点:如何在使用Gremlin的Titan中获取边界日期属性大于上次访问日期的通知?

代码正在使用得到通知

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

您的代码表明您正在使用TinkerPop 2.x.我强烈建议改用TinkerPop 3+,这是一个更强大的API的完整重写。 – jbmusso

回答

3

PostedDate看来是作为字符串返回的。考虑在模式定义中将PostedDate定义为Long,然后将T.gteLong的值进行比较。

+0

我是否需要删除以前的测试数据,或者它会工作,如果我只是添加另一个属性作为PostedDateLong与现有属性? –

+1

先走一步,试试吧 –

+0

我添加了一个边缘具有以下属性 类型:WallPostNotification PostedDate:2016-04-15T15:01:21.1012501Z PostedDateLong:635963292811012501 NotificationInitiatedByVertexId:17928960 _id:c7lmo-1S0-SGL -aoetc gEhas('PostedDateLong',T.gte,0) –

相关问题