default <T extends OWLEntity> OWLEntityCreationSet<T> createOWLEntity(EntityType<T> entityType, String shortName, Optional<IRI> baseIRI) throws OWLEntityCreationException { if (entityType == EntityType.CLASS) { return (OWLEntityCreationSet<T>) this.createOWLClass(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLObjectProperty(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLDataProperty(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLAnnotationProperty(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLIndividual(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLDatatype(shortName, null);
private OWLEntityCreationSet<E> createEntity(@Nonnull String name) { try { return entityFactory.createOWLEntity(entityType, name, Optional.empty()); } 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<>(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); } }
protected OWLClass getOWLClass(String name){ OWLClass cls = nameMap.get(name); if (cls == null){ try { OWLEntityCreationSet<OWLClass> creationSet = entityFactory.createOWLClass(name, null); changes.addAll(creationSet.getOntologyChanges()); cls = creationSet.getOWLEntity(); nameMap.put(name, cls); } catch (OWLEntityCreationException e) { ErrorLogPanel.showErrorDialog(e); } } return cls; }
OWLEntityCreationSet<T> changeSet = owlEditorKit.getModelManager().getOWLEntityFactory().preview(type, name, getBaseIRI());
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); } }
protected OWLClass getOWLClass(String name){ OWLClass cls = nameMap.get(name); if (cls == null){ try { OWLEntityCreationSet<OWLClass> creationSet = entityFactory.createOWLClass(name, null); changes.addAll(creationSet.getOntologyChanges()); cls = creationSet.getOWLEntity(); nameMap.put(name, cls); } catch (OWLEntityCreationException e) { ErrorLogPanel.showErrorDialog(e); } } return cls; }
default <T extends OWLEntity> OWLEntityCreationSet<T> createOWLEntity(EntityType<T> entityType, String shortName, Optional<IRI> baseIRI) throws OWLEntityCreationException { if (entityType == EntityType.CLASS) { return (OWLEntityCreationSet<T>) this.createOWLClass(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLObjectProperty(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLDataProperty(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLAnnotationProperty(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLIndividual(shortName, null); return (OWLEntityCreationSet<T>) this.createOWLDatatype(shortName, null);
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); } }
private OWLEntityCreationSet<E> createEntity(@Nonnull String name) { try { return entityFactory.createOWLEntity(entityType, name, Optional.empty()); } catch (OWLEntityCreationException e) { throw new RuntimeException(e); } } }
protected OWLClass getOWLClass(String name){ OWLClass cls = nameMap.get(name); if (cls == null){ try { OWLEntityCreationSet<OWLClass> creationSet = entityFactory.createOWLClass(name, null); changes.addAll(creationSet.getOntologyChanges()); cls = creationSet.getOWLEntity(); nameMap.put(name, cls); } catch (OWLEntityCreationException e) { ErrorLogPanel.showErrorDialog(e); } } return cls; }
private OWLEntity getEntity(OWLEntity entity, String id, IRI base) { try { return fac.createOWLEntity(entity.getClass(), id, base).getOWLEntity(); } catch (OWLEntityCreationException e) { throw new RuntimeException(e); } }
protected OWLClass getOWLClass(String name){ OWLClass cls = nameMap.get(name); if (cls == null){ try { OWLEntityCreationSet<OWLClass> creationSet = entityFactory.createOWLClass(name, null); changes.addAll(creationSet.getOntologyChanges()); cls = creationSet.getOWLEntity(); nameMap.put(name, cls); } catch (OWLEntityCreationException e) { ErrorLogPanel.showErrorDialog(e); } } return cls; }
private OWLEntity getEntity(OWLEntity entity, String id, IRI base) { try { return fac.createOWLEntity(entity.getClass(), id, base).getOWLEntity(); } catch (OWLEntityCreationException e) { throw new RuntimeException(e); } }
private OWLEntity getEntity(OWLEntity entity, String id, IRI base) { try { return fac.createOWLEntity(entity.getClass(), id, base).getOWLEntity(); } catch (OWLEntityCreationException e) { throw new RuntimeException(e); } }
private OWLEntity getEntity(OWLEntity entity, String id, IRI base) { try { return fac.createOWLEntity(entity.getClass(), id, base).getOWLEntity(); } 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; } }