

def checkSBRNLMembers(val, hc, dim, domELR, rels, ELR, isDomMbr, members=None, ancestors=None):
    if (members is None):
        members = set()
    if (ancestors is None):
        ancestors = set()
    for rel in rels:
        relFrom = rel.fromModelObject
        relTo = rel.toModelObject
        if (isinstance(relFrom, ModelConcept) and isinstance(relTo, ModelConcept)):
            toELR = (rel.targetRole or rel.linkrole)
            if (isDomMbr or (not relTo.isAbstract)):
                if (relTo in members):
                    val.modelXbrl.relationshipSet(XbrlConst.all).toModelObject(hc)
                    if isDomMbr:
                        pass
                    else:
                        val.modelXbrl.error('SBR.NL.2.3.5.01', _('Primary items for hypercube %(hypercube)s ELR %(ELR)s, have non-unique (inheritance) member %(concept)s in DRS role %(linkrole)s'), modelObject=relTo, hypercube=hc.qname, ELR=domELR, concept=relTo.qname, linkrole=ELR)
                members.add(relTo)
            if (not isDomMbr):
                if ((relTo.isAbstract and (not relFrom.isAbstract)) or (relFrom.substitutionGroupQname.localName != 'primaryDomainItem')):
                    val.modelXbrl.error('SBR.NL.2.3.7.01', _('Primary item %(concept)s in DRS role %(linkrole)s for hypercube %(hypercube)s, has parent %(concept2)s which is not a primaryDomainItem'), modelObject=rel, concept=relTo.qname, linkrole=ELR, hypercube=hc.qname, concept2=relFrom.qname)
            if (relTo not in ancestors):
                ancestors.add(relTo)
                domMbrRels = val.modelXbrl.relationshipSet(XbrlConst.domainMember, toELR).fromModelObject(relTo)
                checkSBRNLMembers(val, hc, rel, domELR, domMbrRels, ELR, isDomMbr, members, ancestors)
                ancestors.discard(relTo)
    return False

dataset/ETHPy150Open Arelle/Arelle/arelle/ValidateFilingDimensions.py checkSBRNLMembers/VarMisuse@332/595 `dim`->`rel`