/**
   * Get all the terminal nodes pending from this one, or itself if it is already a terminal node
   *
   * @return List of terminal nodes pending from this one
   */
  public ArrayList<OntologyElement> getTerminalChildren() {
    ArrayList<OntologyElement> ret = new ArrayList<>();
    if (this.children.isEmpty()) {
      ret.add(this);
      return ret;
    }

    for (OntologyElement elem : this.children) {
      ret.addAll(elem.getTerminalChildren());
    }

    return ret;
  }