public static Explanation < OWLAxiom > load ( InputStream is ) throws IOException { try { OWLOntologyManager manager = OWLManager . createOWLOntologyManager ( ) ; OWLOntology ontology = manager . loadOntologyFromOntologyDocument ( new BufferedInputStream ( is ) ) ; OWLDataFactory df = manager . getOWLDataFactory ( ) ; OWLAnnotationProperty entailmentMarkerAnnotationProperty = df . getOWLAnnotationProperty ( ENTAILMENT_MARKER_IRI ) ; Set < OWLAxiom > justificationAxioms = new HashSet < OWLAxiom > ( ) ; OWLAxiom entailment = null ; for ( OWLAxiom ax : ontology . getAxioms ( ) ) { boolean isEntailmentAxiom = ! ax . getAnnotations ( entailmentMarkerAnnotationProperty ) . isEmpty ( ) ; if ( ! isEntailmentAxiom ) { justificationAxioms . add ( ax ) ; } else { entailment = ax . getAxiomWithoutAnnotations ( ) ; } } if ( entailment == null ) { throw new IllegalStateException ( "Not a serialisation of an Explanation" ) ; } return new Explanation < OWLAxiom > ( entailment , justificationAxioms ) ; } catch ( OWLOntologyCreationException e ) { throw new RuntimeException ( e ) ; } }
Loads a previously stored explanation from the specified input stream