ElementSymbol x = new ElementSymbol("a.x", true); //$NON-NLS-1$
ElementSymbol y = new ElementSymbol("b.y", true); //$NON-NLS-1$
From from = new From(Arrays.asList(new UnaryFromClause(a), new UnaryFromClause(b)));
Option option = new Option();
option.addDependentGroup("a"); //$NON-NLS-1$
option.addNotDependentGroup("b"); //$NON-NLS-1$
Select select = new Select(Arrays.asList(new Object[] {x, y}));
Criteria criteria = new CompareCriteria(x, CompareCriteria.EQ, y);
Query query = new Query(select, from, criteria, null, null, null, option);