public boolean addInherits(NodeType childNode, NodeType parentNode) {
        createNodeIfNotExists(childNode);
        createNodeIfNotExists(parentNode);

        List<NodeType> existingAncestors = getAllAncestors(parentNode);

        if (existingAncestors.contains(childNode)) {
            // childNode cannot inherit from parentNode if parentNode directly or indirectly inherits from childNode (cycle)
            return false;
        }

        List<NodeType> parentList = parentsOfNode.get(childNode);
        if (!parentList.contains(parentNode)) {
            parentList.add(parentNode);
        }

        List<NodeType> parentChildren = childrenOfNode.get(parentNode);

        if (!parentChildren.contains(childNode)) {
            parentChildren.add(childNode);
        }

        return true;
    }
Try to register a new inheritance relationship such that
childNode inherits from parentNode

@return boolean indicating success. Inheritance is unsuccessful if the relationship would create a cycle 
in the inheritance graph.
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/index/InheritanceGraph.java