/** * Retrieve new records from data sources, and match them to * previously indexed records in the given database. This method * does <em>not</em> index the new records. * @param dbno Which database to match against. * @param matchall If true, all matching records are accepted. If false, * only the single best match for each record is accepted. * @param batch_size The batch size to use. * @since 1.3 */ public void linkRecords(int dbno, Collection<DataSource> sources, boolean matchall, int batch_size) { for (DataSource source : sources) { source.setLogger(logger); Collection<Record> batch = new ArrayList(batch_size); RecordIterator it = source.getRecords(); while (it.hasNext()) { batch.add(it.next()); if (batch.size() == batch_size) { linkBatch(dbno, batch, matchall); batch.clear(); } } it.close(); if (!batch.isEmpty()) linkBatch(dbno, batch, matchall); } endProcessing(); }
/** * Does record linkage across the two groups, but does not link * records within each group. * @param matchall If true, all matching records are accepted. If false, * only the single best match for each record is accepted. * @param batch_size The batch size to use. * @since 1.1 */ public void link(Collection<DataSource> sources1, Collection<DataSource> sources2, boolean matchall, int batch_size) { startProcessing(); // start with source 1 for (Collection<Record> batch : makeBatches(sources1, batch_size)) { index(1, batch); if (hasTwoDatabases()) linkBatch(2, batch, matchall); } // then source 2 for (Collection<Record> batch : makeBatches(sources2, batch_size)) { if (hasTwoDatabases()) index(2, batch); linkBatch(1, batch, matchall); } endProcessing(); }
/** * Retrieve new records from data sources, and match them to * previously indexed records. This method does <em>not</em> index * the new records. * @param matchall If true, all matching records are accepted. If false, * only the single best match for each record is accepted. * @param batch_size The batch size to use. * @since 1.0 */ public void linkRecords(Collection<DataSource> sources, boolean matchall, int batch_size) { for (DataSource source : sources) { source.setLogger(logger); Collection<Record> batch = new ArrayList(batch_size); RecordIterator it = source.getRecords(); while (it.hasNext()) { batch.add(it.next()); if (batch.size() == batch_size) { linkBatch(batch, matchall); batch.clear(); } } it.close(); if (!batch.isEmpty()) linkBatch(batch, matchall); } endProcessing(); }