@Override public IRI getOntologyDocumentIRI(OWLOntology ontology) { return delegate.getOntologyDocumentIRI(ontology); }
/** * Saves the specified ontology in the specified ontology format to its document URI. * * @param ontology The ontology to be saved. * @param ontologyFormat The format in which the ontology should be saved. * @throws OWLOntologyStorageException If the ontology cannot be saved. * @throws UnknownOWLOntologyException if the specified ontology is not managed by this manager */ default void saveOntology(OWLOntology ontology, OWLDocumentFormat ontologyFormat) throws OWLOntologyStorageException { saveOntology(ontology, ontologyFormat, getOntologyDocumentIRI(ontology)); }
/** * This constructor can be used if an {@link OWLOntology} object was obtained prior to creating this input * source. The {@link OWLOntology} passed in as an argument is set as the root ontology. No import check * or resolution is performed. * * @param rootOntology * the ontology object that will be returned by {@link #getRootOntology()}. */ public RootOntologySource(OWLOntology rootOntology) { this(rootOntology, rootOntology.getOWLOntologyManager().getOntologyDocumentIRI(rootOntology)); }
/** * Saves the specified ontology in the specified ontology format to its document URI. * * @param ontology The ontology to be saved. * @param ontologyFormat The format in which the ontology should be saved. * @throws OWLOntologyStorageException If the ontology cannot be saved. * @throws UnknownOWLOntologyException if the specified ontology is not managed by this manager */ default void saveOntology(OWLOntology ontology, OWLDocumentFormat ontologyFormat) throws OWLOntologyStorageException { saveOntology(ontology, ontologyFormat, getOntologyDocumentIRI(ontology)); }
/** * Saves the specified ontology in the specified ontology format to its document URI. * * @param ontology The ontology to be saved. * @param ontologyFormat The format in which the ontology should be saved. * @throws OWLOntologyStorageException If the ontology cannot be saved. * @throws UnknownOWLOntologyException if the specified ontology is not managed by this manager */ default void saveOntology(OWLOntology ontology, OWLDocumentFormat ontologyFormat) throws OWLOntologyStorageException { saveOntology(ontology, ontologyFormat, getOntologyDocumentIRI(ontology)); }
/** * This constructor can be used if an {@link OWLOntology} object was obtained prior to creating this input * source. The {@link OWLOntology} passed in as an argument is set as the root ontology. No import check * or resolution is performed. * * @param rootOntology * the ontology object that will be returned by {@link #getRootOntology()}. */ public RootOntologySource(OWLOntology rootOntology) { this(rootOntology, rootOntology.getOWLOntologyManager().getOntologyDocumentIRI(rootOntology)); }
public URI getOntologyPhysicalURI(OWLOntology ontology) { IRI ontologyDocumentIRI = manager.getOntologyDocumentIRI(ontology); if (isDefaultOWLAPIDocumentIRI(ontologyDocumentIRI)) { return URI.create(""); } else { return ontologyDocumentIRI.toURI(); } }
public URI getOntologyPhysicalURI(OWLOntology ontology) { IRI ontologyDocumentIRI = manager.getOntologyDocumentIRI(ontology); if(isDefaultOWLAPIDocumentIRI(ontologyDocumentIRI)) { return URI.create(""); } else { return ontologyDocumentIRI.toURI(); } }
public static File getBackingStore(OWLOntology ontology) { OWLOntologyManager manager = ontology.getOWLOntologyManager(); IRI documentLocation = manager.getOntologyDocumentIRI(ontology); if (!documentLocation.getScheme().equals("file")) { return null; } return new File(documentLocation.toURI()); }
@Override public String getURI() { return this.ontology.getOWLOntologyManager() .getOntologyDocumentIRI(this.ontology).toString(); }
private void ensureCatalogFileExists() { try { OWLOntology activeOntology = getActiveOntology(); IRI ontologyDocumentIRI = manager.getOntologyDocumentIRI(activeOntology); if ("file".equals(ontologyDocumentIRI.getScheme())) { File file = new File(ontologyDocumentIRI.toURI()); File parentDirectory = file.getParentFile(); getOntologyCatalogManager().ensureCatalogExists(parentDirectory); } } catch (IllegalArgumentException e) { logger.error("A problem occurred when trying to save the catalog file: {}", e.getMessage()); } }
private IRI getImportIRIForOntology(OWLOntology root) { if (root.isAnonymous()){ // TODO need a workaround as this will not work // see OWL API bug - https://sourceforge.net/tracker/?func=detail&aid=3110834&group_id=90989&atid=595534 return mngr.getOntologyDocumentIRI(root); } return root.getOntologyID().getDefaultDocumentIRI().orNull(); }
public OWLProfileViolation(OWLOntology ontology, OWLAxiom axiom) { this.axiom = axiom; this.ontologyID = ontology.getOntologyID(); for(OWLOntology ont : ontology.getImportsClosure()) { importsClosureMap.put(ont.getOntologyID(), ont.getOWLOntologyManager().getOntologyDocumentIRI(ont)); } }
public void markSources() { for(OWLOntology ontology : modelManager.getOntologies()) { update(ontology.getOWLOntologyManager().getOntologyDocumentIRI(ontology).toURI()); } }
public void markSources() { for(OWLOntology ontology : modelManager.getOntologies()) { update(ontology.getOWLOntologyManager().getOntologyDocumentIRI(ontology).toURI()); } }
@Override public String getShortForm(OWLOntology ont) { if (ont == rootOntology){ return ServerConstants.ROOT_ONTOLOGY_RENDERING; } if (ont.isAnonymous()){ return getOWLOntologyManager().getOntologyDocumentIRI(ont).toString(); } return super.getShortForm(ont); } };
public static String getOntologyIdString(OWLOntology ont){ if (ont.isAnonymous()){ return ont.getOWLOntologyManager().getOntologyDocumentIRI(ont).toString(); } else{ return ont.getOntologyID().getDefaultDocumentIRI().get().toString(); } }
@Override public OWLOntology loadOntology(URI physicalURI) throws OWLOntologyCreationException { IRI iri = IRI.create(physicalURI); for (OWLOntology ont : getOntologies()){ if (mngr.getOntologyDocumentIRI(ont).equals(iri)){ return ont; } } handleCommonBaseMappers(physicalURI); return mngr.loadOntologyFromOntologyDocument(iri); }
private void addImportMapping(OWLOntology ontology, IRI importLocation, IRI physicalLocation) { OWLOntologyManager manager = ontology.getOWLOntologyManager(); manager.getIRIMappers().add(new SimpleIRIMapper(importLocation, physicalLocation)); IRI importersDocumentLocation = manager.getOntologyDocumentIRI(ontology); if (UIUtil.isLocalFile(importersDocumentLocation.toURI())) { File f = new File(importersDocumentLocation.toURI()); XMLCatalog catalog = editorKit.getModelManager().addRootFolder(f.getParentFile()); URI physicalUri = CatalogUtilities.relativize(physicalLocation.toURI(), catalog); catalog.addEntry(0, new UriEntry("Imports Wizard Entry", catalog, importLocation.toURI().toString(), physicalUri, null)); try { CatalogUtilities.save(catalog, OntologyCatalogManager.getCatalogFile(f.getParentFile())); } catch (IOException e) { logger.warn("An error occurred whilst saving the catalog file: {}", e); } } }
@Override public OWLOntology reloadOntology(OWLOntology ontology) throws OWLOntologyCreationException { URI physicalLocation = getOWLOntologyManager().getOntologyDocumentIRI(ontology).toURI(); mngr.removeOntology(ontology); OWLOntology ont = mngr.loadOntologyFromOntologyDocument(IRI.create(physicalLocation)); resetRootImports(); clear(); return ont; }