Test for existence of facet on edge

Oops… I took that marriage example specifically (in which generally there is only one spouse).

You can have a look at assigning facet values to value . What you do is collect all the IDs with predicate spouse, then all predicate spouse with facet value and then filter it out. It would look like:

{
    var(func: eq(name, "A")){
    	allSpouse as spouse
  	}
  	var(func: eq(name, "A")){
      spouse @facets(pastSpouse as until)
    }
  
    currentSpouse(func: uid(allSpouse)) @filter(NOT uid(pastSpouse)){
      name
    }
}

Hope this will work for both the scenarios.

2 Likes