code: private void expandTerm(Term term, List<Statement> allExpansions) {
          for (final ExpansionRule<Term> rule : termExpansionRules) {
              if (rule.match(term)) {
                  List<Statement> termExpansions = rule.expand(term);
                  allExpansions.addAll(termExpansions);
              }
  
              final List<Term> innerTerms = term.getTerms();
              for (final Term innerTerm : innerTerms) {
                  expandTerm(innerTerm, allExpansions);
              }
          }
      }
docs: Apply all matching {@link TermExpansionRule term expansion rules} defined
  in <tt>termExpansionRules</tt> to the {@link Term outer term} and all the
  {@link Term inner terms}.
  <p>
  This method is called recursively to evaluate the {@link Term inner
  terms}.
  </p>
  
  @param term {@link Term}, the current term to process for expansion
  @param allExpansions {@link List} of {@link Statement}, all statements
  currently collected through term expansion
  @throws TermExpansionException Thrown if a {@link TermExpansionRule}
  encounters an error with the {@link Term term} being expanded.