If the taxa are being cached, this call will create a the lineage "spike" for taxon child_taxon

        Expecting child_taxon to have a non-empty _taxonomic_lineage with response dicts that can create
            an ancestral TaxonWrapper.
160707
def get_cached_parent_for_taxon(self, child_taxon):
        
        if self._ott_id2taxon is None:
            resp = child_taxon._taxonomic_lineage[0]
            tl = child_taxon._taxonomic_lineage[1:]
            assert 'taxonomic_lineage' not in resp
            resp['taxonomic_lineage'] = tl
            return TaxonWrapper(taxonomy=child_taxon.taxonomy,
                                taxomachine_wrapper=self._wr,
                                prop_dict=resp)  # TODO recursive (indirectly)
        else:
            anc = []
            prev = None
            for resp in reversed(child_taxon._taxonomic_lineage):
                ott_id = resp['ot:ottId']
                curr = self._ott_id2taxon.get(ott_id)
                if curr is None:
                    assert 'taxonomic_lineage' not in resp
                    assert 'parent' not in resp
                    resp['parent'] = prev
                    resp['taxonomic_lineage'] = anc
                    curr = TaxonWrapper(taxonomy=child_taxon.taxonomy,
                                        taxomachine_wrapper=self._wr,
                                        prop_dict=resp)
                elif curr._parent is None and prev is not None:
                    curr._parent = prev
                prev = curr
                anc.insert(0, curr)
            return prev
466700
function (src, destId, next, parent) {
            var oldId = src.id;
            src.parent = destId;

            async.waterfall([
                async.apply(_getAncestorsFromImmediateParent, destId, parent),
                function saveNodesAncestors(newAncestors, next) {
                    src.ancestors = newAncestors;
                    src._id = new ObjectId();
                    pendingInsertNodes.push(src);
                    async.parallel([
                            function findContentEntries(next) {
                                contentModel.find({"meta.node": oldId}).exec(function (err, data) {
                                    if (err) {
                                        next(err);
                                    }
                                    else {
                                        next(null, data);
                                    }
                                });
                            },
                            function findNodeEntries(next) {
                                nodeModel.find({parent: oldId}).exec(function (err, data) {
                                    if (err) {
                                        next(err);
                                    }
                                    else {
                                        next(null, data);
                                    }
                                });
                            }
                        ],
                        function handleFoundContentAndNodes(err, data) {
                            var contentEntries = data[0], nodeEntries = data[1];
                            _.each(contentEntries, function (item) {
                                item.meta.node = src._id;
                                item._id = new ObjectId();
                                pendingInsertContent.push(item);
                            });
                            if (!nodeEntries.length) {
                                next();
                            }
                            else {
                                async.each(nodeEntries, function (item, next) {
                                    _recursiveCopyNodes(item, src._id, next, src);
                                }, function (err) {
                                    next(err);
                                });
                            }
                        });

                }
            ], function (err) {
                next(err);
            });
        }
913637
function _addNewEntries(treeData, added) {
        added.forEach(function (filePath) {
            var isFolder = _.last(filePath) === "/";

            filePath = isFolder ? filePath.substr(0, filePath.length - 1) : filePath;

            var parentPath = FileUtils.getDirectoryPath(filePath),
                parentObjectPath = _filePathToObjectPath(treeData, parentPath),
                basename = FileUtils.getBaseName(filePath);

            if (parentObjectPath) {
                // Verify that the children are loaded
                var childrenPath = _.clone(parentObjectPath);
                childrenPath.push("children");
                if (treeData.getIn(childrenPath) === null) {
                    return;
                }

                treeData = _createPlaceholder(treeData, parentPath, basename, isFolder, {
                    notInCreateMode: true,
                    doNotOpen: true
                });
            }
        });

        return treeData;
    }
78918
def build(self, name):
        ""
        if isinstance(name, basestring):
            type = self.resolver.find(name)
            if type is None:
                raise TypeNotFound(name)
        else:
            type = name
        cls = type.name
        if type.mixed():
            data = Factory.property(cls)
        else:
            data = Factory.object(cls)
        resolved = type.resolve()
        md = data.__metadata__
        md.sxtype = resolved
        md.ordering = self.ordering(resolved)
        history = []
        self.add_attributes(data, resolved)
        for child, ancestry in type.children():
            if self.skip_child(child, ancestry):
                continue
            self.process(data, child, history[:])
        return data
316041
def _slice(self, level):
        ''''''
        if level >= len(self.taxonomy):
            raise IndexError('Level greater than size of taxonomy')
        res = []
        for ident in sorted(list(self.keys())):
            res.append((self[ident]['taxref'], self[ident]['lineage'][level]))
        return res
511634
def process(self, data, type, history):
        
        if type in history:
            return
        if type.enum():
            return
        history.append(type)
        resolved = type.resolve()
        value = None
        if type.multi_occurrence():
            value = []
        else:
            if len(resolved) > 0:
                if resolved.mixed():
                    value = Factory.property(resolved.name)
                    md = value.__metadata__
                    md.sxtype = resolved
                else:
                    value = Factory.object(resolved.name)
                    md = value.__metadata__
                    md.sxtype = resolved
                    md.ordering = self.ordering(resolved)
        setattr(data, type.name, value)
        if value is not None:
            data = value
        if not isinstance(data, list):
            self.add_attributes(data, resolved)
            for child, ancestry in resolved.children():
                if self.skip_child(child, ancestry):
                    continue
                self.process(data, child, history[:])
969753
def inheritanceTree(self):
        
        inherits = self.inherits()
        while inherits:
            ischema = orb.system.schema(inherits)
            if not ischema:
                raise orb.errors.ModelNotFound(schema=inherits)

            yield ischema
            inherits = ischema.inherits()
457994
def addTaxonToFeature(self, taxonid):
        
        self.taxon = taxonid
        self.graph.addTriple(self.fid, self.globaltt['in taxon'], self.taxon)

        return
702024
def ancestors(self):
        
        if self.parent is not None:
            yield self.parent
            for ancestor in self.parent.ancestors():
                yield ancestor
350335
function(data) {
			// parse basic info from the dom item
			var item = {
				link: data.id,
				text: data.textContent || data.innerText,
				parent: ''
			};

			// build type identifier
			var level = data.tagName;
			for (var i = 0; i < data.classList.length; i++) {
				level += ',' + data.classList[i];
			}

			// here be dragons
			var stacksize = stack.length;
			if (stacksize === 0) {
				// we are at the top level and will stay there
				stack.push(level);
			} else if (level !== stack[stacksize - 1]) {
				// traverse the ancestry, looking for a match
				for (var j = stacksize - 1; j >= 0; j--) {
					if (level == stack[j]) {
						break; // found an ancestor
					}
				}
				if (j < 0) {
					// this is a new submenu item, lets push the stack
					stack.push(level);
					item.push = true;
					parentstack.push(lastitem);
				} else {
					// we are either a sibling or higher up the tree,
					// lets pop the stack if needed
					item.pop = stacksize - 1 - j;
					while (stack.length > j + 1) {
						stack.pop();
						parentstack.pop();
					}
				}
			}

			// if we have a parent, lets record it
			if(parentstack.length > 0) {
				item.parent= parentstack[parentstack.length-1];
			}

			// for next iteration
			lastitem= item.link;
			return item;
		}
101966
private void doCreateResource(Request request) throws ResourceAlreadyExistsException {
        typeSystem.createEntity(resourceDefinition, request);
        taxonomyAutoInitializationChecked = true;
    }
1210019
def get_proxy_ancestor_classes(klass):
    
    proxy_ancestor_classes = set()
    for superclass in klass.__bases__:
        if hasattr(superclass, '_meta') and superclass._meta.proxy:
            proxy_ancestor_classes.add(superclass)
        proxy_ancestor_classes.update(
            get_proxy_ancestor_classes(superclass))
    return proxy_ancestor_classes
764820
def _build_cache():
    """"""
    query = current_app.config['COLLECTIONS_DELETED_RECORDS']
    for collection in Collection.query.filter(
            Collection.dbquery.isnot(None)).all():
        yield collection.name, dict(
            query=query.format(dbquery=collection.dbquery),
            ancestors=set(_ancestors(collection)),
        )
    raise StopIteration
1298529
def add_child(self, tree):
        '''
        '''
        tree.parent = self
        self.children.append(tree)
        return tree
1300481
def extend_children(self, parent, wanted_children, child_class, child_glossary=None):
        
        from cms.api import add_plugin
        current_children = parent.get_num_children()
        for _ in range(current_children, wanted_children):
            child = add_plugin(parent.placeholder, child_class, parent.language, target=parent)
            if isinstance(child_glossary, dict):
                child.glossary.update(child_glossary)
            child.save()
28980
def prepopulate(self, queryset):
        
        objs = list(queryset)
        hashobjs = dict([(x.pk, x) for x in objs] + [(self.pk, self)])
        for descendant in hashobjs.values():
            descendant._cached_children = []
        for descendant in objs:
            assert descendant._closure_parent_pk in hashobjs
            parent = hashobjs[descendant._closure_parent_pk]
            parent._cached_children.append(descendant)
905506
private synchronized void loadExistingData() {
        for (ChildData childData : _pathCache.getCurrentData()) {
            addNode(childData.getPath(), parseChildData(childData));
        }
    }