public String toSolutionModifierSQL() throws Exception { if (q.isSelectQuery() || q.isConstructQuery()) { return processSolutionModifierForSelectConstruct(); } else if (q.isDescribeQuery()) { return processSolutionModifierForDescribe(); } return null; }
public String toTopQuerySQL(Set<Variable> explicitIRIBoundVariables) throws Exception { if (q.isSelectQuery()) { return processTopQueryForSelectDescribeConstruct(explicitIRIBoundVariables); } else if (q.isAskQuery()) { return processAskQuery(); } else if (q.isDescribeQuery()) { return processTopQueryForSelectDescribeConstruct(explicitIRIBoundVariables); } else if (q.isConstructQuery()) { return processTopQueryForSelectDescribeConstruct(explicitIRIBoundVariables); } return null; }
private String processSolutionModifierForSelectConstruct() throws Exception { StringBuffer sql = new StringBuffer(); SolutionModifiers solutionModifiers = null; if (q.isSelectQuery()) solutionModifiers = q.getSelectQuery().getSolutionModifier(); if (q.isConstructQuery()) solutionModifiers = q.getConstructQuery().getSolutionModifier(); /* if(solutionModifiers!= null){ if(solutionModifiers.getLimitOffset()!=null){ sql.append(",\n"); boolean hasOffset = solutionModifiers.getLimitOffset().getOffset()>0; AbstractSQLTemplate limitTemplate = new LimitTemplate(hasOffset?"limit_for_offset":"limit",q ,store, ctx, wrapper); sql.append(limitTemplate.createSQLString()); if(hasOffset){ sql.append(",\n"); AbstractSQLTemplate offsetTemplate = new OffsetTemplate("offset",q ,store, ctx, wrapper); sql.append(offsetTemplate.createSQLString()); } } //TODO: Mihaela: We are not currently handling other solution modifiers (e.g., ORDER BY). } */ return sql.toString(); }
private String processSolutionModifierForDescribe() throws Exception { StringBuffer sql = new StringBuffer(); if (q.getMainPattern() != null) sql.append(",\n"); AbstractSQLTemplate describeSQLTemplate = new DescribeSQLTemplate("describe", q, store, ctx, wrapper); sql.append(describeSQLTemplate.createSQLString()); /* if(q.getDescribeQuery().getSolutionModifier() != null){ if(q.getDescribeQuery().getSolutionModifier().getLimitOffset()!=null){ sql.append(",\n"); AbstractSQLTemplate limitTemplate = new LimitTemplate("limit",q ,store, ctx, wrapper); sql.append(limitTemplate.createSQLString()); if(q.getDescribeQuery().getSolutionModifier().getLimitOffset().getOffset()>0){ sql.append(",\n"); AbstractSQLTemplate offsetTemplate = new OffsetTemplate("offset",q ,store, ctx, wrapper); sql.append(offsetTemplate.createSQLString()); } } } */ return sql.toString(); }