Hi, I just want a way to do a filter based on the normalized result that I got from a subquery
{
ID as q(func:has(Person))@normalize{
_LinkedTo {
_LinkedTo {
~_IsBy @filter(has(A))(orderasc:created,first:1) {
WT : created
}
}
}
~_LinkedTo {
~_IsFor @filter(has(A))(orderasc:created,first:1){
RT : created
}
}
uid
}
p(func:uid(ID)) @filter((has(WT) AND NOT has(RT)) OR (gt(RT, WT))) {
P : uid
expand(_all_)
}
}
query q will return a result like this
"q": [
{
"uid": "0x7"
},
{
"uid": "0x8"
},
{
"RT": "2017-02-08T07:11:59Z",
"WT": "2017-01-10T13:31:39Z",
"uid": "0xa"
},
{
"uid": "0x17"
},
{
"uid": "0x1c"
},
{
"uid": "0x22"
},
{
"uid": "0x2d"
},
{
"uid": "0x2e"
},
{
"RT": "2015-10-14T20:42:26Z",
"WT": "2016-06-09T12:33:58Z",
"uid": "0x34"
},
{
"RT": "2016-10-23T11:08:33Z",
"uid": "0x35"
},
{
"WT": "2016-09-01T11:25:21Z",
"uid": "0x3e"
}]
And what I want to do for query p is that based on q’s result, I want to find all the record that either only have WT or RT>WT.
WT and RT are in datetime format, as well as created.
and I got this error while running the query
: Got error: parsing time “writeTime” as “2006”: cannot parse “writeTime” as “2006” while running: name:“gt” args:"writeTime"
Wondering what would the query be like?