Interesting, omsobj-query should work, but this was a rather long day for me, so maybe this hides the error.
Some ideas to debug:
num_users = metadata_getnobj("omsobj:Login?Login[AssociatedIdentity/Person[@Name = '&name']]", 1, uri);
Returns the number of login-objects for the person. Using your screenshot, should be 3 in your case.
You should check the number of logins in the auth-domain, too:
logins_in_domain = metadata_getnobj("omsobj:Login?Login[Domain/AuthenticationDomain[@Name = '&auth']]", 1, uri);
... View more