Create a parent-child relationship.
559472
def pclink(self, parent, child):
    """"""
    if parent._children is None:
      parent._children = set()
    if child._parents is None:
      child._parents = set()
    parent._children.add(child)
    child._parents.add(parent)
570627
private void setParent(DepTreeNode parent) {
		if (this.name.length() == 0) {
			// A child node must have a name.
			throw new IllegalStateException();
		}
		this.parent = new WeakReference<DepTreeNode>(parent);
	}
290102
def build_record
      record = model.new
      record.send("#{parent_association.name}=", parent_record) if parent_record
      record.build_defaults if record.respond_to?(:build_defaults)
      record
    end
1372094
public function addRelationshipsInParents()
    {
        $options = config('generators.settings');
        if (!$options['model']) {
            $this->info('Model files not found.');

            return;
        }

        $modelSettings = $options['model'];

        // model names
        $modelOne = $this->getModelName($this->argument('tableOne'));
        $modelTwo = $this->getModelName($this->argument('tableTwo'));

        // model path
        $modelOnePath = $modelSettings['path'] . $modelOne . '.php';
        $modelTwoPath = $modelSettings['path'] . $modelTwo . '.php';

        $this->addRelationshipInModel($modelOnePath, $modelTwo, $this->argument('tableTwo'));
        $this->addRelationshipInModel($modelTwoPath, $modelOne, $this->argument('tableOne'));
    }
869466
def parent(self, key):
        """"""
        parent_key = '.'.join(key.split('.')[:-1])
        if not parent_key:
            return None
        else:
            return self[parent_key]
248590
def parent(self, resource):
        
        resource.check()
        self['parent_type'] = resource.type
        self['parent_uuid'] = resource.uuid
4410
void setParent (Context2 parent)
    {
        this.parent = parent;
        parent.child = this;        // JJK: Doubly-linked
        declarations = null;
        prefixTable = parent.prefixTable;
        uriTable = parent.uriTable;
        elementNameTable = parent.elementNameTable;
        attributeNameTable = parent.attributeNameTable;
        defaultNS = parent.defaultNS;
        tablesDirty = false;
    }
1294911
def _create_child(self, tag):
        """"""
        return etree.SubElement(self._root, self._get_namespace_tag(tag))
1150502
def create_model(self, parent, name, multiplicity=Multiplicity.ZERO_MANY):
        
        return self._client.create_model(parent, name, multiplicity=multiplicity)
148550
public void createTypeAssociations() {
		// Connect the child to the parent rtype and interface rtypes
		ClassLoader classLoader = getClazz().getClassLoader();
		if (classLoader == null) {
			return;
		}
		ReloadableType srtype = getSuperRtype();
		if (srtype != null) {
			srtype.recordSubtype(this);
		}
		ReloadableType[] irtypes = getInterfacesRtypes();
		if (irtypes != null) {
			for (ReloadableType irtype : irtypes) {
				irtype.recordSubtype(this);
			}
		}
	}
552027
def __add_parent_relation(self, element, element_id, segment_type, parent_segment_type):
        
        relname = element.attrib['relname'] # name of RST relation or 'span'
        reltype = self.relations.get(relname, '') # 'span', 'multinuc' or ''

        parent_id = self.ns+':'+element.attrib['parent']

        if parent_segment_type:
            parent_attrs = {self.ns+':rel_name': relname,
                            self.ns+':segment_type': parent_segment_type}
        else: # e.g. if the parent is a root node of a multinuc, we don't
              # know what its segment type is
            parent_attrs = {self.ns+':rel_name': relname}

        if parent_id not in self:
            self.add_node(parent_id, layers={self.ns}, attr_dict=parent_attrs)
        else:
            if segment_type != 'span':
                self.node[parent_id].update(parent_attrs)

        if segment_type == 'span':
            edge_type = EdgeTypes.spanning_relation
        else:
            edge_type = EdgeTypes.dominance_relation

        rel_attrs = {self.ns+':rel_name': relname, self.ns+':rel_type': reltype,
                     'label': self.ns+':'+relname}
        self.add_edge(parent_id, element_id, layers={self.ns},
                      attr_dict=rel_attrs, edge_type=edge_type)
578528
def save(self, parent=None):
        
        if self.id:
            return self.update(parent=parent)
        else:
            return self.create(parent=parent)
909824
def add_parent(self, parent):
        
        parent.add_child(self)
        self.parent = parent
        return parent
459797
def make_polyamorous_inner_joins(parent, child)
      tables    = child.tables
      join_type = child.join_type || Arel::Nodes::InnerJoin
      info      = make_constraints parent, child, tables, join_type

      info + child.children.flat_map { |c|
        make_polyamorous_inner_joins(child, c)
      }
    end
1356172
def gen_parents(parents):
    """"""
    for idx, parent in enumerate(parents):
        if isinstance(parent, Interface):
            parent = parent.id
        elif isinstance(parent, int):
            pass
        else:
            raise TypeError(
                'parent[%d] must be an Interface or int, not %s' % (
                    idx, type(parent).__name__))
        yield parent
491189
def fill_parentidid2obj_r1(self, id2obj_user, child_obj):
        """"""
        for higher_obj in self._getobjs_higher(child_obj):
            if higher_obj.item_id not in id2obj_user:
                id2obj_user[higher_obj.item_id] = higher_obj
                self.fill_parentidid2obj_r1(id2obj_user, higher_obj)
164834
def inherit(self, parent):
        """"""
        if self._parent == parent:
            return
        if self._parent:
            self._parent.release_all(self._parent_changed)
        self_values = {key: self._container[key] for key in self._own_keys}
        self._container = {**parent.to_dictionary(), **self_values}
        self._parent = parent
        self._parent.observe_all(self._parent_changed)