Builds a tree of namespace subgraphs with their classes associated.
184744
protected function buildNamespaceTree(GraphVizGraph $graph, NamespaceDescriptor $namespace)
    {
        $full_namespace_name = (string) $namespace->getFullyQualifiedStructuralElementName();
        if ($full_namespace_name === '\\') {
            $full_namespace_name = 'Global';
        }

        $label = $namespace->getName() === '\\' ? 'Global' : $namespace->getName();
        $sub_graph = $this->createGraphForNamespace($full_namespace_name, $label);
        $this->namespaceCache[$full_namespace_name] = $sub_graph;

        $elements = array_merge(
            $namespace->getClasses()->getAll(),
            $namespace->getInterfaces()->getAll(),
            $namespace->getTraits()->getAll()
        );

        /** @var ClassDescriptor|InterfaceDescriptor|TraitDescriptor $sub_element */
        foreach ($elements as $sub_element) {
            $node = Node::create(
                (string) $sub_element->getFullyQualifiedStructuralElementName(),
                $sub_element->getName()
            )
                ->setShape('box')
                ->setFontName($this->nodeFont)
                ->setFontSize('11');

            if ($sub_element instanceof ClassDescriptor && $sub_element->isAbstract()) {
                $node->setLabel('<«abstract»<br/>' . $sub_element->getName() . '>');
            }

            //$full_name = $sub_element->getFullyQualifiedStructuralElementName();
            //$node->setURL($this->class_paths[$full_name]);
            //$node->setTarget('_parent');

            $this->nodeCache[(string) $sub_element->getFullyQualifiedStructuralElementName()] = $node;
            $sub_graph->setNode($node);
        }

        foreach ($namespace->getChildren()->getAll() as $element) {
            $this->buildNamespaceTree($sub_graph, $element);
        }

        $graph->addGraph($sub_graph);
    }
1304588
private Map<String,Namespace> buildByPrefixMap()
    {
        int len = mNamespaces.size();
        if (len == 0) {
            return Collections.emptyMap();
        }

        LinkedHashMap<String,Namespace> m = new LinkedHashMap<String,Namespace>(1 + len + (len>>1));
        for (int i = 0; i < len; ++i) {
            Namespace ns = mNamespaces.get(i);
            String prefix = ns.getPrefix();
            if (prefix == null) { // shouldn't happen but...
                prefix = "";
            }
            m.put(prefix, ns);
        }
        return m;
    }
448152
def get_subgraph_list(self):
        

        sgraph_objs = list()

        for sgraph in self.obj_dict['subgraphs']:
                obj_dict_list = self.obj_dict['subgraphs'][sgraph]
                sgraph_objs.extend(
                    [Subgraph(obj_dict=obj_d)
                     for obj_d in obj_dict_list])

        return sgraph_objs
561822
def _base_class_object_build(node, member, basenames, name=None, localname=None):
    
    klass = build_class(
        name or getattr(member, "__name__", None) or localname,
        basenames,
        member.__doc__,
    )
    klass._newstyle = isinstance(member, type)
    node.add_local_node(klass, localname)
    try:
        # limit the instantiation trick since it's too dangerous
        # (such as infinite test execution...)
        # this at least resolves common case such as Exception.args,
        # OSError.errno
        if issubclass(member, Exception):
            instdict = member().__dict__
        else:
            raise TypeError
    except TypeError:
        pass
    else:
        for item_name, obj in instdict.items():
            valnode = nodes.EmptyNode()
            valnode.object = obj
            valnode.parent = klass
            valnode.lineno = 1
            klass.instance_attrs[item_name] = [valnode]
    return klass
163210
private static Set<String> getAnnotationLevelSet(SDocumentGraph graph,
          String namespace, Class<? extends SNode> type) {
    Set<String> result = new TreeSet<>();

    if (graph != null) {
      List<? extends SNode> nodes;
      // catch most common cases directly
      if (SSpan.class == type) {
        nodes = graph.getSpans();
      } else if (SToken.class == type) {
        nodes = graph.getTokens();
      } else {
        nodes = graph.getNodes();
      }
      if (nodes != null) {
        for (SNode n : nodes) {
          if (type.isAssignableFrom(n.getClass())) {
            for (SLayer layer : n.getLayers()) {
              if (namespace == null || namespace.equals(layer.getName())) {
                for (SAnnotation anno : n.getAnnotations()) {
                  result.add(anno.getQName());
                }
                // we got all annotations of this node, jump to next node
                break;
              } // end if namespace equals layer name
            } // end for each layer
          }
        } // end for each node
      }
    }

    return result;
  }
480488
private Node<OWLClass> nodeToOwlClassNode(au.csiro.ontology.Node n) {
        if(n == null) return new OWLClassNode();

        final Set<OWLClass> classes = new HashSet<>();

        for (Object eq : n.getEquivalentConcepts()) {
            classes.add(getOWLClass(eq));
        }

        return new OWLClassNode(classes);
    }
631723
def add_namespaces(spec_dict):
    """"""

    for ns in spec_dict["namespaces"]:
        spec_dict["namespaces"][ns]["list"] = []
        spec_dict["namespaces"][ns]["list_long"] = []
        spec_dict["namespaces"][ns]["list_short"] = []

        spec_dict["namespaces"][ns]["to_short"] = {}
        spec_dict["namespaces"][ns]["to_long"] = {}

        for obj in spec_dict["namespaces"][ns]["info"]:
            spec_dict["namespaces"][ns]["list"].extend([obj["name"], obj["abbreviation"]])
            spec_dict["namespaces"][ns]["list_short"].append(obj["abbreviation"])
            spec_dict["namespaces"][ns]["list_long"].append(obj["name"])

            spec_dict["namespaces"][ns]["to_short"][obj["abbreviation"]] = obj["abbreviation"]
            spec_dict["namespaces"][ns]["to_short"][obj["name"]] = obj["abbreviation"]

            spec_dict["namespaces"][ns]["to_long"][obj["abbreviation"]] = obj["name"]
            spec_dict["namespaces"][ns]["to_long"][obj["name"]] = obj["name"]

            # For AminoAcid namespace
            if "abbrev1" in obj:
                spec_dict["namespaces"][ns]["to_short"][obj["abbrev1"]] = obj["abbreviation"]
                spec_dict["namespaces"][ns]["to_long"][obj["abbrev1"]] = obj["name"]
1040570
def all_subclasses(cls):
    
    subclasses = cls.__subclasses__()
    descendants = (descendant for subclass in subclasses
                   for descendant in all_subclasses(subclass))
    return set(subclasses) | set(descendants)
42849
public SharedTreeSubgraph makeSubgraph(String name) {
    SharedTreeSubgraph sg = new SharedTreeSubgraph(subgraphArray.size(), name);
    subgraphArray.add(sg);
    return sg;
  }
240090
def _build_inheritance_chain(cls, bases, *names, merge=False):
        """"""
        result = []
        for name in names:
            maps = []
            for base in bases:
                bmap = getattr(base, name, None)
                if bmap is not None:
                    assert isinstance(bmap, (dict, ChainMap))
                    if len(bmap):
                        if isinstance(bmap, ChainMap):
                            maps.extend(bmap.maps)
                        else:
                            maps.append(bmap)
            result.append(ChainMap({}, *maps))
        if merge:
            result = [dict(map) for map in result]
        if len(names) == 1:
            return result[0]
        return result
974979
def walk_subclasses(root):
    """"""
    classes = [root]
    visited = set()
    while classes:
        cls = classes.pop()
        if cls is type or cls in visited:
            continue
        classes.extend(cls.__subclasses__())
        visited.add(cls)
        if cls is not root:
            yield cls
715329
def build_class(name, basenames=(), doc=None):
    """"""
    node = nodes.ClassDef(name, doc)
    for base in basenames:
        basenode = nodes.Name()
        basenode.name = base
        node.bases.append(basenode)
        basenode.parent = node
    return node
445731
def _build_rdf(self, data=None):

		'''
		
		'''

		# recreate rdf data
		self.rdf = SimpleNamespace()
		self.rdf.data = data
		self.rdf.prefixes = SimpleNamespace()
		self.rdf.uris = SimpleNamespace()
		# populate prefixes
		for prefix,uri in self.repo.context.items():
			setattr(self.rdf.prefixes, prefix, rdflib.Namespace(uri))
		# graph
		self._parse_graph()
647656
public static <T> Set<Class<? extends T>> getNonAbstractSubclasses(Class<T> clazz) {
        return ClassGraphUtil/*TraverseClasspath*/.getNonAbstractSubClasses(clazz);
    }
1194935
def build_tree(requester)
      root_node = build_root_node(requester)
      # Search out the implementations directory structure for endpoints
      if defined?(self.implementation_root)
        # For each endpoints directory, recurse down it to load the modules
        endpoints_directories.each do |endpoints_directories|
          Dir["#{endpoints_directories}/**/*.rb"].each { |f| require(f) }
        end
        build_node_children(self.endpoints_module, root_node, requester)
      end
      root_node
    end
799252
def getSubgraphList(self, parent_name):
        
        if not self.isMultigraph:
            raise AttributeError("Simple Munin Plugins cannot have subgraphs.")
        if self._graphDict.has_key(parent_name):
            return self._subgraphNames[parent_name] or []
        else:
            raise AttributeError("Invalid parent graph name %s."
                                 % (parent_name,))
1027819
private void initializeNamesNodesMaps(Tree t) {
    for (Tree node : t.subTreeList()) {
      Matcher m = namePattern.matcher(node.label().value());
      if (m.find()) {
        namesToNodes.put(m.group(1),node);
        nodesToNames.put(node,m.group(1));
        node.label().setValue(m.replaceFirst(""));
      }
      Matcher m1 = escapedNameChar.matcher(node.label().value());
      node.label().setValue(m1.replaceAll(nameIntroducingChar));
    }
  }