OWL2Parser.java revision b1d1bda618f7b145c28645f39b0ca651b8001eba
public class OWL2Parser {
// A simple example of how to load and save an ontology
try {
if (!missingImports.isEmpty()) {
}
// reset the manager. clear out imports to avoid duplicates
// collect missing imports again to report them in output file.
}
if (cyclic) {
// System.out.println("NAME: " + merged_name + "\n");
// System.out.println("MERGED_IRI " + mergedOntologyIRI + "\n");
// Axioms can be excluded when 'quick' Option selected
if (quick)
else {
}
} else {
}
}
}
// print usage information screen
private static void showHelpScreen() {
+ "_>_options_<______________\n"
+ " | -o <tp> <fn> ..write output to file\n"
+ " - - - tp <- type [: owl xml omn rdf obo dol ttl]\n"
+ " - - - fn <- filename\n"
+ " | -o-sys <tp> ..write output to system.out\n"
+ " - - - - - tp <- type\n"
+ " | -qk ..internal(!) sets 'quick' option\n"
+ " | -h ..this helptext"
); }
// parse arguments according to option set
// fails for unknown or incomplete arguments, or when IRI is not set
private static void parseArgs
{
+ "insufficient arguments (-o [format] [filename])");
+ "insufficient arguments (-o-sys [format])");
quick = true;
} else {
} }
}
}
private static OWLOntologyManager setupManagerWithMissingImportListener () {
return mgr;
}
private static class HasMissingImports implements MissingImportListener {
}
}
s.addAll(i);
}
return s;
}
do {
changed = false;
}
}
} while (changed);
}
// output handler allows and handles a list of output-requests
protected static class OWLOutputHandler {
= new ArrayList<OWLOntologyWriter>();
}
}
// function need to be called once to render and close every output
throws IOException {
} }
}
// custem OntolgyWriter bundles a BufferedWriter with an OWL output format
protected static class OWLOntologyWriter extends BufferedWriter {
super (new FileWriter (fn));
}
}
void writeMissingImports () throws IOException {
} }
void _close () throws IOException {
_close (this);
}
}
throws IOException {
switch (this.option) {
case OWL_XML :
write("<Ontologies>\n");
write("<\n/Ontologies>\n");
break;
case MANCHESTER :
renderAsOmn(onto); break;
case RDF_XML :
renderAsRdf(onto); break;
// TODO: the below still need implementation!
case OBO :
renderAsXml(onto); break;
case DOL :
renderAsXml(onto); break;
case TURTLE :
renderAsXml(onto); break;
} }
try {
} catch (OWLRendererException ex) {
} }
try {
if (quick) {
}
append("\"/>\n");
} }
try {
} catch (IOException ex) {
} }
}
}