access the appropriate child entity_types for a particular parent or parent entity_type
 @param [Taxonomy::Node, String] parent the parent object or entity_type string
 @return [Array] an array of strings which are the valid child types for the child
488164
def valid_child_types(parent)
      # could be a node object, or maybe a string
      str = parent.respond_to?(:entity_type) ? parent.entity_type : child
      self.down_taxonomy[str]
    end
728050
function parent($new = null, $return_entity = false)
    {
        if (isset($new)){
            if ($new instanceof Entity){
                $this->_parent = $new;
                $new = $new->uri();
            }else{
                $this->_parent = null; // for reloading
            }
            if ($new != $this->_attributes['parent']){
                $this->change('parent', $new);
                $this->change('order', Entity::MAX_ORDER);
                $this->change('uri', $new.'/'.$this->_attributes['name']);
            }
        }
        if ($return_entity){
            if (!isset($this->_parent)){
                if (isset($this->_attributes['parent'])){
                    $this->_parent = Data::read($this->_attributes['parent']);
                }else{
                    $this->_parent = false;
                }
            }
            return $this->_parent;
        }
        return $this->_attributes['parent'];
    }
329600
def get_children(engine, parent_ids, rank='species', schema=None):
    

    if not parent_ids:
        return []

    nodes = schema + '.nodes' if schema else 'nodes'
    names = schema + '.names' if schema else 'names'

    cmd = ('select tax_id, tax_name, rank '
           'from {} join {} using (tax_id) '
           'where parent_id = :tax_id and is_primary').format(nodes, names)

    species = []
    for parent_id in parent_ids:
        result = engine.execute(sqlalchemy.sql.text(cmd), tax_id=parent_id)
        keys = list(result.keys())
        rows = [dict(list(zip(keys, row))) for row in result.fetchall()]
        for r in rows:
            if r['rank'] == rank and 'sp.' not in r['tax_name']:
                species.append(r)
        others = [r for r in rows if r['rank'] not in (rank, 'no_rank')]
        if others:
            _, s = get_children(engine, [r['tax_id'] for r in others])
            species.extend(s)

    return keys, species
892500
def get_parent_ids(self):
        
        id_list = []
        from ..id.objects import IdList
        for parent_node in self._my_map['parentNodes']:
            id_list.append(str(parent_node.ident))
        return IdList(id_list)
1004372
def get_parent_id(self, resource, document):
        
        parent_type = self._get_parent_type(resource)
        if parent_type and document:
            return document.get(parent_type.get('field'))

        return None
446531
def only_child(of_type)
      lambda do |element|
        # Element must be inside parent element.
        return false unless element.parent and element.parent.tag?
        name = of_type ? element.name : nil
        other = false
        for child in element.parent.children
          # Skip text nodes/comments.
          if child.tag? and (name == nil or child.name == name)
            unless child.equal?(element)
              other = true
              break
            end
          end
        end
        !other
      end
    end
1037416
function parents() {
                var parent = void 0,
                    path = [];

                while (!!(parent = el.parentNode)) {
                    path.push(parent);
                    el = parent;
                }

                return path;
            }
676665
def ancestors
        a = Array.new
        self.parent._ancestors(a) unless self.parent.nil?
        return a
    end
120780
def doctype(parent, indent)
      return unless accept :doctype

      buffer = accept(:line_feed)

      parent[@children] << [:doctype, buffer.strip.to_sym, {}, nil, indent]
    end
539907
def pbt_parent
      val = pbt
      if val && !pbt_id.nil?
        if poly?
          "#{pbt_type}".constantize.where(id: pbt_id).first
        else
          "#{val}".camelize.constantize.where(id: pbt_id).first
        end
      end
    end
771876
def get_parent_tags(self, rev=None):
		
		try:
			parent_rev = one(self.get_parent_revs(rev))
		except Exception:
			return None
		return self.get_tags(parent_rev)
92869
def _indexed_leafs(parent):
    
    if not parent.get('children'):
        return {parent['nodeid']: parent}
    indexed = {}
    for child in parent['children']:
        child['parent'] = parent
        if 'leaf' in child:
            indexed[child['nodeid']] = child
        else:
            indexed.update(_indexed_leafs(child))
    parent['leaf'] = _parent_value(parent['children'])
    return indexed
897748
function(type) {
			var result = this.spirit.element.parentNode;
			if (type) {
				var spirit = result.spirit;
				if (spirit && spirit instanceof type) {
					result = spirit;
				} else {
					result = null;
				}
			}
			return result;
		}
31669
def parent_models
      models.group_by(&:table_name).each_value.map do |models|
        models.min_by { |model| models.include?(model.superclass) ? 1 : 0 }
      end
    end
875705
function isParentNodeType(parent, nodeType) {
            return parent.type === nodeType ||
                (parent.body && parent.body.type === nodeType) ||
                (parent.consequent && parent.consequent.type === nodeType);
        }
255515
private function getParentAndChildrenEntities() {
        $parentEntities = array();
        $childrenEntities = array();
        foreach($this->getModelBuilder()->getRelationships() as $relationship) {
            if($relationship->isPlural()) {
                $parentEntities[] = $relationship->getAlias() . '.*';
            } else {
                $childrenEntities[] = $relationship->getAlias() . '.*';
            }
        }

        return array($parentEntities, $childrenEntities);
    }
849568
def parents(self, node):
        """"""
        return [
            parent for parent in
            getattr( node, 'parents', [] )
            if getattr(parent, 'tree', self.TREE) == self.TREE
        ]