edited ri query for checking multiple parents to resources