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."); }
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { logger.info("-------------------------------------"); logger.info("Loading CSV."); logger.info("-------------------------------------"); this.g = g; loadConf(conf); loadCSV(conf.getLoc()); logger.info("CSV specification loaded."); logger.info("-------------------------------------"); }
return new RDFLoader(RDFFormat.TURTLE); } else if (data.getFormat() == GFormat.CSV) { return new GraphLoader_CSV(); } else if (data.getFormat() == GFormat.SNOMED_CT_RF2) { return new GraphLoaderSnomedCT_RF2();
return new RDFLoader(RDFFormat.TURTLE); } else if (data.getFormat() == GFormat.CSV) { return new GraphLoader_CSV(); } else if (data.getFormat() == GFormat.SNOMED_CT_RF2) { return new GraphLoaderSnomedCT_RF2();
@Override public void populate(GDataConf conf, G g) throws SLIB_Exception { logger.info("-------------------------------------"); logger.info("Loading CSV."); logger.info("-------------------------------------"); this.g = g; loadConf(conf); loadCSV(conf.getLoc()); logger.info("CSV specification loaded."); logger.info("-------------------------------------"); }
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."); }