Fix assignment of IDs to multiple relations when one of them is empty an...

...d add test for it (and in general for ID assignment)
Can `groundingPath` be an empty string? If so, this command is a bit dangerous to me. Probably we could validate it's not empty when we set `groundingPath`?