public <T extends OWLEntity> OWLEntityCreationSet<T> preview(Class<T> type, String shortName, IRI base) throws OWLEntityCreationException { // There is probably a better way round this. if (getAutoIDGenerator() instanceof Revertable){ ((Revertable)getAutoIDGenerator()).checkpoint(); } try{ return createOWLEntity(type, shortName, base); } catch(OWLEntityCreationException e){ throw e; } finally{ if (getAutoIDGenerator() instanceof Revertable){ ((Revertable)getAutoIDGenerator()).revert(); } } }
public <T extends OWLEntity> OWLEntityCreationSet<T> preview(Class<T> type, String shortName, IRI base) throws OWLEntityCreationException { // There is probably a better way round this. if (getAutoIDGenerator() instanceof Revertable){ ((Revertable)getAutoIDGenerator()).checkpoint(); } try{ return createOWLEntity(type, shortName, base); } catch(OWLEntityCreationException e){ throw e; } finally{ if (getAutoIDGenerator() instanceof Revertable){ ((Revertable)getAutoIDGenerator()).revert(); } } }
public <T extends OWLEntity> OWLEntityCreationSet<T> preview(Class<T> type, String shortName, IRI base) throws OWLEntityCreationException { // There is probably a better way round this. if (getAutoIDGenerator() instanceof Revertable){ ((Revertable)getAutoIDGenerator()).checkpoint(); } try{ return createOWLEntity(type, shortName, base); } catch(OWLEntityCreationException e){ throw e; } finally{ if (getAutoIDGenerator() instanceof Revertable){ ((Revertable)getAutoIDGenerator()).revert(); } } }
public <T extends OWLEntity> OWLEntityCreationSet<T> preview(Class<T> type, String shortName, IRI base) throws OWLEntityCreationException { // There is probably a better way round this. if (getAutoIDGenerator() instanceof Revertable){ ((Revertable)getAutoIDGenerator()).checkpoint(); } try{ return createOWLEntity(type, shortName, base); } catch(OWLEntityCreationException e){ throw e; } finally{ if (getAutoIDGenerator() instanceof Revertable){ ((Revertable)getAutoIDGenerator()).revert(); } } }
Set<IRI> tried = new HashSet<>(); do{ id = getAutoIDGenerator().getNextID(type); iri = createIRI(id, baseURI); if (!tried.contains(iri)) { id = getAutoIDGenerator().getNextID(type); // critical it is unique?
Set<IRI> tried = new HashSet<>(); do{ id = getAutoIDGenerator().getNextID(type); iri = createIRI(id, baseURI); if (!tried.contains(iri)) { id = getAutoIDGenerator().getNextID(type); // critical it is unique?
Set<IRI> tried = new HashSet<IRI>(); do{ id = getAutoIDGenerator().getNextID(type); iri = createIRI(id, baseURI); if (!tried.contains(iri)) { id = getAutoIDGenerator().getNextID(type); // critical it is unique?
protected <T extends OWLEntity> EntityNameInfo generateName(Class<T> type, String shortName, IRI baseURI) throws AutoIDException, URISyntaxException, OWLEntityCreationException { if (baseURI == null){ if (useDefaultBaseIRI() || mngr.getActiveOntology().getOntologyID().isAnonymous()){ baseURI = getDefaultBaseIRI(); } else{ baseURI = mngr.getActiveOntology().getOntologyID().getOntologyIRI(); } } IRI iri; String id = null; if (isFragmentAutoGenerated()){ do{ id = getAutoIDGenerator().getNextID(type); iri = createIRI(id, baseURI); } while (isIRIAlreadyUsed(iri)); // don't pun unnecessarily } else { iri = createIRI(shortName, baseURI); if (isIRIAlreadyUsed(type, iri)){ throw new OWLEntityCreationException("Entity already exists: " + iri); } if (isGenerateIDLabel()){ id = getAutoIDGenerator().getNextID(type); // critical it is unique? } } return new EntityNameInfo(iri, id, shortName); }