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;
    }
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;
    }
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 ; }
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
Returns the nodes to open in order to display all the listed resources to be visible