@Test public void testInstitutionRanking() throws Exception { boolean status = false; String path = getClass().getResource("incites_institution_ranking.xlsx").getFile(); path = URLDecoder.decode(path,"UTF-8"); SocialNetwork socialNetwork = new SocialNetwork("test",Category.INCITES); SocialNetworkAppManager appManager = new SocialNetworkAppManager(); File xlsxFile = new File(path); IncitesParser incitesParser = new IncitesParser(xlsxFile, socialNetwork); incitesParser.run(taskMonitor); CreatePublicationNetworkFromPublications createnetwork = new CreatePublicationNetworkFromPublications(appManager,socialNetwork,"test"); createnetwork.run(taskMonitor); Map<Collaboration, ArrayList<AbstractEdge>> map = appManager.getMap(); Set<Collaboration> collaboratorSet = map.keySet(); Collaboration[] collabArray = new Collaboration[collaboratorSet.size()]; collaboratorSet.toArray(collabArray); Author author = CytoscapeUtilities.getAuthor("Some Person", collabArray); if (author != null) { status = author.getMainInstitution().equals("UNIV TORONTO"); if (status) { List<String> x = author.getInstitutions(); status = x.get(0).equals("UNIV TORONTO") && x.get(1).equals("FLORIDA STATE UNIV") && x.get(2).equals("GLYCAEM INDEX TESTING INC"); } } assertTrue(status); }
@Override public void run(TaskMonitor taskMonitor) throws Exception { taskMonitor.setTitle("Loading InCites Network ..."); this.locationMap = new IncitesInstitutionLocationMap(); OPCPackage pkg; try { MonitoredFileInputStream fileInputStream = new MonitoredFileInputStream(file, taskMonitor, "Parsing InCites XLSX ..."); pkg = OPCPackage.open(fileInputStream); XSSFWorkbook workbook = new XSSFWorkbook(pkg); int numSheets = workbook.getNumberOfSheets(); this.parseFacultyXLSX(pkg, numSheets); this.parsePubsXLSX(pkg, numSheets); this.calculateSummary(); if (getIgnoredRows() >= 1) { logger.log(Level.WARNING, "Some rows could not be parsed."); } if (getIdentifiedFacultyList().size() == 0) { logger.log(Level.WARNING, "Unable to identify faculty. Please verify that InCites data file is valid"); } ArrayList<Publication> pubList = getPubList(); if (pubList == null) { logger.log(Level.SEVERE, "Invalid file. This InCites file is corrupt."); return; } socialNetwork.setPublications(getPubList()); socialNetwork.setFaculty(getFacultySet()); socialNetwork.setUnidentifiedFaculty(getUnidentifiedFacultyList()); socialNetwork.setUnidentified_faculty(getUnidentifiedFacultyString()); socialNetwork.getAttrMap().put(NodeAttribute.DEPARTMENT.toString(), getDepartmentName()); } catch (InvalidFormatException e) { logger.log(Level.SEVERE, "Exception occurred", e); } catch (IOException e) { logger.log(Level.SEVERE, "Exception occurred", e); } }
IncitesParser extends AbstractTask { @Override public void run(TaskMonitor taskMonitor) throws Exception { taskMonitor.setTitle("Loading InCites Network ..."); this.locationMap = new IncitesInstitutionLocationMap(); OPCPackage pkg; try { MonitoredFileInputStream fileInputStream = new MonitoredFileInputStream(file, taskMonitor, "Parsing InCites XLSX ..."); pkg = OPCPackage.open(fileInputStream); XSSFWorkbook workbook = new XSSFWorkbook(pkg); int numSheets = workbook.getNumberOfSheets(); this.parseFacultyXLSX(pkg, numSheets); this.parsePubsXLSX(pkg, numSheets); this.calculateSummary(); if (getIgnoredRows() >= 1) { logger.log(Level.WARNING, "Some rows could not be parsed."); } if (getIdentifiedFacultyList().size() == 0) { logger.log(Level.WARNING, "Unable to identify faculty. Please verify that InCites data file is valid"); } ArrayList<Publication> pubList = getPubList(); if (pubList == null) { logger.log(Level.SEVERE, "Invalid file. This InCites file is corrupt."); return; } socialNetwork.setPublications(getPubList()); socialNetwork.setFaculty(getFacultySet()); socialNetwork.setUnidentifiedFaculty(getUnidentifiedFacultyList()); socialNetwork.setUnidentified_faculty(getUnidentifiedFacultyString()); socialNetwork.getAttrMap().put(NodeAttribute.DEPARTMENT.toString(), getDepartmentName()); } catch (InvalidFormatException e) { logger.log(Level.SEVERE, "Exception occurred", e); } catch (IOException e) { logger.log(Level.SEVERE, "Exception occurred", e); } } }
IncitesParser extends AbstractTask { @Override public void run(TaskMonitor taskMonitor) throws Exception { taskMonitor.setTitle("Loading InCites Network ..."); this.locationMap = new IncitesInstitutionLocationMap(); OPCPackage pkg; try { MonitoredFileInputStream fileInputStream = new MonitoredFileInputStream(file, taskMonitor, "Parsing InCites XLSX ..."); pkg = OPCPackage.open(fileInputStream); XSSFWorkbook workbook = new XSSFWorkbook(pkg); int numSheets = workbook.getNumberOfSheets(); this.parseFacultyXLSX(pkg, numSheets); this.parsePubsXLSX(pkg, numSheets); this.calculateSummary(); if (getIgnoredRows() >= 1) { logger.log(Level.WARNING, "Some rows could not be parsed."); } if (getIdentifiedFacultyList().size() == 0) { logger.log(Level.WARNING, "Unable to identify faculty. Please verify that InCites data file is valid"); } ArrayList<Publication> pubList = getPubList(); if (pubList == null) { logger.log(Level.SEVERE, "Invalid file. This InCites file is corrupt."); return; } socialNetwork.setPublications(getPubList()); socialNetwork.setFaculty(getFacultySet()); socialNetwork.setUnidentifiedFaculty(getUnidentifiedFacultyList()); socialNetwork.setUnidentified_faculty(getUnidentifiedFacultyString()); socialNetwork.getAttrMap().put(NodeAttribute.DEPARTMENT.toString(), getDepartmentName()); } catch (InvalidFormatException e) { logger.log(Level.SEVERE, "Exception occurred", e); } catch (IOException e) { logger.log(Level.SEVERE, "Exception occurred", e); } } IncitesParser(File file, SocialNetwork socialNetwork); }
IncitesParser extends AbstractTask { @Override public void run(TaskMonitor taskMonitor) throws Exception { taskMonitor.setTitle("Loading InCites Network ..."); this.locationMap = new IncitesInstitutionLocationMap(); OPCPackage pkg; try { MonitoredFileInputStream fileInputStream = new MonitoredFileInputStream(file, taskMonitor, "Parsing InCites XLSX ..."); pkg = OPCPackage.open(fileInputStream); XSSFWorkbook workbook = new XSSFWorkbook(pkg); int numSheets = workbook.getNumberOfSheets(); this.parseFacultyXLSX(pkg, numSheets); this.parsePubsXLSX(pkg, numSheets); this.calculateSummary(); if (getIgnoredRows() >= 1) { logger.log(Level.WARNING, "Some rows could not be parsed."); } if (getIdentifiedFacultyList().size() == 0) { logger.log(Level.WARNING, "Unable to identify faculty. Please verify that InCites data file is valid"); } ArrayList<Publication> pubList = getPubList(); if (pubList == null) { logger.log(Level.SEVERE, "Invalid file. This InCites file is corrupt."); return; } socialNetwork.setPublications(getPubList()); socialNetwork.setFaculty(getFacultySet()); socialNetwork.setUnidentifiedFaculty(getUnidentifiedFacultyList()); socialNetwork.setUnidentified_faculty(getUnidentifiedFacultyString()); socialNetwork.getAttrMap().put(NodeAttribute.DEPARTMENT.toString(), getDepartmentName()); } catch (InvalidFormatException e) { logger.log(Level.SEVERE, "Exception occurred", e); } catch (IOException e) { logger.log(Level.SEVERE, "Exception occurred", e); } } IncitesParser(File file, SocialNetwork socialNetwork); static HashMap<String, Object> constructIncitesAttrMap(); static String parseFirstName(String incitesText); static String parseInstitution(String incitesText); static String parseLastName(String incitesText); static String parseMiddleInitial(String incitesText); boolean authorInList(ArrayList<Author> authorList, Author author); boolean checkIfAuthorValid(Author author); int getDefectiveRows(); String getDepartmentName(); HashSet<Author> getFacultySet(); ArrayList<Author> getIdentifiedFacultyList(); int getIgnoredRows(); ArrayList<Author> getLoneAuthorList(); ArrayList<Publication> getPubList(); ArrayList<Author> getUnidentifiedFacultyList(); String getUnidentifiedFacultyString(); ArrayList<Author> parseAuthors(String rawAuthorText); String parseFacultyName(String facultyText); void setDepartmentName(String departmentName); void setIdentifiedFacultyList(ArrayList<Author> identifiedFacultyList); void setLoneAuthorList(ArrayList<Author> loneAuthorList); void setUnidentifiedFacultyList(ArrayList<Author> unidentifiedFacultyList); void setUnidentifiedFacultyString(String unidentifiedFacultyString); void updateDefectiveRows(); void updateIgnoredRows(); @Override void run(TaskMonitor taskMonitor); }
IncitesParser extends AbstractTask { @Override public void run(TaskMonitor taskMonitor) throws Exception { taskMonitor.setTitle("Loading InCites Network ..."); this.locationMap = new IncitesInstitutionLocationMap(); OPCPackage pkg; try { MonitoredFileInputStream fileInputStream = new MonitoredFileInputStream(file, taskMonitor, "Parsing InCites XLSX ..."); pkg = OPCPackage.open(fileInputStream); XSSFWorkbook workbook = new XSSFWorkbook(pkg); int numSheets = workbook.getNumberOfSheets(); this.parseFacultyXLSX(pkg, numSheets); this.parsePubsXLSX(pkg, numSheets); this.calculateSummary(); if (getIgnoredRows() >= 1) { logger.log(Level.WARNING, "Some rows could not be parsed."); } if (getIdentifiedFacultyList().size() == 0) { logger.log(Level.WARNING, "Unable to identify faculty. Please verify that InCites data file is valid"); } ArrayList<Publication> pubList = getPubList(); if (pubList == null) { logger.log(Level.SEVERE, "Invalid file. This InCites file is corrupt."); return; } socialNetwork.setPublications(getPubList()); socialNetwork.setFaculty(getFacultySet()); socialNetwork.setUnidentifiedFaculty(getUnidentifiedFacultyList()); socialNetwork.setUnidentified_faculty(getUnidentifiedFacultyString()); socialNetwork.getAttrMap().put(NodeAttribute.DEPARTMENT.toString(), getDepartmentName()); } catch (InvalidFormatException e) { logger.log(Level.SEVERE, "Exception occurred", e); } catch (IOException e) { logger.log(Level.SEVERE, "Exception occurred", e); } } IncitesParser(File file, SocialNetwork socialNetwork); static HashMap<String, Object> constructIncitesAttrMap(); static String parseFirstName(String incitesText); static String parseInstitution(String incitesText); static String parseLastName(String incitesText); static String parseMiddleInitial(String incitesText); boolean authorInList(ArrayList<Author> authorList, Author author); boolean checkIfAuthorValid(Author author); int getDefectiveRows(); String getDepartmentName(); HashSet<Author> getFacultySet(); ArrayList<Author> getIdentifiedFacultyList(); int getIgnoredRows(); ArrayList<Author> getLoneAuthorList(); ArrayList<Publication> getPubList(); ArrayList<Author> getUnidentifiedFacultyList(); String getUnidentifiedFacultyString(); ArrayList<Author> parseAuthors(String rawAuthorText); String parseFacultyName(String facultyText); void setDepartmentName(String departmentName); void setIdentifiedFacultyList(ArrayList<Author> identifiedFacultyList); void setLoneAuthorList(ArrayList<Author> loneAuthorList); void setUnidentifiedFacultyList(ArrayList<Author> unidentifiedFacultyList); void setUnidentifiedFacultyString(String unidentifiedFacultyString); void updateDefectiveRows(); void updateIgnoredRows(); @Override void run(TaskMonitor taskMonitor);  }