From 1c885324398c35692839c8e4e138f978a474679b Mon Sep 17 00:00:00 2001
From: Anders Nilsson <anders.nilsson@cs.lth.se>
Date: Mon, 12 Feb 2007 12:36:56 +0100
Subject: [PATCH] Added option for naming generated ontology

---
 siaras/GenOntology.java | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/siaras/GenOntology.java b/siaras/GenOntology.java
index 38337d7..e9315a2 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();
 		}
 		
-- 
GitLab