Determine whether a relation is established by checking for
    presence of key(s).  If a list of keys is provided, they
    must all be present for the relation to be identified as made
195974
def is_relation_made(relation, keys='private-address'):
    '''
    
    '''
    if isinstance(keys, str):
        keys = [keys]
    for r_id in relation_ids(relation):
        for unit in related_units(r_id):
            context = {}
            for k in keys:
                context[k] = relation_get(k, rid=r_id,
                                          unit=unit)
            if None not in context.values():
                return True
    return False
53068
def _assert_keys_match(keys1, keys2):
  """"""
  if set(keys1) != set(keys2):
    raise ValueError('{} {}'.format(list(keys1), list(keys2)))
907838
protected function checkForRelationsAttributes($key) {
    try {
      $key = $this->$key();
    } catch (\BadMethodCallException $e) {
      return false;
    }

    return is_subclass_of($key, $this->eloquent_relation_class);
  }
712083
def has_key(self, key):
        """"""
        k = self._lowerOrReturn(key)
        return k in self.data
550769
function(keys) {
    var missingRelations = [];
    var relationKeys = this.relationDefinitions ? Object.keys(this.relationDefinitions) : [];
    _.each(keys, function(key) {
      var isRelation = relationKeys.indexOf(key) > -1;
      if (isRelation && _.isUndefined(this.get(key))) {
        missingRelations.push(key);
      }
    }, this);
    return _.uniq(missingRelations);
  }
1112784
function containsRelationships(query) {
  let contains = false;
  if (query.predicate instanceof SimplePredicate || query.predicate instanceof StringPredicate || query.predicate instanceof DatePredicate) {
    contains = Information.parseAttributePath(query.predicate.attributePath).length > 1;
  }

  if (query.predicate instanceof DetailPredicate) {
    return true;
  }

  if (query.predicate instanceof ComplexPredicate) {
    query.predicate.predicates.forEach((predicate) => {
      if (containsRelationships({ predicate })) {
        contains = true;
      }
    });
  }

  if (query.order) {
    for (let i = 0; i < query.order.length; i++) {
      let attributePath = query.order.attribute(i).name;
      if (Information.parseAttributePath(attributePath).length > 1) {
        contains = true;
      }
    }
  }

  return contains;
}
1005484
def has_key(self, key):
        
        self.is_a(Mapping)
        self.contains(key)
        return KeyInspector(self._subject[key])
539826
public boolean containsKey(List<K> key) {
    //     if(! (key instanceof Object[]))
    //       return false;
    //    Object[] o = (Object[]) key;
    GeneralizedCounter<K> next = this;
    for (int i=0; i<key.size()-1; i++) {
      next = next.conditionalizeHelper(key.get(i));
      if (next==null) return false;
    }
    return next.map.containsKey(key.get(key.size()-1));
  }
1335367
def _has(self, key, exact=0):
        """"""
        if not exact:
            key = self.getfullkey(key,new=1)
        return key in self.data
554174
private boolean checkIfKeyExists(String key)
    {
        if (aggregationsKeySet == null)
        {
            aggregationsKeySet = new HashSet<String>();
        }
        return aggregationsKeySet.add(key);
    }
880952
public boolean isUnary()
    {
        return type.equals(Relation.ForeignKey.ONE_TO_ONE) || type.equals(Relation.ForeignKey.MANY_TO_ONE);
    }
1053442
private Boolean constraintsExistsForRelationship(String type, List<String> propertyNames) {
        Schema schema = db.schema();

        for (ConstraintDefinition constraintDefinition : Iterables.asList(schema.getConstraints(RelationshipType.withName(type)))) {
            List<String> properties = Iterables.asList(constraintDefinition.getPropertyKeys());

            if (properties.equals(propertyNames)) {
                return true;
            }
        }

        return false;
    }
655370
def check_key(self, key: str) -> bool:
        
        keys = self.get_keys()
        return key in keys
1066303
private boolean isKnownRelation(JSONArray relations, JsonObject newRelation) {
		// Does it have an OID? Highest priority. Avoids infinite loops
		// between ReDBox collections pointing at each other, so strict
		if (newRelation.containsKey("oid")) {
			for (Object relation : relations) {
				JsonObject json = (JsonObject) relation;
				String knownOid = (String) json.get("oid");
				String newOid = (String) newRelation.get("oid");
				// Do they match?
				if (knownOid.equals(newOid)) {
					log.debug("Known ReDBox linkage '{}'", knownOid);
					return true;
				}
			}
			return false;
		}

		// Mint records we are less strict about and happy
		// to allow multiple links in differing fields.
		for (Object relation : relations) {
			JsonObject json = (JsonObject) relation;

			if (json.containsKey("identifier")) {
				String knownId = (String) json.get("identifier");
				String knownField = (String) json.get("field");
				String newId = (String) newRelation.get("identifier");
				String newField = (String) newRelation.get("field");
				// And does the ID match?
				if (knownId.equals(newId) && knownField.equals(newField)) {
					return true;
				}
			}
		}
		// No match found
		return false;
	}
5613
def _is_related(parent_entry, child_entry):
        ''''''
        if parent_entry.header.mft_record == child_entry.header.base_record_ref and \
           parent_entry.header.seq_number == child_entry.header.base_record_seq:
            return True
        else:
            return False
794652
function initRelations (args) {
    // create map of relations
    this.relations = {}
    // get relations from args
    var relations = requireValidOptionalObject(args.relations)
    // validate and add relations
    _.each(relations, (relation, relatedModelName) => {
        this.relations[relatedModelName] = relation
    })
}
1272501
private function initRelations() {
    if ($this->relations == null) {
      $this->relations = [];
      $this->relations['all'] = array_values($this->getRelationDescriptions());
      $this->relations['parent'] = [];
      $this->relations['child'] = [];
      $this->relations['undefined'] = [];
      $this->relations['nm'] = [];

      foreach ($this->relations['all'] as $relation) {
        $hierarchyType = $relation->getHierarchyType();
        $hierarchyKey = $hierarchyType == 'parent' || $hierarchyType == 'child' ?
                $hierarchyType : 'undefined';
        $this->relations[$hierarchyKey][] = $relation;

        // also store relations to many to many objects, because
        // they would be invisible otherwise
        if ($relation instanceof RDBManyToManyRelationDescription) {
          $nmRelation = $relation->getThisEndRelation();
          $this->relations['nm'][$nmRelation->getOtherRole()] = $nmRelation;
        }
      }
    }
  }