String [] header = reader.getHeader(true); while (true) { Map<String, String> row = reader.read(header);
String [] header = reader.getHeader(true); while (true) { Map<String, String> row = reader.read(header);
static public TableEvaluationRequest readTable(BufferedReader reader, CsvPreference format) throws IOException { CsvMapReader parser = new CsvMapReader(reader, format); String[] header = parser.getHeader(true); List<String> columns = Arrays.asList(header); TableEvaluationRequest tableRequest = new TableEvaluationRequest() .setColumns(columns); String idColumn = tableRequest.getIdColumn(); List<EvaluationRequest> requests = new ArrayList<>(); while(true){ Map<String, String> row = parser.read(header); if(row == null){ break; } String id = null; if(idColumn != null){ id = row.remove(idColumn); } EvaluationRequest request = new EvaluationRequest(id) .setArguments(row); requests.add(request); } tableRequest.setRequests(requests); parser.close(); return tableRequest; }
/** * TODO: keep track of duplicate or missing keys with special status codes * @param shapeFile * @return * @throws IOException */ private Map<String, MappingInfo> readExisting(WikiBrainShapeFile shapeFile) throws IOException { HashMap<String, MappingInfo> mapping = new HashMap<String, MappingInfo>(); if (!shapeFile.hasMappingFile()) { return mapping; } CsvMapReader reader = new CsvMapReader( WpIOUtils.openBufferedReader(shapeFile.getMappingFile()), CsvPreference.STANDARD_PREFERENCE ); String [] header = reader.getHeader(true); while (true) { Map<String, String> row = reader.read(header); if (row == null) { break; } MappingInfo info = new MappingInfo(row); if (!info.isUnknown()) { mapping.put(info.key, info); } } return mapping; }
/** * TODO: keep track of duplicate or missing keys with special status codes * @param shapeFile * @return * @throws IOException */ private Map<String, MappingInfo> readExisting(WikiBrainShapeFile shapeFile) throws IOException { HashMap<String, MappingInfo> mapping = new HashMap<String, MappingInfo>(); if (!shapeFile.hasMappingFile()) { return mapping; } CsvMapReader reader = new CsvMapReader( WpIOUtils.openBufferedReader(shapeFile.getMappingFile()), CsvPreference.STANDARD_PREFERENCE ); String [] header = reader.getHeader(true); while (true) { Map<String, String> row = reader.read(header); if (row == null) { break; } MappingInfo info = new MappingInfo(row); if (!info.isUnknown()) { mapping.put(info.key, info); } } return mapping; }
int linenum = 0; String[] columns = in.getHeader(true); Map<String, String> testRow = null;