OWL2Parser.java revision 47bb42d5a2ea6356bfa21924a004637803bb440f
public class OWL2Parser {
private static enum OPTION {
}
private static OWLOntologyManager manager =
private static OWLOntologyIRIMapperImpl mapper =
new OWLOntologyIRIMapperImpl();
private static int maxRedirects = 0;
private static void checkMaxRedirects() {
maxRedirects = 20;
return;
}
try {
if (n > 0) {
maxRedirects = n;
}
} catch (NumberFormatException nfe) {
+ "'http.maxRedirects' - invalid number '" + t + "'");
}
}
throws IOException
{
if (!(c instanceof HttpURLConnection)) {
return c;
}
{
if (redirCount > maxRedirects) {
+ ") reached for " + url);
return null;
}
try {
+ "' (missing Location header).");
return null;
}
} catch (MalformedURLException mue) {
return null;
}
con.disconnect();
+ ").");
return null;
}
return con;
}
// 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.
ontology =
}
if (cyclic) {
// we must make a new name
// 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 {
merged =
}
} 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
throws Exception
{
}
+ "insufficient arguments (-o [format] [filename])");
}
+ "insufficient arguments (-o-sys [format])");
}
quick = true;
} else {
}
} else {
}
} else {
}
}
}
}
}
return OPTION.MANCHESTER;
}
}
private static OWLOntologyManager setupManagerWithMissingImportListener() {
return mgr;
}
private static class HasMissingImports implements MissingImportListener {
}
}
{
cyclic = true;
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>();
}
}
void _open() throws IOException {
}
}
void _close() throws IOException {
}
}
// function need to be called once to render and close every output
}
}
}
// 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 _open() throws IOException {
write("<Ontologies>\n");
}
}
void _close() throws IOException {
write("\n</Ontologies>\n");
}
_close(this);
}
}
switch (option) {
case OWL_XML:
break;
case MANCHESTER:
break;
case RDF_XML:
break;
// TODO: the below still need implementation!
case OBO:
break;
case TURTLE:
break;
}
}
try {
new ManchesterOWLSyntaxRenderer();
} catch (OWLRendererException ex) {
}
}
try {
if (quick) {
}
}
append("<Loaded name=\"")
append("\" ontiri=\"")
append("\"/>\n");
}
}
try {
} catch (IOException ex) {
}
}
}
}