-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ontology imports not preserved by RDF/XML parser #1147
Comments
Trying to replicate this, I get something different:
In all cases, attempting to load the ontology throws unloadable ontology error. I believe Protege is running with missing import strategy set to silent, no exceptions. The DCTerms ontology doesn't look like it can be loaded successfully. The options setup is so that the partial load adds data to the current ontology (same as if the import was from a piece of RDF and not an ontology). Which perhaps is the case?
|
Which version of Java do you use? With Java 8 I also got a 403 error. I think you need to use a more recent Java version. |
OWLAPI 4 is required to be compatible with Java 8, though. Different behaviour with different Java versions is an added headache :-( Worth noting that adding the import didn't work with any format, in default config, if an ontology with the right IRI was not already in the manager, and worked in all cases otherwise. I need to try with alternate configs, but I believe the root of the behaviour is that we're not dealing with an OWL ontology. |
With the manager set like this, the imports directives on file are saved correctly even when the imported file cannot be loaded. I believe that's the standard setup for Protege. |
Running on Java 21, I get no exceptions and the tests pass. The output for different formats:
Functional and OWL/XML include the axioms inline, while none of the others do. Looks like they're ignoring the INCLUDE_GRAPH directive. I'm uncertain if that's a bug or not, given the fact that I don't believe the specs say a lot about it. I'd prefer uniform behaviour, though. As to why the behaviour is different between Java 8 and Java 21, I'm guessing different exceptions are getting raised :-( On Java 8, the exception is uncaught, while it should have been caught and ignored as per settings. |
With the default manager settings, the test fails - the reason being that the import directive cannot be resolved and so gets ignored. I'd argue that the behaviour on Java 8 is best, as it signals something is amiss instead of allowing to load only part of the ontology - the imports directive would be lost once one saves the ontology again, without the user any the wiser. |
Thanks for investigating!
As far as I understand, the 403 error is a separate issue caused by the server blocking requests if it does not like the headers (e.g., coming from Java 8). This could be easily resolved by setting a custom user agent, which is a good idea anyway to ensure consistency across different environments:
(In case you are wondering, I just took the most popular user agent.) Alternatively, you can use (a different version of) the same ontology from bioportal. Just change the URL
For me, both versions of tests (with user agent or with updated URL) work consistently (one test failing the other is not) across all the version of Java I have:
That is strange. As I said, I obtain the same results with all versions of java. Can you tell the exact version of Java and the OS that you use? I run tests from Eclipse 2024-06 (4.32.0) Build id: 20240606-1231 from MacOS 14.5 (23F79)
What do you mean by "adding the import"? Programmatically using OWL API? |
As reported in protegeproject/protege#1226 the imports of some (RDF) ontologies get flattened when loaded by the RDF/XML parser:
The same does not seem to happen when saving the ontology in functional-style syntax.
To reproduce in OWL API:
test.rdf
:test.ofn
:Stacktrace:
Versions:
The text was updated successfully, but these errors were encountered: