How to get notifications that have Edge date property greater than last visited date in Titan using Gremlin? - graph

I'm having user vertices which have incoming Notification edges as follows:
code am using to get notifications
g.v(17929472).outE('Notification')
Response I'm getting :
{
"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
}
Whenever user view the notification i'm saving the last seen date and want to use that date to get all notification that is present after that date.
I've tried :
g.v((5124096).outE).outE.has('PostedDate',T.gte, 2016-04-15T07:52:31.6979843Z).inV
but it is giving error.

PostedDate appears to be returned as a String. Consider defining PostedDate in your schema definition as a Long instead, and then do the T.gte comparison with a Long value.

Related

Firestore Pagination : how to set Cursor for startAt using Rest Api

I'm using firebase firestore using Rest API to get data limited by 5 documents only, ordered by a field called LikesCount.
When I want to fetch the next 5 documents I have to use startAt and pass the LikesCount value of the last document from the first 5 documents.
But in this way, it will fetch wrong data when there is another document with the same LikesCount value So I tried and searched a lot about how to pass the last Document id in addition to the LikesCount value But all of them did not work In addition, I tested the pagination using the Web SDK and it was working correctly because you can pass the document snapshot easily, but what does the document snapshot object include? So that we can understand the structure of the Cursor and apply it to the REST API.
I tried to use this method to pass the Document ID as referenceValue
{
"structuredQuery": {
"from": [{
"collectionId": "Users"
}],
"where": {
"compositeFilter": {
"op": "AND",
"filters": []
}
},
"orderBy": [{
"field": {
"fieldPath": "LikesCount"
},
"direction": "DESCENDING"
}],
"startAt":
{ "values": [
{
"integerValue": "6"
},
{
"referenceValue": "projects/myprojectid/databases/(default)/documents/Posts/xEvmJ1LLHwTKVREQfXtX"
}
],
"before": false
},
"limit":5
}
}
But an error will occur : Cursor has too many values.
also, I tried to pass only the referenceValue and it still did not return the correct 5 documents.
Thanks in advance :)
Your orderBy() has 1 field (LikesCount) but your startAt() has 2 fields. I suspect that is the reason for the error message?
Passing the integerValue won't work. If there are 13 results with the value 6, then each time you make the above call you'd get the same first 5 results.
When you say:
I tried only passing the referenceValue and still did not get the correct 5 documents
what documents are you getting? What documents were you expecting to get?

Adding parameters to the POST Analyze method

https://westus2.dev.cognitive.microsoft.com/docs/services/form-recognizer-api/operations/AnalyzeWithCustomModel
In the above documentation there is the following URL which implies you ought to be able to analyze a form for a specific Key value
https://{endpoint}/formrecognizer/v1.0-preview/custom/models/{id}/analyze[?keys]
I have trained a model of my own and when I use the Get Keys method this is what gets returned...
{"clusters":{"0":["House Name","Mobile Number","Name","Phone Number","Postcode","Street","Sumame","Town Name","e-Mail Address (required)"]}}
It seems to me that I ought to be able to execute that post against any one of those key values. So....
https://{endpoint}/formrecognizer/v1.0-preview/custom/models/{id}/analyze?keys=Name
Should pull back whatever the value is associated with the Name key (and there is a value) but instead I get a 200 success and no workable information.
"status": "success",
"pages": [
{
"number": 1,
"height": 756,
"width": 471,
"clusterId": null,
"keyValuePairs": [],
"tables": []
}
],
"errors": []
}
I think I am misunderstanding how to do this properly
Are you able to see the key and an associated value when you try the /analyze call without the query param "keys"?

"Unexpected token } in JSON" (Firestore connecting through Zapier)

Attempting to hook up a trigger from Zapier when a Firestore document gets added, Zapier asks for an orderBy element. Documentation (https://zapier.com/help/firebase/#creating-a-firestore-structured-query-for-a-trigger) seems pretty straightforward, but I get an error that
ERROR: We had trouble finding a sample. The specified query does not contain valid JSON. Unexpected token } in JSON at position 123
I tried a couple of variations (see below for 2 examples), but I keep getting the same error each with a different position.
"orderBy": [{
"field": {
"fieldPath": "timestamp"
},
"direction": "DESCENDING"
}],
(Result: Position 123)
"orderBy": [{
"field": "timestamp,
"direction": "DESCENDING"
}],
(Result: Position 46)
I'm not even sure where Zapier is getting the JSON, so I can't look at the JSON to see if anything is funky.
Does anyone know how to fix, or at least how to view the full JSON file?
The issue is the trailing comma after the last ], which makes it invalid JSON.
Actually it's this one trailing comma, which renders the query invalid: ]},} - that should be ]}}.
The full JSON can usually be downloaded in the Firebase console; at least for Realtime Database.
And when it complains about JSON syntax, just use JSONLint; most IDE also highlight syntax errors.
According to Zapier documentation:
"orderBy": [{
"field": {
"fieldPath": "someKeyOfYourChoice"
},
"direction": "DESCENDING"
}]
This worked for me. There are more cases of troubleshooting, I highly suggest to check the site out if you still experiencing some issues:
https://zapier.com/help/doc/common-problems-firebase#creating-a-firestore-structured-query-for-a-trigger

Retrieving previously calculated route [HERE Maps] using RouteeId fails with RouteNotReconstructed error

I'm calculating routes based on user input. Then storing the routeId and any additional informations I need. But the shape of the road is something I need occasionally; when the user wants to get a preview of the road again.
Since I don't want to store all the points from shape I tried using getroute endpoint (https://developer.here.com/documentation/routing/topics/resource-get-route.html#resource-get-route) but I get this response:
{
"_type": "ns2:RoutingServiceErrorType",
"type": "ApplicationError",
"subtype": "RouteNotReconstructed",
"details": "Error is NGEO_ERROR_ROUTE_DESERIALIZATION",
"additionalData": [
{
"key": "error_code",
"value": "NGEO_ERROR_ROUTE_DESERIALIZATION"
}
],
"metaInfo": {
"timestamp": "2018-08-01T15:01:56Z",
"mapVersion": "8.30.86.150",
"moduleVersion": "7.2.201830-34436",
"interfaceVersion": "2.6.34",
"availableMapVersion": [
"8.30.86.150"
]
}
}
So the question is: why do I get the error? Following the API documentation https://developer.here.com/documentation/routing/topics/resource-type-error-route-not-reconstructed.html I can exclude wrong routeId (it works for routes saved e.g. today but not for the older ones).
The route was calculated using the same version (7.2)
Is the routeId stored only for a certain amount of time?
If so, how long?
RouteID changes with map version.
https://developer.here.com/documentation/routing/topics/request-route-information.html
You'd need to recalculate periodically to get up to date RouteIDs.

Adobe Analytics API - Real Time Classification

I need to get from Omniture real time API a classify eVar, exclude some value, and then breackdown its with sitesection.
I try with this query:
{
"reportDescription": {
"source": "realtime",
"reportSuiteID": "**RSID**", //MY REPORT SUITE
"metrics": [{
"id": "instances"
}],
"elements": [{
"id": "evar", //MY EVAR
"top": 100,
"classification": "Real Time", //CLASSIFICATION NAME
"search": {
"type": "NOT",
"keywords": ["somevalue"] //THE VALUE TO EXCLUDE
}
},{
"id" : "sitesection",
"top" : 1
}],
"dateGranularity": "minute:1",
"dateFrom": "-1 minute"
}
}
But in the JSON response I see "somevalue" how if it not excluded.
The strange thing is that if I remove the "breakdown" (with sitesection) the classification filter seems to works fine.
I can't use classification filter if a breackdown is used in real time report? I can't find any documentation about that.
An other thing is that if I request a report with the classification, without any search, I receve the response but there is a lot of "::Unspecified::". The problem is that the "::Unspecified::" seems to be the last datas that Omniture receves form my webpages. I think this means that classifications are not in real time, also if you can to use it in real time report.

Resources