diff --git a/siaras/GenOntology.java b/siaras/GenOntology.java
index 38337d765f456494f1ce4b782bf2e74a1c55b8c9..e9315a279a2c16523466a52a136a81ac1fbacf2d 100644
--- a/siaras/GenOntology.java
+++ b/siaras/GenOntology.java
@@ -13,8 +13,15 @@ import java.io.*;
 public class GenOntology extends Parser {
 	public static void main(String args[]) {
 		Start ast = null;
+		String outfile = null;
+		int i=0;
+		for (i=0; i<args.length; i++) {
+			if (args[i].equals("-o")) {
+				outfile = args[++i];
+			}
+		}
 		try {
-			Reader r = new FileReader(args[0]);
+			Reader r = new FileReader(args[args.length-1]);
 			SiarasParser parser = new SiarasParser(r);
 
 			ast = parser.Start();
@@ -24,16 +31,16 @@ public class GenOntology extends Parser {
 		catch (FileNotFoundException e) {
 			System.err.println("file " + args[0] + " not found");
 		}
-
-		String fileName = null;
 		try {
 			// Generate OWL ontology, possibly transformed from Owl
 			// Full to OWL DL
-			fileName = "ontology.owl";
-			PrintStream pStream = new PrintStream(new File(fileName));
+			if (outfile == null) {
+				outfile = "ontology.owl";
+			}
+			PrintStream pStream = new PrintStream(new File(outfile));
 			ast.genOntology("",pStream);
 		} catch (java.io.FileNotFoundException e) {
-			System.out.println("Could not create file: "+fileName);
+			System.out.println("Could not create file: "+outfile);
 			e.printStackTrace();
 		}