Commit 4da4e90b authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Generate a suitable .repository file to accompany the generated ontology

parent 1c885324
...@@ -15,3 +15,4 @@ testontologies/*.pprj ...@@ -15,3 +15,4 @@ testontologies/*.pprj
siaras/ontology.owl siaras/ontology.owl
siaras/javadoc siaras/javadoc
siaras/OntologyCompiler.jar siaras/OntologyCompiler.jar
*.repository
...@@ -18,6 +18,9 @@ public class GenOntology extends Parser { ...@@ -18,6 +18,9 @@ public class GenOntology extends Parser {
for (i=0; i<args.length; i++) { for (i=0; i<args.length; i++) {
if (args[i].equals("-o")) { if (args[i].equals("-o")) {
outfile = args[++i]; outfile = args[++i];
if (outfile.endsWith(".owl")) {
outfile = outfile.substring(0,outfile.indexOf('.'));
}
} }
} }
try { try {
...@@ -35,10 +38,14 @@ public class GenOntology extends Parser { ...@@ -35,10 +38,14 @@ public class GenOntology extends Parser {
// Generate OWL ontology, possibly transformed from Owl // Generate OWL ontology, possibly transformed from Owl
// Full to OWL DL // Full to OWL DL
if (outfile == null) { if (outfile == null) {
outfile = "ontology.owl"; outfile = "ontology";
} }
PrintStream pStream = new PrintStream(new File(outfile)); PrintStream pStream = new PrintStream(new File(outfile+".owl"));
ast.genOntology("",pStream); ast.genOntology("",pStream);
// have to create a matching repository file, otherwise
// Protege will complain severely.
pStream = new PrintStream(new File(outfile+".repository"));
pStream.println("[Dublin Core DL Redirect]");
} catch (java.io.FileNotFoundException e) { } catch (java.io.FileNotFoundException e) {
System.out.println("Could not create file: "+outfile); 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