The ZipIRIMapper is case sensitive for the file extensions, while the AutoIRIMapper is not case sensitive. This is causing problems opening .OWL files inside a zip file using the AutoIRIMapper
ZipIRIMapper implementation:
protected void parseIfExtensionSupported(ZipFile file, ZipEntry e, String baseIRI) throws IOException {
String name = e.getName();
int lastIndexOf = name.lastIndexOf(46);
if (lastIndexOf >= 0) {
IRI physicalIRI = IRI.create(baseIRI + name);
String extension = name.substring(lastIndexOf);
if (".obo".equals(extension)) {
this.oboFileMap.put(name, physicalIRI);
} else {
InputStream in = file.getInputStream(e);
Throwable var9 = null;
try {
IRI logical;
if (".ofn".equals(extension)) {
logical = parseFSSFile(in);
if (logical != null) {
this.ontologyIRI2PhysicalURIMap.put(logical, physicalIRI);
}
} else if (".omn".equals(extension)) {
logical = parseManchesterSyntaxFile(in);
if (logical != null) {
this.ontologyIRI2PhysicalURIMap.put(logical, physicalIRI);
}
} else if (this.fileExtensions.contains(extension)) {
logical = this.parseFile(in);
if (logical != null) {
this.ontologyIRI2PhysicalURIMap.put(logical, physicalIRI);
}
}
} catch (Throwable var18) {
var9 = var18;
throw var18;
} finally {
if (in != null) {
if (var9 != null) {
try {
in.close();
} catch (Throwable var17) {
var9.addSuppressed(var17);
}
} else {
in.close();
}
}
}
}
}
}
AutoIRIMapper Implementation:
protected void parseIfExtensionSupported(File file) {
String name = file.getName();
int lastIndexOf = name.lastIndexOf(46);
if (lastIndexOf >= 0) {
String extension = name.substring(lastIndexOf);
if (!".zip".equalsIgnoreCase(extension) && !".jar".equalsIgnoreCase(extension)) {
if (".obo".equalsIgnoreCase(extension)) {
this.oboFileMap.put(name, IRI.create(file));
} else if (".ofn".equalsIgnoreCase(extension)) {
this.parseFSSFile(file);
} else if (".omn".equalsIgnoreCase(extension)) {
this.parseManchesterSyntaxFile(file);
} else if (this.fileExtensions.contains(extension.toLowerCase())) {
this.parseFile(file);
}
(...)
Hi,
The ZipIRIMapper is case sensitive for the file extensions, while the AutoIRIMapper is not case sensitive. This is causing problems opening .OWL files inside a zip file using the AutoIRIMapper
ZipIRIMapper implementation:
AutoIRIMapper Implementation: