Package org.semanticweb.owlapi.util
Class OWLZipSaver
java.lang.Object
org.semanticweb.owlapi.util.OWLZipSaver
Class for saving ontologies to zip files with an optional index.
- Author:
- ignazio
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncatalogIndex
(Collection<OWLOntology> roots, Collection<OWLOntology> ontologies) Prepare a catalog index; this method can be used as aBiFunction
forsetIndex(BiFunction)
.Prepare a zip name for an ontology id; this method can be used as a Function forsetEntryPath
.propertiesIndex
(Collection<OWLOntology> roots, Collection<OWLOntology> ontologies) Prepare a properties index; this method can be used as aBiFunction
forsetIndex(BiFunction)
.void
saveImportsClosure
(OWLOntology root, OutputStream out) Save the root ontology as root in the index and its imports closure as companion ontologies.void
saveImportsClosures
(Collection<OWLOntology> roots, OutputStream out) Save the root ontologies as root in the index and their imports closures as companion ontologies.void
saveOntologies
(Collection<OWLOntology> ontologies, OutputStream out) Save the ontologies in the index and their content as companion ontologies; no ontology will be marked as root.void
saveOntologies
(Collection<OWLOntology> roots, Collection<OWLOntology> ontologies, OutputStream out) Save the ontologies in the index, marking as root the ontologies in the roots collection; the other ontologies will be saved as companion ontologies.void
setEntryPath
(Function<OWLOntologyID, String> entryPath) void
void
setIndexName
(Supplier<String> indexName) yamlIndex
(Collection<OWLOntology> roots, Collection<OWLOntology> ontologies) Prepare a yaml index; this method can be used as aBiFunction
forsetIndex(BiFunction)
.
-
Field Details
-
YAML_INDEX_NAME
YAML entry name- See Also:
-
PROPERTIES_INDEX_NAME
Properties entry name- See Also:
-
CATALOG_INDEX_NAME
Catalog entry name- See Also:
-
-
Constructor Details
-
OWLZipSaver
public OWLZipSaver()
-
-
Method Details
-
setEntryPath
- Parameters:
entryPath
- function to use to generate the path in the zip file for an ontology. The default strategy is to use the last part of the ontology IRI.
-
setIndex
- Parameters:
index
- function to use to generate the index content. The default strategy is to create a YAML file. The methods on this class can be passed here to switch to different strategies, or a user defined strategy can be used.
-
setIndexName
- Parameters:
indexName
- the name for the index entry. This defaults to owlzip.yaml; other known values are owlzip.poperties and catalog-v001.xml. A supplier that returns a null or empty string will cause the class to skip creating an index; in that case, the ontologies will just be compressed.
-
saveImportsClosure
public void saveImportsClosure(OWLOntology root, OutputStream out) throws IOException, OWLOntologyStorageException Save the root ontology as root in the index and its imports closure as companion ontologies.- Parameters:
root
- root ontology to saveout
- output stream; to be created by the caller, closed in this method- Throws:
IOException
- if writing to the file failsOWLOntologyStorageException
- if serializing the ontologies fails
-
saveImportsClosures
public void saveImportsClosures(Collection<OWLOntology> roots, OutputStream out) throws IOException, OWLOntologyStorageException Save the root ontologies as root in the index and their imports closures as companion ontologies.- Parameters:
roots
- root ontologies to saveout
- output stream; to be created by the caller, closed in this method- Throws:
IOException
- if writing to the file failsOWLOntologyStorageException
- if serializing the ontologies fails
-
saveOntologies
public void saveOntologies(Collection<OWLOntology> ontologies, OutputStream out) throws IOException, OWLOntologyStorageException Save the ontologies in the index and their content as companion ontologies; no ontology will be marked as root.- Parameters:
ontologies
- ontologies to saveout
- output stream; to be created by the caller, closed in this method- Throws:
IOException
- if writing to the file failsOWLOntologyStorageException
- if serializing the ontologies fails
-
saveOntologies
public void saveOntologies(Collection<OWLOntology> roots, Collection<OWLOntology> ontologies, OutputStream out) throws IOException, OWLOntologyStorageException Save the ontologies in the index, marking as root the ontologies in the roots collection; the other ontologies will be saved as companion ontologies. This method assumes the caller takes care of flattening ontology imports closures, and will not navigate imports statements.- Parameters:
roots
- root ontologiesontologies
- ontologies to saveout
- output stream; to be created by the caller, closed in this method- Throws:
IOException
- if writing to the file failsOWLOntologyStorageException
- if serializing the ontologies fails
-
catalogIndex
Prepare a catalog index; this method can be used as aBiFunction
forsetIndex(BiFunction)
. Imports statements are not navigated; all ontologies required have to appear explicitly in the collections.- Parameters:
roots
- collection of roots, if anyontologies
- collection of ontologies, if any- Returns:
- content of a catalog index for the input ontologies
-
yamlIndex
Prepare a yaml index; this method can be used as aBiFunction
forsetIndex(BiFunction)
. Imports statements are not navigated; all ontologies required have to appear explicitly in the collections.- Parameters:
roots
- collection of roots, if anyontologies
- collection of ontologies, if any- Returns:
- content of a yaml index for the input ontologies
-
propertiesIndex
Prepare a properties index; this method can be used as aBiFunction
forsetIndex(BiFunction)
. Imports statements are not navigated; all ontologies required have to appear explicitly in the collections.- Parameters:
roots
- collection of roots, if anyontologies
- collection of ontologies, if any- Returns:
- content of a properties index for the input ontologies
-
entryPath
Prepare a zip name for an ontology id; this method can be used as a Function forsetEntryPath
.- Parameters:
id
- ontology id- Returns:
- zip entry name for the ontology
-