private void loadCSV(String filepath) throws SLIB_Exception { long evaluated = 0; // number of statements evaluated according to the templates defined long rejected = 0; // those excluded due to specified constraints. try { FileInputStream fstream = new FileInputStream(filepath); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line; String[] data; while ((line = br.readLine()) != null) { if (skipHeader) { skipHeader = false; continue; } line = line.trim(); data = pattern.split(line); for (CSV_StatementTemplate t : statementTemplates.values()) { if (!buildStatement(t, data)) { rejected++; } evaluated++; } } in.close(); } catch (IOException e) { throw new SLIB_Ex_Critic(e.getMessage()); } logger.info("Number of statements rejected due to constraint: " + rejected + "/" + evaluated); logger.info("CSV Loading ok."); }
private void loadCSV(String filepath) throws SLIB_Exception { long evaluated = 0; // number of statements evaluated according to the templates defined long rejected = 0; // those excluded due to specified constraints. try { FileInputStream fstream = new FileInputStream(filepath); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line; String[] data; while ((line = br.readLine()) != null) { if (skipHeader) { skipHeader = false; continue; } line = line.trim(); data = pattern.split(line); for (CSV_StatementTemplate t : statementTemplates.values()) { if (!buildStatement(t, data)) { rejected++; } evaluated++; } } in.close(); } catch (IOException e) { throw new SLIB_Ex_Critic(e.getMessage()); } logger.info("Number of statements rejected due to constraint: " + rejected + "/" + evaluated); logger.info("CSV Loading ok."); }