/** Evaluates the current alignment using the reference alignment */ public void evaluate() { boolean gui = userInterface != null; int[] eval = a.evaluate(ref); int found = a.size() - eval[1]; int correct = eval[0]; int total = ref.size() - ref.countConflicts(); precision = 1.0 * correct / found; String prc = Math.round(precision * 1000) / 10.0 + "%"; recall = 1.0 * correct / total; String rec = Math.round(recall * 1000) / 10.0 + "%"; fMeasure = 2 * precision * recall / (precision + recall); String fms = Math.round(fMeasure * 1000) / 10.0 + "%"; if (gui) { evaluation = "Precision: " + prc + "; Recall: " + rec + "; F-measure: " + fms; userInterface.refresh(); } else evaluation = "Precision\tRecall\tF-measure\tFound\tCorrect\tReference\n" + prc + "\t" + rec + "\t" + fms + "\t" + found + "\t" + correct + "\t" + total; }
public void removeIncorrect() { Alignment reviewed = new Alignment(); for (Mapping m : a) if (!m.getStatus().equals(MappingStatus.INCORRECT)) reviewed.add(m); if (a.size() > reviewed.size()) { aml.setAlignment(reviewed); if (a.size() > 0) activeMapping = 0; if (userInterface != null) userInterface.refresh(); needSave = true; } }
/** * Opens an alignment from a file as the active alignment * * @param path: the path to the alignment file * @throws Exception if the alignment file can't be read or interpreted */ public void openAlignment(String path) throws Exception { a = new Alignment(path); evaluation = null; if (a.size() > 0) activeMapping = 0; if (userInterface != null) userInterface.refresh(); needSave = false; }
public SearchAlignment() { super(); this.setTitle("Search Alignment"); this.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); this.setPreferredSize(new Dimension(700, 140)); AML aml = AML.getInstance(); // The containing panel dialogPanel = new JPanel(); cl = new CardLayout(); dialogPanel.setLayout(cl); // The search panel JLabel desc = new JLabel("Enter Search Term: (min 3 characters)"); Font font = desc.getFont(); boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize()); desc.setFont(boldFont); JPanel labelPanel = new JPanel(); labelPanel.add(desc); Alignment a = AML.getInstance().getAlignment(); int total = a.size(); mappings = new ArrayList<String>(total); for (int i = 0; i < total; i++) { Mapping m = a.get(i); String map = aml.getSource().getName(m.getSourceId()); map += " = "; map += aml.getTarget().getName(m.getTargetId()); mappings.add(map); } searchField = new JTextArea(1, 60); searchField.setEditable(true); AutoCompleteDecorator.decorate(searchField, mappings, false); JPanel selectionPanel = new JPanel(); selectionPanel.add(searchField); cancel = new JButton("Cancel"); cancel.setPreferredSize(new Dimension(70, 28)); cancel.addActionListener(this); find = new JButton("Find"); find.setPreferredSize(new Dimension(70, 28)); find.addActionListener(this); JPanel buttonPanel = new JPanel(); buttonPanel.add(cancel); buttonPanel.add(find); searchPanel = new JPanel(); searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.PAGE_AXIS)); searchPanel.add(labelPanel); searchPanel.add(selectionPanel); searchPanel.add(buttonPanel); dialogPanel.add(searchPanel, "Search"); cl.show(dialogPanel, "Search"); this.add(dialogPanel); this.pack(); this.setVisible(true); }
public void setAlignment(Alignment maps) { a = maps; if (a.size() > 0) activeMapping = 0; qf = null; evaluation = null; rep = null; needSave = false; }
/** Matches the active ontologies using manual configurations */ public void matchManual() { im = new InteractionManager(); ManualMatcher.match(); evaluation = null; rep = null; if (a.size() > 0) activeMapping = 0; if (userInterface != null) userInterface.refresh(); needSave = true; }
/** Matches the active ontologies using the default configuration */ public void matchAuto() { defaultConfig(); im = new InteractionManager(); AutomaticMatcher.match(); evaluation = null; rep = null; if (a.size() > 0) activeMapping = 0; if (userInterface != null) userInterface.refresh(); needSave = true; }
public void sortDescending() { a.sortDescending(); if (a.size() > 0) activeMapping = 0; if (userInterface != null) userInterface.refresh(); }
/** @return whether there is a non-empty active alignment */ public boolean hasAlignment() { return a != null && a.size() > 0; }