/** * @param filter * @return individual ids * @throws UnknownFilterException */ public List<String> applyFilter(Filter filter) throws UnknownFilterException { if (filter == null) { return new ArrayList<String>(knowledgeBase.getIndividualIdsInSignature()); } List<String> ids = new ArrayList<String>(); for (String id : knowledgeBase.getIndividualIdsInSignature()) { if (test(id, filter)) { ids.add(id); } } return ids; }
/** * Calculate the comparison of all x all individuals. Since all individuals are being compared, * and will be necessary for evaluating statistics we will store in an array. * * @throws IncoherentStateException * @throws UnknownFilterException */ public void computeIxI() throws UnknownFilterException, IncoherentStateException { Set<String> individualIds = kb.getIndividualIdsInSignature(); for (String iid : individualIds) { int ibit = kb.getIndividualIndex(iid); EWAHCompressedBitmap ibm = kb.getDirectTypesBM(iid); Set<String> iids = kb.getClassIds(ibm); ProfileQuery q = ProfileQueryFactory.createQuery(iids); // compare against all other individuals q.setLimit(-1); MatchSet ms = profileMatcher.findMatchProfile(q); matchScores[ibit] = ms.getScores(); } }
public KBMatcherCalculator(ProfileMatcher pm) { this.profileMatcher = pm; this.kb = pm.getKnowledgeBase(); matchScores = new DescriptiveStatistics[kb.getIndividualIdsInSignature().size()]; }