public void runQuery(String sparql,String hdfsSaveLocation) throws IOException {
  Preconditions.checkNotNull(sparql,"Sparql query cannot be null");
  Preconditions.checkNotNull(hdfsSaveLocation,"Hdfs save location cannot be null");
  logger.info("Running query[" + sparql + "]\n to Location["+ hdfsSaveLocation+ "]");
  pigServer.deleteFile(hdfsSaveLocation);
  try {
    String pigScript=generatePigScript(sparql);
    if (logger.isDebugEnabled()) {
      logger.debug("Pig script [" + pigScript + "]");
    }
    pigServer.registerScript(new ByteArrayInputStream(pigScript.getBytes()));
    pigServer.store("PROJ",hdfsSaveLocation);
  }
 catch (  Exception e) {
    throw new IOException(e);
  }
}

public void runQuery ( String sparql , String hdfsSaveLocation ) throws IOException { Preconditions . checkNotNull ( sparql , "Sparql query cannot be null" ) ; Preconditions . checkNotNull ( hdfsSaveLocation , "Hdfs save location cannot be null" ) ; logger . info ( "Running query[" + sparql + "]\n to Location[" + hdfsSaveLocation + "]" ) ; pigServer . deleteFile ( hdfsSaveLocation ) ; try { String pigScript = generatePigScript ( sparql ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Pig script [" + pigScript + "]" ) ; } pigServer . registerScript ( new ByteArrayInputStream ( pigScript . getBytes ( ) ) ) ; pigServer . store ( "PROJ" , hdfsSaveLocation ) ; } catch ( Exception e ) { throw new IOException ( e ) ; } }
transform a sparql query into a pig script and execute it . save results in hdfssavelocation
