package org.semanticweb.drew.cli;

import it.unical.mat.wrapper.DLVInputProgram;
import it.unical.mat.wrapper.DLVInvocationException;

import java.io.IOException;

import org.semanticweb.drew.dlprogram.parser.ParseException;
import org.semanticweb.drew.el.cli.DReWELCLI;
import org.semanticweb.drew.rl.cli.DReWRLCLI;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;

public abstract class CommandLine {

	/**
	 * @param args
	 * @throws DLVInvocationException
	 * @throws ParseException
	 * @throws IOException
	 * @throws OWLOntologyCreationException
	 */
	public static void main(String[] args) throws OWLOntologyCreationException,
			IOException, ParseException, DLVInvocationException {
		if (args.length == 0) {
			//printUsage();
			String usage = "Usage: drew [-rl | -el] ...";
			System.err.println(usage);
			System.exit(0);
		}


		if (args[0].equals("-el")) {
			DReWELCLI.main(args);
		} else if (args[0].equals("-rl")) {
			DReWRLCLI.main(args);
		}
	}

	

	public abstract boolean parseArgs(String[] args);

	public abstract void go();

	public abstract void handleDefault(OWLOntology ontology,
			DLVInputProgram inputProgram);

	public abstract void handleDLProgram(OWLOntology ontology,
			DLVInputProgram inputProgram);

	public abstract void handleCQ(OWLOntology ontology,
			DLVInputProgram inputProgram);

}

@@ -783,10 +783,8 @@
 %0A%09%09%09
-//
 prin
@@ -797,87 +797,8 @@
 ();%0A
-%09%09%09String usage = %22Usage: drew %5B-rl %7C -el%5D ...%22;%0A%09%09%09System.err.println(usage);%0A
 %09%09%09S
@@ -817,17 +817,16 @@
 );%0A%09%09%7D%0A%0A
-%0A
 %09%09if (ar
@@ -943,14 +943,175 @@
 %0A%09%09%7D
+ else %7B%0A%09%09%09printUsage();%0A%09%09%09System.exit(0);%0A%09%09%7D%0A%09%7D%0A%0A%09private static void printUsage() %7B%0A%09%09String usage = %22Usage: drew %5B-rl %7C -el%5D ...%22;%0A%09%09System.err.println(usage);
 %0A%09%7D
-%0A%0A%09
 %0A%0A%09p

print usage when cli does not start with "-rl" or "el"