for (ColumnVar var : union.getSelectColumns()) {
if (!query.hasSqlSelectVarName(var.getName())) {
SelectProjection proj = new SelectProjection();
proj.setVar(var);
proj.setId(new RefIdColumn(var));
proj.setStringValue(coalesce(new URIColumn(var), new BNodeColumn(var), new LabelColumn(var),
new LongLabelColumn(var), new LongURIColumn(var)));
proj.setDatatype(new DatatypeColumn(var));
proj.setLanguage(new LanguageColumn(var));
query.addSqlSelectVar(proj);
}