if(args.length<3 || args.length%2 == 0){
System.err.println("Wrong number of arguments!");
}
final RDF3XQueryEvaluator evaluator = new RDF3XQueryEvaluator();
evaluator.loadLargeScaleIndices(args[0]);
final Formatter formatter = new XMLFormatter();
ServiceApproaches.Semijoin_Approach.setup();
for(int i=1; i<args.length; i+=2){
final String query = FileHelper.readFile(args[i]);
System.out.println("\nProcess SPARQL query:");
System.out.println(query);
final QueryResult queryResult = evaluator.getResult(query, true);
System.out.println("\nSave result into file: "+args[i+1]);
final OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(args[i+1]));
formatter.writeResult(outputStream, evaluator.getVariablesOfQuery(), queryResult);
outputStream.close();
evaluator.writeOutIndexFileAndModifiedPages(args[0]);
queryResult.release();
}
System.out.println("\nDone!");