public static String generateProjectionForTgd( ComplexQueryWithNegations query, List<VariableCorrespondence> correspondences, int chainingStep) { String fromClause = GenerateSQL.generateFromClause(query.getVariables(), chainingStep); String whereClause = GenerateSQL.generateWhereClause(query.getComplexQuery()); return projectionOnTargetValuesFromCorrespondences(correspondences, fromClause, whereClause); }
public static String generateProjectionWithoutIntersection( ComplexConjunctiveQuery query, MappingTask mappingTask, int chainingStep) { StringBuilder result = new StringBuilder(); List<SetAlias> sourceVariables = query.getVariables(); String fromClause = GenerateSQL.generateFromClause(sourceVariables, chainingStep); String whereClause = GenerateSQL.generateWhereClause(query); result.append(INDENT).append("select distinct \n"); // List<SetAlias> variables = extractDifferentVariables(query.getVariables()); List<SetAlias> variables = query.getVariables(); result.append(generateProjectionOnAllAttributes(variables, mappingTask)); result.append(INDENT).append(fromClause); if (!whereClause.equals("")) { result.append(INDENT).append(whereClause); } return result.toString(); }