Returns the nodes to open in order to display
all the listed resources to be visible

@param array $uris list of resources to show
@param core_kernel_classes_Class $rootNode root node of the tree
@return array array of the uris of the nodes to open
505846
public static function getNodesToOpen($uris, core_kernel_classes_Class $rootNode) {
        // this array is in the form of
        // URI to test => array of uris that depend on the URI
        $toTest = array();
        foreach($uris as $uri){
            $resource = new core_kernel_classes_Resource($uri);
            foreach ($resource->getTypes() as $type) {
                $toTest[$type->getUri()] = array();
            }
        }
        $toOpen = array($rootNode->getUri());
        while (!empty($toTest)) {
            reset($toTest);
            $classUri = key($toTest);
            $depends = current($toTest);
            unset($toTest[$classUri]);
            if (in_array($classUri, $toOpen)) {
                $toOpen = array_merge($toOpen, $depends);
            } else {
                $class = new core_kernel_classes_Class($classUri);
                /** @var core_kernel_classes_Class $parent */
                foreach ($class->getParentClasses(false) as $parent) {
                    if ($parent->getUri() === OntologyRdfs::RDFS_CLASS) {
                        continue;
                    }
                    if (!isset($toTest[$parent->getUri()])) {
                        $toTest[$parent->getUri()] = array();
                    }
                    $toTest[$parent->getUri()] = array_merge(
                        $toTest[$parent->getUri()],
                        array($classUri),
                        $depends
                    );
                }
            }
        }
        return $toOpen;
    }
683391
function(rootNode, includeRoot) {
			var arr = null,
				out = [],
				classList = [],
				items,
				x,
				i,
				y,
				key;


			// build an array of v1 root names
			for(key in modules.maps) {
				if (modules.maps.hasOwnProperty(key)) {
					classList.push(modules.maps[key].root);
				}
			}

			// get all elements that have a class attribute
			includeRoot = (includeRoot) ? includeRoot : false;
			if(includeRoot && rootNode.parentNode) {
				arr = modules.domUtils.getNodesByAttribute(rootNode.parentNode, 'class');
			} else {
				arr = modules.domUtils.getNodesByAttribute(rootNode, 'class');
			}

			// loop elements that have a class attribute
			x = 0;
			i = arr.length;
			while(x < i) {

				items = modules.domUtils.getAttributeList(arr[x], 'class');

				// loop classes on an element
				y = items.length;
				while(y--) {
					// match v1 root names
					if(classList.indexOf(items[y]) > -1) {
						out.push(arr[x]);
						break;
					}

					// match v2 root name prefix
					if(modules.utils.startWith(items[y], 'h-')) {
						out.push(arr[x]);
						break;
					}
				}

				x++;
			}
			return out;
		}
1107884
protected function buildBlockViews($rootId)
    {
        /** @var BlockView[] $views */
        $views = [];

        // build the root view
        $rootView       = $this->buildBlockView($rootId);
        $views[$rootId] = $rootView;
        // build child views
        $iterator = $this->rawLayout->getHierarchyIterator($rootId);
        foreach ($iterator as $id) {
            $parentView = $views[$iterator->getParent()];

            // build child view
            $view                      = $this->buildBlockView($id, $parentView);
            $parentView->children[$id] = $view;
            $views[$id]                = $view;
        }

        $viewsCollection = new BlockViewCollection($views);
        foreach ($views as $view) {
            $view->blocks = $viewsCollection;
        }

        // finish the root view
        $this->finishBlockView($rootView, $rootId);
        // finish child views
        foreach ($iterator as $id) {
            $this->finishBlockView($views[$id], $id);
        }

        return $rootView;
    }
1086311
private function getResourceFromNode(ResourceNode $resourceNode)
    {
        /** @var AbstractResource $resource */
        $resource = $this->om
            ->getRepository($resourceNode->getClass())
            ->findOneBy(['resourceNode' => $resourceNode]);

        return $resource;
    }
787132
private function createPluginsNode(ArrayNodeDefinition $rootNode): void
    {
        $pluginsNode = $rootNode
            ->children()
                ->arrayNode('plugins')
                ->children();

        foreach ($this->plugins as $plugin) {
            $pluginNode = new ArrayNodeDefinition($plugin->getPluginName());
            $plugin->addConfiguration($pluginNode);

            $pluginsNode->append($pluginNode);
        }
    }
406705
protected function getTreeNodeStates()
    {
        $sessionStorage = $this->getEnvironment()->getSessionStorage();
        $openElements   = $sessionStorage->get($this->getToggleId());

        if (!\is_array($openElements)) {
            $openElements = [];
        }

        return new TreeNodeStates($openElements);
    }
133417
public function getDocument($document, $rootNode)
	{
		if ($rootNode == null)
		{
			$rootNode = "page";
		}
		return $this->_persistUtil->getDocument($document, $rootNode);
	}
583702
public static function findLeafNodes( $rootId, $config = [] ) {

		$conditions	= isset( $config[ 'conditions' ] ) ? $config[ 'conditions' ] : null;

		$modelClass	= static::$modelClass;
		$modelTable	= $modelClass::tableName();
		$query		= new Query();

		$query->select( 'id, name' );
		$query->from( $modelTable );
		$query->where( "rValue = lValue + 1 AND rootId=$rootId" );

		if( isset( $conditions ) && count( $conditions ) > 0 ) {

			$query->andWhere( $conditions );
		}

		// Create command
		$command = $query->createCommand();

		// Execute the command
		$list = $command->queryAll();

		return $list;
	}
565864
private function buildClassNode(core_kernel_classes_Class $class, core_kernel_classes_Class $parent = null)
    {
    	$label = $class->getLabel();
        $label = empty($label) ? __('no label') : $label;

        return array(
            'data' 	=> _dh($label),
            'type'	=> 'class',
            'attributes' => array(
                'id' => tao_helpers_Uri::encode($class->getUri()),
                'class' => 'node-class',
                'data-uri' => $class->getUri(),
                'data-classUri' => is_null($parent) ? null : $parent->getUri(),
                'data-signature' => $this->getSignatureGenerator()->generate($class->getUri()),
            )
        );
    }
594085
public function findRootPageByResourceNode(ResourceNode $resourceNode)
    {
        return $this->createQueryBuilder('page')
            ->leftJoin('page.website', 'website')
            ->leftJoin('website.resourceNode', 'resource')
            ->where('resource = :resourceNode')
            ->andWhere('page.type = :type')
            ->setParameter('resourceNode', $resourceNode)
            ->setParameter('type', 'root')
            ->getQuery()
            ->getSingleResult();
    }
801333
static RedisNodeDescription findNodeByUri(Collection<RedisNodeDescription> nodes, RedisURI lookupUri) {
        return findNodeByHostAndPort(nodes, lookupUri.getHost(), lookupUri.getPort());
    }
1244688
public function getTree()
    {
        $nodes = [];
        foreach ($this->nodes[$this->_config['rootid']]->getDescendants() as $subnode) {
            $nodes[] = $subnode;
        }
        return $nodes;
    }
238328
public function getLeaves($rootId = null): Collection
    {
        $list = $this->repo->pushCriteria(new GetLeaves($rootId))
            ->all([
                'id',
                'pid',
                'root_id',
                'deep',
                'name'
            ]);

        return $list;
    }
1194096
public static clusternode[] get(nitro_service service) throws Exception{
		clusternode obj = new clusternode();
		clusternode[] response = (clusternode[])obj.get_resources(service);
		return response;
	}
905117
protected static function buildTree(&$data, $rootID = 0)
    {
        $tree = [];

        foreach ($data as $id => $node) {
            if ($node->parentId == $rootID) {
                unset($data[$id]);
                $node->children = self::buildTree($data, $node->id);
                $tree[] = $node;
            }
        }

        return $tree;
    }
716955
public function getAllClasses(core_kernel_classes_Class $rootClass)
    {
        $result = [
            'uri'      => $rootClass->getUri(),
            'label'    => $rootClass->getLabel(),
            'children' => $this->getSubClasses($rootClass->getSubClasses(false))
        ];

        return $result;
    }
971423
public function findDomainRecordsByRootPagesIds(array $rootPageIds = [])
    {
        $resultTmp = $this->getDomainRecordsByRootPageIds($rootPageIds);

        $result = [];
        foreach ($resultTmp as $key => $row) {
            $result[$row['pid']] = $row;
        }
        return $result;
    }