private OWLEntityCreationSet<T> getCreationSetForIri(IRI iri) { 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)); }
public <T extends OWLEntity> OWLEntityCreationSet<T> createOWLEntity(Class<T> type, String shortName, IRI baseURI) throws OWLEntityCreationException { try { EntityNameInfo name = generateName(type, shortName, baseURI); T entity = getOWLEntity(mngr.getOWLDataFactory(), type, name.getIri()); List<OWLOntologyChange> changes = getChanges(entity, name); return new OWLEntityCreationSet<>(entity, changes); } catch (URISyntaxException | AutoIDException e) { throw new OWLEntityCreationException(e); } }
public <T extends OWLEntity> OWLEntityCreationSet<T> createOWLEntity(Class<T> type, String shortName, IRI baseURI) throws OWLEntityCreationException { try { EntityNameInfo name = generateName(type, shortName, baseURI); T entity = getOWLEntity(mngr.getOWLDataFactory(), type, name.getIri()); List<OWLOntologyChange> changes = getChanges(entity, name); return new OWLEntityCreationSet<>(entity, changes); } catch (URISyntaxException | AutoIDException e) { throw new OWLEntityCreationException(e); } }
public <T extends OWLEntity> OWLEntityCreationSet<T> createOWLEntity(Class<T> type, String shortName, IRI baseURI) throws OWLEntityCreationException { try { EntityNameInfo name = generateName(type, shortName, baseURI); T entity = getOWLEntity(mngr.getOWLDataFactory(), type, name.getIri()); List<OWLOntologyChange> changes = getChanges(entity, name); return new OWLEntityCreationSet<T>(entity, changes); } catch (URISyntaxException e) { throw new OWLEntityCreationException(e); } catch (AutoIDException e) { throw new OWLEntityCreationException(e); } }
public <T extends OWLEntity> OWLEntityCreationSet<T> createOWLEntity(Class<T> type, String shortName, IRI baseURI) throws OWLEntityCreationException { try { EntityNameInfo name = generateName(type, shortName, baseURI); T entity = getOWLEntity(mngr.getOWLDataFactory(), type, name.getIri()); List<OWLOntologyChange> changes = getChanges(entity, name); return new OWLEntityCreationSet<T>(entity, changes); } catch (URISyntaxException e) { throw new OWLEntityCreationException(e); } catch (AutoIDException e) { throw new OWLEntityCreationException(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<>(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() { try { if (useRawIri()) { 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 { return owlEditorKit.getModelManager().getOWLEntityFactory().createOWLEntity(type, getEntityName(), getBaseIRI()); } } catch (OWLEntityCreationException e) { return null; } }