class SindicePreProcessing implements PreProcessing {

  @Override
  public String process(String query)
  throws Exception {
    final ASTQueryContainer ast = SyntaxTreeBuilder.parseQuery(query);

    // Dataset clauses are not allowed
    if (ast.getQuery().getDatasetClauseList().size() != 0) {
      throw new IllegalArgumentException("FROM and FROM NAMED clauses are not allowed. Use GRAPH instead.");
    }
    // Extract entities into their separate graph
    // Add the triple describing the dataset
    ASTVarGenerator.reset();
    final AddDatasetStatement addDSst = new AddDatasetStatement();
    addDSst.visit(ast, null);
    // Translate query back to string
    return AST2TextTranslator.translate(ast);
  }

}