code: private void unfoldJoinTrees(List body) {
          for (int i = 0; i < body.size(); i++) {
              Function currentAtom = (Function) body.get(i);
              if (currentAtom.getFunctionSymbol().equals(datalogFactory.getSparqlJoinPredicate())) {
                  unfoldJoinTrees(currentAtom.getTerms());
  				body.remove(i);
  				for (int j = currentAtom.getTerms().size() - 1; j >= 0; j--) {
  					Term term = currentAtom.getTerm(j);
  					if (!body.contains(term))
  						body.add(i, term);
  				}
  				i -= 1;
              }
          }
      }
docs: *
  This expands all Join that can be directly added as conjuncts to a
  query's body. Nested Join trees inside left joins are not touched.
  <p>
  In addition, we will remove any Join atoms that only contain one single
  data atom, i.e., the join is not a join, but a table reference with
  conditions. These kind of atoms can result from the partial evaluation
  process and should be eliminated. The elimination takes all the atoms in
  the join (the single data atom plus possibly extra boolean conditions and
  adds them to the node that is the parent of the join).
  
  NEW: DOES NOT LOOK FOR fake JOINS INSIDE LJ "atoms"
  
  @param body
  @return