public OWLEntityCreationSet<T> getOWLEntityCreationSet(EntityCreationMode preview) throws RuntimeException { try { if (isEntityIRI()) { IRI iri = getRawIRI(); OWLOntology ontology = owlEditorKit.getModelManager().getActiveOntology(); OWLDataFactory factory = owlEditorKit.getModelManager().getOWLDataFactory(); T owlEntity = CustomOWLEntityFactory.getOWLEntity(factory, type, iri); OWLOntologyChange addDecl = new AddAxiom(ontology, factory.getOWLDeclarationAxiom(owlEntity)); return new OWLEntityCreationSet<>(owlEntity, Collections.singletonList(addDecl)); } else { switch (preview) { case CREATE: return owlEditorKit.getModelManager().getOWLEntityFactory().createOWLEntity(type, getEntityName(), getBaseIRI()); case PREVIEW: return owlEditorKit.getModelManager().getOWLEntityFactory().preview(type, getEntityName(), getBaseIRI()); default: throw new IllegalStateException("Programmer error - report this (with stack trace) to the Protege 4 mailing list"); } } } catch (OWLEntityCreationException e) { throw new RuntimeException(e); } }
public OWLEntityCreationSet<T> getOWLEntityCreationSet(EntityCreationMode preview) throws RuntimeException { try { if (isEntityIRI()) { IRI iri = getRawIRI(); OWLOntology ontology = owlEditorKit.getModelManager().getActiveOntology(); OWLDataFactory factory = owlEditorKit.getModelManager().getOWLDataFactory(); T owlEntity = CustomOWLEntityFactory.getOWLEntity(factory, type, iri); OWLOntologyChange addDecl = new AddAxiom(ontology, factory.getOWLDeclarationAxiom(owlEntity)); return new OWLEntityCreationSet<T>(owlEntity, Collections.singletonList(addDecl)); } else { switch (preview) { case CREATE: return owlEditorKit.getModelManager().getOWLEntityFactory().createOWLEntity(type, getEntityName(), getBaseIRI()); case PREVIEW: return owlEditorKit.getModelManager().getOWLEntityFactory().preview(type, getEntityName(), getBaseIRI()); default: throw new IllegalStateException("Programmer error - report this (with stack trace) to the Protege 4 mailing list"); } } } catch (OWLEntityCreationException e) { throw new RuntimeException(e); } }
public OWLEntityCreationSet<T> getOWLEntityCreationSet(EntityCreationMode preview) throws RuntimeException { try { if (isEntityIRI()) { IRI iri = getRawIRI(); return getCreationSetForIri(iri); } else if(isOboId()) { IRI iri = OboUtilities.getOboLibraryIriFromOboId(getEntityName()); if(owlEditorKit.getOWLModelManager().getActiveOntology().containsEntityInSignature(iri, Imports.INCLUDED)) { throw new OWLEntityCreationException("Entity already exists: " + iri); } return getCreationSetForIri(iri); } else { switch (preview) { case CREATE: return owlEditorKit.getModelManager().getOWLEntityFactory().createOWLEntity(type, getEntityName(), getBaseIRI()); case PREVIEW: return owlEditorKit.getModelManager().getOWLEntityFactory().preview(type, getEntityName(), getBaseIRI()); default: throw new IllegalStateException("Programmer error - report this (with stack trace) to the Protege 4 mailing list"); } } } catch (OWLEntityCreationException e) { throw new RuntimeException(e); } }
OWLEntityCreationSet<T> changeSet = owlEditorKit.getModelManager().getOWLEntityFactory().preview(type, name, getBaseIRI());