public static void store ( Explanation < OWLAxiom > explanation , OutputStream os ) throws IOException { try { OWLOntologyManager manager = OWLManager . createOWLOntologyManager ( ) ; OWLOntology ontology = manager . createOntology ( explanation . getAxioms ( ) ) ; OWLDataFactory df = manager . getOWLDataFactory ( ) ; OWLAnnotationProperty entailmentMarkerAnnotationProperty = df . getOWLAnnotationProperty ( ENTAILMENT_MARKER_IRI ) ; OWLAnnotation entailmentAnnotation = df . getOWLAnnotation ( entailmentMarkerAnnotationProperty , df . getOWLLiteral ( true ) ) ; OWLAxiom annotatedEntailment = explanation . getEntailment ( ) . getAnnotatedAxiom ( Collections . singleton ( entailmentAnnotation ) ) ; manager . addAxiom ( ontology , annotatedEntailment ) ; BufferedOutputStream bufferedOutputStream = new BufferedOutputStream ( os ) ; OWLXMLDocumentFormat justificationOntologyFormat = new OWLXMLDocumentFormat ( ) ; manager . saveOntology ( ontology , justificationOntologyFormat , bufferedOutputStream ) ; } catch ( OWLOntologyStorageException | OWLOntologyCreationException e ) { throw new RuntimeException ( e ) ; } }
Stores the specified explanation to the specified output stream