2016-04-15 33 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) –

相關問題