Open SimonBin opened 1 year ago
same issue with for
<https://www.example.org/onto1>
...
dcterms:isVersionOf <https://www.example.org/onto1> ;
I encountered this error as well. After debugging the owl api it seems this happens because the OWLRDFConsumer
ignores any IRI that is used for annotation
I think this could be solved if the IRI used as subject for the predicate owl:imports
is taken into account as possible IRI.
The in the code I mentioned above in OWLRDFConsumer
, do not remove it from candidateIRIS
if the IRI is used as subject for imports:
public void handleTriple(IRI s, IRI p, IRI o) {
consume(s, p, o);
// add a second parameter to indicate the IRI is a possible ontology IRI
// since its the subject
consumer.addOntology(s,true);
consumer.addOntology(o,false);
}
protected void addOntology(IRI iri,bool subjectIRI) {
if (ontologyIRIs.isEmpty()) {
firstOntologyIRI = iri;
}
ontologyIRIs.add(iri);
if (subjectIRI) {
importsubjectIRI.add(iri)
}
}
ontology.annotations().forEach(a -> a.getValue().asIRI().ifPresent(iri -> {
if (ontologyIRIs.contains(iri) && importSubjectIRI != iri) {
candidateIRIs.remove(iri);
}
}));
Disclaimer: I am not familiar with java syntax. Take this suggestion just as an idea but feel free to improve it :)
expected: https://www.example.org/onto1 result: https://www.example.org/onto2