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
Relative Ontology IRI causes missing declaration #557
Comments
Including StackOverflow content for clarity: CODE:
Creates an annotation assertion. Expected result is (manually created): data property assertion I try to create OWLNegativeDataPropertyAssertionAxiom and it works fine. Also if I create getOWLNegativeDataPropertyAssertionAxiom first and then create OWLDataPropertyAssertionAxiom - it works. OWLAPI: owlapi-distribution-4.1.4.jar EDIT: Created ontologies:
This case is when I save ontology as RDF/XML. Maybe its just Protege fail. When I save ontology as OWL/XML its OK again. |
My guess is RDF/XML is not storing all required declarations. |
I cannot replicate the failure. The following code:
Produces this output:
Can you provide a full sample that reproduces the error? this might be due to something else existing in the ontology. |
Sample project with created owl: |
Thanks for the code example. When I run it, I get, for both OWLAPI 4.1.4 and 5.0.2, the following output:
When parsed, these axioms are found:
As it is evident, the issue is that the namespaces for the properties do not match. This is due to the ontology IRI being a relative one; the axiom property is stored as created, while the declaration is resolved to be absolute. On parsing, these no longer match, causing the OWLAPI to think the property is not declared. As a workaround, use absolute IRIs for the ontology IRI. The IRIs should have been made absolute consistently.
|
Ontology IRIs must be absolute, not relative (it is an OWL 2 violation for an ontology to have a relative IRI). If such an ontology is saved in RDF/XML to a file, parsing the file causes property declarations to be missed (this does not happen for in memory save and parse, as there is no base file IRI to derelativise IRIs). As ontology IRIs must be absolute, but there is no good general strategy to turn a relative ontology IRI in an absolute one, the approach is to add "urn:absolute:" in front of the relative IRI. This resolves the parsing ambiguity without throwing new exceptions. We can't start throwing exceptions on invalid IRIs for various reasons: first off, we are still using IRIs for representing blank nodes; second, this would cause a large number of backwards compatibility issues with existing ontologies. Hence the smellier approach of forcing absolute IRIs in an arbitrary way.
Ontology IRIs must be absolute, not relative (it is an OWL 2 violation for an ontology to have a relative IRI). If such an ontology is saved in RDF/XML to a file, parsing the file causes property declarations to be missed (this does not happen for in memory save and parse, as there is no base file IRI to derelativise IRIs). As ontology IRIs must be absolute, but there is no good general strategy to turn a relative ontology IRI in an absolute one, the approach is to add "urn:absolute:" in front of the relative IRI. This resolves the parsing ambiguity without throwing new exceptions. We can't start throwing exceptions on invalid IRIs for various reasons: first off, we are still using IRIs for representing blank nodes; second, this would cause a large number of backwards compatibility issues with existing ontologies. Hence the smellier approach of forcing absolute IRIs in an arbitrary way.
This code creates ClassAssertion instead of DataPropertyAssertion
also here Stackoverflow
The text was updated successfully, but these errors were encountered: