@Override
 public OWLOntologyFormat parse(
     OWLOntologyDocumentSource documentSource,
     OWLOntology ontology,
     OWLOntologyLoaderConfiguration configuration)
     throws OWLParserException, IOException, OWLOntologyChangeException,
         UnloadableImportException {
   Reader reader = null;
   InputStream is = null;
   try {
     OWLFunctionalSyntaxParser parser;
     if (documentSource.isReaderAvailable()) {
       reader = documentSource.getReader();
       parser = new OWLFunctionalSyntaxParser(reader);
     } else if (documentSource.isInputStreamAvailable()) {
       is = documentSource.getInputStream();
       parser = new OWLFunctionalSyntaxParser(is);
     } else {
       is = getInputStream(documentSource.getDocumentIRI(), configuration);
       parser = new OWLFunctionalSyntaxParser(is);
     }
     parser.setUp(ontology, configuration);
     return parser.parse();
   } catch (ParseException e) {
     throw new OWLParserException(
         e.getMessage(), e, e.currentToken.beginLine, e.currentToken.beginColumn);
   } finally {
     if (is != null) {
       is.close();
     } else if (reader != null) {
       reader.close();
     }
   }
 }
예제 #2
0
 @Test
 public void shouldTestInterfaceOWLOntologyDocumentSource() throws Exception {
   OWLOntologyDocumentSource testSubject0 = mock(OWLOntologyDocumentSource.class);
   InputStream result0 = testSubject0.getInputStream();
   boolean result1 = testSubject0.isReaderAvailable();
   Reader result2 = testSubject0.getReader();
   boolean result3 = testSubject0.isInputStreamAvailable();
   IRI result4 = testSubject0.getDocumentIRI();
 }