@Deprecated
  public List<String> commonWhereConditions(List<QueryNode> nodes,
    List<Long> corpusList, List<Long> documents)
  {
    LinkedList<String> conditions = new LinkedList<>();

    // annotations can always only be inside a subcorpus/document
    QueryNode[] copyNodes = nodes.toArray(new QueryNode[nodes.size()]);

    for (int left = 0; left < copyNodes.length; left++)
    {
      for (int right = 0; right < copyNodes.length; right++)
      {
        if(left != right)
        {
          // only add constraint if the two nodes are not already connected by their component or node id
          boolean needsCorpusRef = false;
          for(Join j : copyNodes[left].getOutgoingJoins())
          {
            if(j.getTarget() != null 
              && j.getTarget().getId() == copyNodes[right].getId()
              )
            {
              if((j instanceof RankTableJoin || j instanceof Identical))
              {
                // we definitly don't have to apply this join
                needsCorpusRef = false;
                break;
              }
              else
              {
                // there is at least one actual join between this nodes, assume we
                // need a corpus_ref join for now
                needsCorpusRef = true;
              }
            }
          }

          if (needsCorpusRef)
          {
            conditions.add(join("=",
              tables(copyNodes[left]).aliasedColumn(NODE_TABLE, "corpus_ref"),
              tables(copyNodes[right]).aliasedColumn(NODE_TABLE, "corpus_ref")));
          }
        } // end if left != right
      } // end right loop
    } // end left loop

    return conditions;
  }
@ Deprecated public List < String > commonWhereConditions ( List < QueryNode > nodes , List < Long > corpusList , List < Long > documents ) { LinkedList < String > conditions = new LinkedList < > ( ) ; QueryNode [ ] copyNodes = nodes . toArray ( new QueryNode [ nodes . size ( ) ] ) ; for ( int left = 0 ; left < copyNodes . length ; left ++ ) { for ( int right = 0 ; right < copyNodes . length ; right ++ ) { if ( left != right ) { boolean needsCorpusRef = false ; for ( Join j : copyNodes [ left ] . getOutgoingJoins ( ) ) { if ( j . getTarget ( ) != null && j . getTarget ( ) . getId ( ) == copyNodes [ right ] . getId ( ) ) { if ( ( j instanceof RankTableJoin || j instanceof Identical ) ) { needsCorpusRef = false ; break ; } else { needsCorpusRef = true ; } } } if ( needsCorpusRef ) { conditions . add ( join ( "=" , tables ( copyNodes [ left ] ) . aliasedColumn ( NODE_TABLE , "corpus_ref" ) , tables ( copyNodes [ right ] ) . aliasedColumn ( NODE_TABLE , "corpus_ref" ) ) ) ; } } } } return conditions ; }
VR: inline