@@ -245,6 +245,10 @@ public class OWLRDFConsumer
245245 * IRIs that had a type triple to owl:Ontology
246246 */
247247 private final Set <IRI > ontologyIRIs = createSet ();
248+ /**
249+ * IRIs that represent a subject for predicate owl:imports
250+ */
251+ private final Set <IRI > ontologySubImportIRIs = createSet ();
248252 /**
249253 * IRIs that had a type triple to owl:Restriction
250254 */
@@ -1467,7 +1471,7 @@ private void chooseAndSetOntologyIRI() {
14671471 // Choose one that isn't the object of an annotation assertion
14681472 Set <IRI > candidateIRIs = createSet (ontologyIRIs );
14691473 ontology .annotations ().forEach (a -> a .getValue ().asIRI ().ifPresent (iri -> {
1470- if (ontologyIRIs .contains (iri )) {
1474+ if (ontologyIRIs .contains (iri )&& ! ontologySubImportIRIs . contains ( iri ) ) {
14711475 candidateIRIs .remove (iri );
14721476 }
14731477 }));
@@ -2212,13 +2216,27 @@ protected void addFirst(IRI subject, OWLLiteral object) {
22122216 * Adds the ontology.
22132217 *
22142218 * @param iri the iri
2219+ * @param owlImportSubject Is the iri used as subject for predicate
2220+ * owl:imports
22152221 */
2216- protected void addOntology (IRI iri ) {
2222+ protected void addOntology (IRI iri , boolean owlImportSubject ) {
22172223 if (ontologyIRIs .isEmpty ()) {
22182224 firstOntologyIRI = iri ;
22192225 }
2226+ if (owlImportSubject ) {
2227+ ontologySubImportIRIs .add (iri );
2228+ }
22202229 ontologyIRIs .add (iri );
22212230 }
2231+ /**
2232+ * Overload method of addOntology with
2233+ * no owl:import subject iri
2234+ *
2235+ * @param iri the iri
2236+ */
2237+ protected void addOntology (IRI iri ) {
2238+ addOntology (iri , false );
2239+ }
22222240
22232241 /**
22242242 * Adds the ontology version.
0 commit comments