In the new API, the ontology identifier is either the version IRI or the
ontology IRI. The document IRI is not an identifier.
Perhaps this is a flaw - document support was added at the last moment, and for
managing imports closure no document-manager is needed.
Typical work with documents can be like this:
```
DocumentGraphRepository repository =
GraphRepository.createGraphDocumentRepositoryMem();
repository.addMapping(
"http://www.co-ode.org/ontologies/pizza/pizza.owl",
documentPath);
OntModel m = OntModelFactory.getModelOrNull(
"http://www.co-ode.org/ontologies/pizza/pizza.owl",
OntSpecification.OWL2_DL_MEM_BUILTIN_RDFS_INF,
repository);
m.write(System.out, "ttl");
```
Here, `http://www.co-ode.org/ontologies/pizza/pizza.owl` is an ontology IRI.
`DocumentGraphRepository` manages mappings between documents and ontologies.
If you think that some functionality is missing, please open a github issue.
By the way, the external library owlcs/ontapi, which works on top of
apache-ontapi, has its own full-fledged ontology manager, which works according
to the specification, i.e. the ontology identifier can also be a document IRI.
On 2024/08/07 11:15:58 Steve Vestal wrote:
> I have some questions about doing an OWL import closure. My
> understanding is that an Import for an owl:Ontology can use any of a
> URL, an ontology IRI, or a version IRI to access an OWL document.
> Different documents that have the same ontology IRI may be accessed
> using different URLs, either identical copies or with different version
> IRIs.
>
> The link given on the page
> https://jena.apache.org/documentation/ontology/#graphrepository
> (https://jena.apache.org/documentation/javadoc/jena/org.apache.jena.ontapi/org/apache/jena/ontapi/GraphRepository.html)
>
> gets a "URL was not found" error. A search didn't turn it up. What
> package contains this class?
>
> That page says "By default, when an ontology model reads an ontology
> document, it will/not/locate and load the document’s imports." A search
> of this page did not find OntDocumentManager, which I have been using.
> FileManager seems to be deprecated in favor of RDFDataMgr. Will
> OntDocumentManager be deprecated or modified?
>
> What is the recommended way to accumulate a set of URLs, ontology IRIs,
> and version IRIs, and use that set to do an import closure?
>