@SuppressWarnings("checkstyle:illegalcatch") public static void main(String[] args){
  Options options=handleOptions(Options.class,args);
  WikibaseUris uris=new WikibaseUris(options.wikibaseHost());
  Munger munger=mungerFromOptions(options);
  int port=parsePort(options.to());
  OutputPicker<Writer> to;
  Httpd httpd=null;
  try {
    if (options.chunkSize() > 0) {
      if (port > 0) {
        BlockingQueue<InputStream> queue=new ArrayBlockingQueue<>(2);
        httpd=new Httpd(port,queue);
        to=new ChunkedPipedWriterOutputPicker(queue,options.chunkSize());
      }
 else {
        to=new ChunkedFileWriterOutputPicker(options.to(),options.chunkSize());
      }
    }
 else {
      if (port > 0) {
        PipedInputStream toHttp=new PipedInputStream();
        Writer writer=utf8(new PipedOutputStream(toHttp));
        BlockingQueue<InputStream> queue=new ArrayBlockingQueue<>(1);
        queue.put(toHttp);
        httpd=new Httpd(port,queue);
        to=new AlwaysOutputPicker<>(writer);
      }
 else {
        to=new AlwaysOutputPicker<>(CliUtils.writer(options.to()));
      }
    }
    if (httpd != null) {
      log.info("Starting embedded http sever on port {}",port);
      log.info("This process will exit when the whole dump has been served");
      httpd.start();
    }
  }
 catch (  IOException e) {
    log.error("Error finding output",e);
    System.exit(1);
    return;
  }
catch (  InterruptedException e) {
    log.error("Interrupted while waiting on httpd",e);
    System.exit(1);
    return;
  }
  try {
    Munge munge=new Munge(uris,munger,openInput(options.from()),to);
    munge.run();
  }
 catch (  RuntimeException e) {
    log.error("Fatal error munging RDF",e);
    System.exit(1);
  }
  waitForHttpdToShutDownIfNeeded(httpd);
}

@ SuppressWarnings ( "checkstyle:illegalcatch" ) public static void main ( String [ ] args ) { Options options = handleOptions ( Options . class , args ) ; WikibaseUris uris = new WikibaseUris ( options . wikibaseHost ( ) ) ; Munger munger = mungerFromOptions ( options ) ; int port = parsePort ( options . to ( ) ) ; OutputPicker < Writer > to ; Httpd httpd = null ; try { if ( options . chunkSize ( ) > 0 ) { if ( port > 0 ) { BlockingQueue < InputStream > queue = new ArrayBlockingQueue < > ( 2 ) ; httpd = new Httpd ( port , queue ) ; to = new ChunkedPipedWriterOutputPicker ( queue , options . chunkSize ( ) ) ; } else { to = new ChunkedFileWriterOutputPicker ( options . to ( ) , options . chunkSize ( ) ) ; } } else { if ( port > 0 ) { PipedInputStream toHttp = new PipedInputStream ( ) ; Writer writer = utf8 ( new PipedOutputStream ( toHttp ) ) ; BlockingQueue < InputStream > queue = new ArrayBlockingQueue < > ( 1 ) ; queue . put ( toHttp ) ; httpd = new Httpd ( port , queue ) ; to = new AlwaysOutputPicker < > ( writer ) ; } else { to = new AlwaysOutputPicker < > ( CliUtils . writer ( options . to ( ) ) ) ; } } if ( httpd != null ) { log . info ( "Starting embedded http sever on port {}" , port ) ; log . info ( "This process will exit when the whole dump has been served" ) ; httpd . start ( ) ; } } catch ( IOException e ) { log . error ( "Error finding output" , e ) ; System . exit ( 1 ) ; return ; } catch ( InterruptedException e ) { log . error ( "Interrupted while waiting on httpd" , e ) ; System . exit ( 1 ) ; return ; } try { Munge munge = new Munge ( uris , munger , openInput ( options . from ( ) ) , to ) ; munge . run ( ) ; } catch ( RuntimeException e ) { log . error ( "Fatal error munging RDF" , e ) ; System . exit ( 1 ) ; } waitForHttpdToShutDownIfNeeded ( httpd ) ; }
run a bulk munge configured from the command line .
