Commit 1c885324 authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Added option for naming generated ontology

parent 8375b52d
...@@ -13,8 +13,15 @@ import java.io.*; ...@@ -13,8 +13,15 @@ import java.io.*;
public class GenOntology extends Parser { public class GenOntology extends Parser {
public static void main(String args[]) { public static void main(String args[]) {
Start ast = null; 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 { try {
Reader r = new FileReader(args[0]); Reader r = new FileReader(args[args.length-1]);
SiarasParser parser = new SiarasParser(r); SiarasParser parser = new SiarasParser(r);
ast = parser.Start(); ast = parser.Start();
...@@ -24,16 +31,16 @@ public class GenOntology extends Parser { ...@@ -24,16 +31,16 @@ public class GenOntology extends Parser {
catch (FileNotFoundException e) { catch (FileNotFoundException e) {
System.err.println("file " + args[0] + " not found"); System.err.println("file " + args[0] + " not found");
} }
String fileName = null;
try { try {
// Generate OWL ontology, possibly transformed from Owl // Generate OWL ontology, possibly transformed from Owl
// Full to OWL DL // Full to OWL DL
fileName = "ontology.owl"; if (outfile == null) {
PrintStream pStream = new PrintStream(new File(fileName)); outfile = "ontology.owl";
}
PrintStream pStream = new PrintStream(new File(outfile));
ast.genOntology("",pStream); ast.genOntology("",pStream);
} catch (java.io.FileNotFoundException e) { } catch (java.io.FileNotFoundException e) {
System.out.println("Could not create file: "+fileName); System.out.println("Could not create file: "+outfile);
e.printStackTrace(); e.printStackTrace();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment