You can treat the referenced object like a boolean in Xpath. For example, let's say you only want to select User entities that have at least one UserRole associated. You would select System.User as your entity, and the XPath constraint would look like this:
[System.UserRoles/System.UserRole]