Is there any way to expand predicates only following with edges that has a specific facet value


(Lee Hui) #1

the reason i want to do this is to query a subgraph from the the whole graph according to the time the edge are formed.

for example, every predicates(edges) have a facet named “date”,

"_:Alice" <friend> "_:Bob"  (date=2019-05-02T13:01:09) .
"_:Alice" <mobile> "_:mobie1"  (date=2019-05-02T13:01:09) .
"_:Frank" <mobile> "_:mobie2"  (date=2019-05-02T13:01:09) .
"_:Alice" <mobile> "_:mobie2"  (date=2019-09-02T13:01:09) .

and then eapand edges from node “Alice”, and the expand only following edges that date<“2019-06-06”.
like:

q(func: eq(name,"Alice")){
    expand(@facets( lt(date, "2019-06-06") ))
}

what i want to return is:

q:[
{
  "name": "Alice",
   "friend": {
       "name": "Bob",
       "friend|date" :  "2019-05-02T13:01:09"
      }
   "mobile":{
       "name": "mobile1",
        "mobile|date" :  "2019-05-02T13:01:09"  
   }
}
]

when change date<"2019-06-06" to date<"2019-09-06", the result should be:

q:[
{
  "name": "Alice",
   "friend": {
       "name": "Bob",
       "friend|date" :  "2019-05-02T13:01:09"
      }
   "mobile":[
        {"name": "mobile1",
        "mobile|date" :  "2019-05-02T13:01:09"  },
        {"name": "mobile2",
        "mobile|date" :  "2019-09-02T13:01:09"  }      
   ]
}
]

Can this be implemented or there exist other way to get my goal.
Thanks for anybody who response.
Best.