Hi Andrea!
For the second case, you can use sorting on facets and then extract the first result using pagination. The query would look something like this.
{
currentSpouse(func: eq(name, "A")){
name
spouse @facets(orderdesc: until) (first:1) {
name
}
}
}
For more info about sorting on facets and paginations, please have a look at sorting using facets and pagination.