
de.uni_stuttgart.vis.vowl.owl2vowl.converter.InputStreamConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OWL2VOWL Show documentation
Show all versions of OWL2VOWL Show documentation
Owl2Vowl is an ontology converter used to convert the given ontology to a json
format that is used in the WebVOWL visualization. See
https://github.com/VisualDataWeb/WebVOWL or http://vowl.visualdataweb.org/.
The newest version!
package de.uni_stuttgart.vis.vowl.owl2vowl.converter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Collections;
import org.semanticweb.owlapi.apibinding.OWLManager;
/**
*
*/
public class InputStreamConverter extends AbstractConverter {
protected InputStream mainOntology;
protected Collection depdencyOntologies;
private static final Logger logger = LogManager.getLogger(InputStreamConverter.class);
public InputStreamConverter(InputStream ontology) {
this(ontology, Collections.emptyList());
}
public InputStreamConverter(InputStream ontology, Collection necessaryExternals) {
mainOntology = ontology;
depdencyOntologies = Collections.unmodifiableCollection(necessaryExternals);
}
@Override
protected void loadOntology() throws OWLOntologyCreationException {
logger.info("Converting input streams...");
manager = OWLManager.createOWLOntologyManager();
for (InputStream depdencyOntology : depdencyOntologies) {
manager.loadOntologyFromOntologyDocument(depdencyOntology);
}
ontology = manager.loadOntologyFromOntologyDocument(mainOntology);
loadedOntologyPath = "file upload";
String logOntoName;
if (!ontology.isAnonymous()) {
logOntoName = ontology.getOntologyID().getOntologyIRI().get().toString();
} else {
logOntoName = "Anonymous";
logger.info("Ontology IRI is anonymous. Use loaded URI/IRI instead.");
}
logger.info("Ontologies loaded! Main Ontology: " + logOntoName);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy