Recursive function which checks if a relation is valid.
167605
def check_relations(self, relations):
        """"""
        for rel in relations:
            if not rel:
                continue
            fields = rel.split('.', 1)

            local_field = fields[0]
            if local_field not in self.fields:
                raise ValueError('Unknown field "{}"'.format(local_field))

            field = self.fields[local_field]
            if not isinstance(field, BaseRelationship):
                raise ValueError('Can only include relationships. "{}" is a "{}"'
                                 .format(field.name, field.__class__.__name__))

            field.include_data = True
            if len(fields) > 1:
                field.schema.check_relations(fields[1:])
1354269
private Collection<? extends String> recursiveCollect(String refId,
      Map<String, SortedSet<String>> relationKeyMap, int maxRecursion) {
    Set<String> list = new HashSet<>();
    if (maxRecursion > 0 && relationKeyMap.containsKey(refId)) {
      SortedSet<String> subList = relationKeyMap.get(refId);
      for (String subRefId : subList) {
        list.add(subRefId);
        list.addAll(
            recursiveCollect(subRefId, relationKeyMap, maxRecursion - 1));
      }
    }
    return list;
  }
1302473
def is_relation_inverted(self, relation):
        
        return (
            relation in self._deinversions or
            (relation.endswith('-of') and relation not in self._inversions)
        )
423936
private void validateRelationType(RelationType relationType) {
        ValidateGlobalRules.validateHasMinimumRoles(relationType).ifPresent(errorsFound::add);
        errorsFound.addAll(ValidateGlobalRules.validateRelationTypesToRolesSchema(relationType));
    }
177815
def assert_valid(self, instance, value=None):
        """"""
        valid = super(Instance, self).assert_valid(instance, value)
        if not valid:
            return False
        if value is None:
            value = instance._get(self.name)
        if isinstance(value, HasProperties):
            value.validate()
        return True
206244
def _validated(self, data):
        """"""
        errors = []
        for sub in self.schemas:
            try:
                return sub(data)
            except NotValid as ex:
                errors.extend(ex.args)

        raise NotValid(' and '.join(errors))
381123
def _validate_relations(relations, services, add_error):
    
    if not relations:
        return
    for relation in relations:
        if not islist(relation):
            add_error('relation {} is malformed'.format(relation))
            continue
        relation_str = ' -> '.join('{}'.format(i) for i in relation)
        for endpoint in relation:
            if not isstring(endpoint):
                add_error(
                    'relation {} has malformed endpoint {}'
                    ''.format(relation_str, endpoint))
                continue
            try:
                service, _ = endpoint.split(':')
            except ValueError:
                service = endpoint
            if service not in services:
                add_error(
                    'relation {} endpoint {} refers to a non-existent service '
                    '{}'.format(relation_str, endpoint, service))
874905
def relations_of_type(reltype=None):
    """"""
    relation_data = []
    reltype = reltype or relation_type()
    for relid in relation_ids(reltype):
        for relation in relations_for_id(relid):
            relation['__relid__'] = relid
            relation_data.append(relation)
    return relation_data
220142
def match_relations(self, el, relation):
        """"""

        found = False

        if relation[0].rel_type.startswith(':'):
            found = self.match_future_relations(el, relation)
        else:
            found = self.match_past_relations(el, relation)

        return found
1288626
def _freeze_relations(self, relations):
        """"""

        if relations:
            sel = relations[0]
            sel.relations.extend(relations[1:])
            return ct.SelectorList([sel.freeze()])
        else:
            return ct.SelectorList()
1252661
public function hasRelatedErrors($relationName = null)
    {
        if ($relationName === null) {
            foreach ($this->_relatedErrors as $errors) {
                if (!empty($errors)) {
                    return true;
                }
            }
            return false;
        } else {
            return !empty($this->_relatedErrors[$relationName]);
        }
    }
1228279
def Validate(self):
    """"""
    if len(self.RECURSION_REGEX.findall(self._value)) > 1:
      raise ValueError("Only one ** is permitted per path: %s." % self._value)
237958
function recursiveIssuer(module) {
  if (module.issuer) {
    return recursiveIssuer(module.issuer);
  }
  else if (module.name) {
    return module.name;
  }
  else {
    return false;
  }
}
1207998
def valid_anytype(val):
    
    for validator in VALIDATOR.values():
        if validator == valid_anytype:  # To hinder recursion
            continue
        try:
            if validator(val):
                return True
        except NotValid:
            pass

    if isinstance(val, type):
        return True

    raise NotValid("AnyType")
1319446
def infer_child_relations(graph, node: BaseEntity) -> List[str]:
    """"""
    return list(_infer_child_relations_iter(graph, node))
136697
public function is_valid() {
        $ret = false ;

        if (parent::is_valid() === true) {
            if (is_null($this->id) === false && is_null($this->logicalConnectorWithNext) === false &&
                is_null($this->negation) === false && is_null($this->groupedWith) === false
            ) {
                $ret = true;
            }
        }

        return $ret;
    }
1101445
def validate(self):
        """"""

        for key, req in self.stored().items():
            val = getattr(self, key)
            req.validate(val)

        # Run checks defined in __checkers__
        self._run_checks()