private void buildSymetricNaturalJoinDefinition(List<Object> definitions,Domain left,Domain right,ExpressionAST leftAlias,ExpressionAST rightAlias){
  try {
    if (leftAlias == null)     leftAlias=createReferringExpression(left);
    if (rightAlias == null)     rightAlias=createReferringExpression(right);
    Table tleft=universe.getTable(left);
    Table tright=universe.getTable(right);
    Set<String> lnames=addColumnName(tleft);
    Set<String> rnames=addColumnName(tright);
    lnames.retainAll(rnames);
    for (    String name : lnames) {
      Column cleft=tleft.findColumnByName(name);
      Column cright=tright.findColumnByName(name);
      if (cleft != null && cright != null) {
        IDomain dleft=cleft.getTypeDomain();
        IDomain dright=cright.getTypeDomain();
        if (dleft.isInstanceOf(dright) || dright.isInstanceOf(dleft)) {
          ExpressionAST eleft=ExpressionMaker.COMPOSE(leftAlias,new ColumnReference(cleft));
          ExpressionAST eright=ExpressionMaker.COMPOSE(rightAlias,new ColumnReference(cright));
          ExpressionAST equal=ExpressionMaker.EQUAL(eleft,eright);
          definitions.add(equal);
        }
      }
    }
  }
 catch (  ScopeException|ExecutionException e1) {
  }
}

private void buildSymetricNaturalJoinDefinition ( List < Object > definitions , Domain left , Domain right , ExpressionAST leftAlias , ExpressionAST rightAlias ) { try { if ( leftAlias == null ) leftAlias = createReferringExpression ( left ) ; if ( rightAlias == null ) rightAlias = createReferringExpression ( right ) ; Table tleft = universe . getTable ( left ) ; Table tright = universe . getTable ( right ) ; Set < String > lnames = addColumnName ( tleft ) ; Set < String > rnames = addColumnName ( tright ) ; lnames . retainAll ( rnames ) ; for ( String name : lnames ) { Column cleft = tleft . findColumnByName ( name ) ; Column cright = tright . findColumnByName ( name ) ; if ( cleft != null && cright != null ) { IDomain dleft = cleft . getTypeDomain ( ) ; IDomain dright = cright . getTypeDomain ( ) ; if ( dleft . isInstanceOf ( dright ) || dright . isInstanceOf ( dleft ) ) { ExpressionAST eleft = ExpressionMaker . COMPOSE ( leftAlias , new ColumnReference ( cleft ) ) ; ExpressionAST eright = ExpressionMaker . COMPOSE ( rightAlias , new ColumnReference ( cright ) ) ; ExpressionAST equal = ExpressionMaker . EQUAL ( eleft , eright ) ; definitions . add ( equal ) ; } } } } catch ( ScopeException | ExecutionException e1 ) { } }
create natural join between left & right columns . condition : must have same name and compatible types .
