Exemplo n.º 1
0
 /* (non-Javadoc)
  * @see com.semagia.mio.rdf.IMappingReader#read()
  */
 @Override
 public void read(final Source source) throws IOException, MIOException {
   // TODO: check for characterstream / bytestream
   _parser.setRDFHandler(new RDFStatementHandler());
   final InputStream stream = new BufferedInputStream(new URL(source.getIRI()).openStream());
   _handler.start();
   try {
     _parser.parse(stream, source.getBaseIRI());
   } catch (OpenRDFException ex) {
     if (ex.getCause() instanceof MIOException) {
       throw (MIOException) ex.getCause();
     }
     if (ex instanceof RDFParseException) {
       throw new MIOParseException(
           ex,
           ((RDFParseException) ex).getLineNumber(),
           ((RDFParseException) ex).getColumnNumber());
     }
     throw new MIOException(ex);
   } finally {
     if (stream != null) {
       stream.close();
     }
   }
   _buildMapping();
   _handler.end();
   _mappings.clear();
 }