public class OWLZipSaver extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CATALOG_INDEX_NAME
Catalog entry name
|
static String |
PROPERTIES_INDEX_NAME
Properties entry name
|
static String |
YAML_INDEX_NAME
YAML entry name
|
Constructor and Description |
---|
OWLZipSaver() |
Modifier and Type | Method and Description |
---|---|
String |
catalogIndex(Collection<OWLOntology> roots,
Collection<OWLOntology> ontologies)
Prepare a catalog index; this method can be used as a
BiFunction
for setIndex(BiFunction) . |
String |
entryPath(OWLOntologyID id)
Prepare a zip name for an ontology id; this method can be used as a Function for
setEntryPath . |
String |
propertiesIndex(Collection<OWLOntology> roots,
Collection<OWLOntology> ontologies)
Prepare a properties index; this method can be used as a
BiFunction for setIndex(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> 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 |
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 |
setEntryPath(Function<OWLOntologyID,String> entryPath) |
void |
setIndex(BiFunction<Collection<OWLOntology>,Collection<OWLOntology>,String> index) |
void |
setIndexName(Supplier<String> indexName) |
String |
yamlIndex(Collection<OWLOntology> roots,
Collection<OWLOntology> ontologies)
Prepare a yaml index; this method can be used as a
BiFunction for
setIndex(BiFunction) . |
public static final String YAML_INDEX_NAME
public static final String PROPERTIES_INDEX_NAME
public static final String CATALOG_INDEX_NAME
public void setEntryPath(Function<OWLOntologyID,String> entryPath)
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.public void setIndex(BiFunction<Collection<OWLOntology>,Collection<OWLOntology>,String> index)
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.public void setIndexName(Supplier<String> indexName)
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.public void saveImportsClosure(OWLOntology root, OutputStream out) throws IOException, OWLOntologyStorageException
root
- root ontology to saveout
- output stream; to be created by the caller, closed in this methodIOException
- if writing to the file failsOWLOntologyStorageException
- if serializing the ontologies failspublic void saveImportsClosures(Collection<OWLOntology> roots, OutputStream out) throws IOException, OWLOntologyStorageException
roots
- root ontologies to saveout
- output stream; to be created by the caller, closed in this methodIOException
- if writing to the file failsOWLOntologyStorageException
- if serializing the ontologies failspublic void saveOntologies(Collection<OWLOntology> ontologies, OutputStream out) throws IOException, OWLOntologyStorageException
ontologies
- ontologies to saveout
- output stream; to be created by the caller, closed in this methodIOException
- if writing to the file failsOWLOntologyStorageException
- if serializing the ontologies failspublic void saveOntologies(Collection<OWLOntology> roots, Collection<OWLOntology> ontologies, OutputStream out) throws IOException, OWLOntologyStorageException
roots
- root ontologiesontologies
- ontologies to saveout
- output stream; to be created by the caller, closed in this methodIOException
- if writing to the file failsOWLOntologyStorageException
- if serializing the ontologies failspublic String catalogIndex(Collection<OWLOntology> roots, Collection<OWLOntology> ontologies)
BiFunction
for setIndex(BiFunction)
. Imports statements are not navigated; all ontologies
required have to appear explicitly in the collections.roots
- collection of roots, if anyontologies
- collection of ontologies, if anypublic String yamlIndex(Collection<OWLOntology> roots, Collection<OWLOntology> ontologies)
BiFunction
for
setIndex(BiFunction)
. Imports statements are not navigated; all ontologies required
have to appear explicitly in the collections.roots
- collection of roots, if anyontologies
- collection of ontologies, if anypublic String propertiesIndex(Collection<OWLOntology> roots, Collection<OWLOntology> ontologies)
BiFunction
for setIndex(BiFunction)
. Imports statements
are not navigated; all ontologies required have to appear explicitly in the collections.roots
- collection of roots, if anyontologies
- collection of ontologies, if anypublic String entryPath(OWLOntologyID id)
setEntryPath
.id
- ontology idCopyright © 2020 The University of Manchester. All rights reserved.