use of uk.ac.manchester.cs.owl.owlapi.mansyntaxrenderer.ManchesterOWLSyntaxOntologyStorer in project stanbol by apache.
the class ResponseTaskBuilder method stream.
/**
* This supports OWLOntology and jena Model objects.
* In the case of Jena the reuslt is printed as Turtle,
* in case of OWLApi the result is in Manchester syntax (more readable).
*
* FIXME: Both should return the same format
*
* @param object
* @return
*/
private OutputStream stream(Object object) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
if (object instanceof OWLOntology) {
OWLOntology o = (OWLOntology) object;
ManchesterOWLSyntaxOntologyStorer mosos = new ManchesterOWLSyntaxOntologyStorer();
try {
mosos.storeOntology(o.getOWLOntologyManager(), o, new StreamDocumentTarget(out), new ManchesterOWLSyntaxOntologyFormat());
} catch (OWLOntologyStorageException e) {
log.error("Cannot stream the ontology", e);
throw new RuntimeException(e);
}
} else if (object instanceof Model) {
Model m = (Model) object;
// FIXME Both should return the same format
m.write(out, "TURTLE");
}
return out;
}
Aggregations