本文整理汇总了Java中no.priv.garshol.duke.DataSource类的典型用法代码示例。如果您正苦于以下问题:Java DataSource类的具体用法?Java DataSource怎么用?Java DataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSource类属于no.priv.garshol.duke包,在下文中一共展示了DataSource类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateBaseDataSource
import no.priv.garshol.duke.DataSource; //导入依赖的package包/类
@Override
protected DataSource generateBaseDataSource(Collection<String> baseElements) {
DataSource ds = mock(DataSource.class);
Map<String, Collection<String>> map;
DukeStitcherRecordIterator<String> it = new DukeStitcherRecordIterator<String>();
for (String s : baseElements) {
map = new HashMap<String, Collection<String>>(2);
map.put(idProp, new ArrayList<String>(1));
map.put(originProp, new ArrayList<String>(1));
map.get(idProp).add(s);
map.get(originProp).add(s);
it.addRecord(new RecordImpl(map));
}
it.start();
when(ds.getRecords()).thenReturn(it);
return ds;
}
开发者ID:HewlettPackard,项目名称:loom,代码行数:21,代码来源:DukeStitcherTest.java
示例2: generateCandidateDataSource
import no.priv.garshol.duke.DataSource; //导入依赖的package包/类
@Override
protected DataSource generateCandidateDataSource(Collection<Composer> candidateElements) {
DataSource ds = mock(DataSource.class);
Map<String, Collection<String>> map;
DukeStitcherRecordIterator<Composer> it = new DukeStitcherRecordIterator<Composer>();
for (Composer c : candidateElements) {
map = new HashMap<String, Collection<String>>(2);
map.put(idProp, new ArrayList<String>(1));
map.put(originProp, new ArrayList<String>(1));
map.get(idProp).add(c.getAttribute(Composer.name));
map.get(originProp).add(c.getAttribute(Composer.origin));
it.addRecord(new RecordImpl(map));
}
it.start();
when(ds.getRecords()).thenReturn(it);
return ds;
}
开发者ID:HewlettPackard,项目名称:loom,代码行数:21,代码来源:DukeStitcherTest.java
示例3: generateBaseDataSource
import no.priv.garshol.duke.DataSource; //导入依赖的package包/类
@Override
protected DataSource generateBaseDataSource(Collection<B> baseElements) {
if (externalObjectProviders) {
return new HpCloudDataSource<B>(baseElements, convertPropertiesInfo(basePropertiesInfo));
} else {
HpCloudDataSourceAndRetriever<B> ds =
new HpCloudDataSourceAndRetriever<B>(baseElements, convertPropertiesInfo(basePropertiesInfo));
setBaseObjectRetriever(ds);
return ds;
}
}
开发者ID:HewlettPackard,项目名称:loom,代码行数:12,代码来源:HpCloudDukeStitcher.java
示例4: generateCandidateDataSource
import no.priv.garshol.duke.DataSource; //导入依赖的package包/类
@Override
protected DataSource generateCandidateDataSource(Collection<C> candidateElements) {
if (externalObjectProviders) {
return new HpCloudDataSource<C>(candidateElements, convertPropertiesInfo(candidatePropertiesInfo));
} else {
HpCloudDataSourceAndRetriever<C> ds = new HpCloudDataSourceAndRetriever<C>(candidateElements,
convertPropertiesInfo(candidatePropertiesInfo));
setCandidateObjectRetriever(ds);
return ds;
}
}
开发者ID:HewlettPackard,项目名称:loom,代码行数:12,代码来源:HpCloudDukeStitcher.java
示例5: subStitch
import no.priv.garshol.duke.DataSource; //导入依赖的package包/类
@Override
protected Map<B, Collection<C>> subStitch(Collection<B> filteredBaseElements,
Collection<C> filteredCandidateElements, Map<B, Collection<C>> stitches) {
// Set Datasources
DataSource baseDataSource, candidateDataSource;
baseDataSource = generateBaseDataSource(filteredBaseElements);
candidateDataSource = generateCandidateDataSource(filteredCandidateElements);
config.addDataSource(1, candidateDataSource); // NOTE: Read comment below
config.addDataSource(2, baseDataSource); // NOTE: Read comment below
// IMPORTANT NOTICE:
// Duke's linking process takes its data source number 1 and indexes it, then traverses its
// data source number 2 to look for matches from the first one. This means that Duke's
// candidates group is its data source 1 and its base group is its data source 2.
// As in this stitcher we are considering that the base data source is our first group and
// the candidate data source is our second group, these needs to be swapped to comply with
// Duke's behaviour. This explains why in the two previous lines our "candidateDataSource"
// is set as data source number 1 and our "baseDataSource" is set as data source number 2.
// Validate configuration before starting linking
config.validate(); // Will throw a RuntimeException if not correct
@SuppressWarnings("unused")
long startTime, stopTime;
startTime = System.currentTimeMillis();
try {
Processor proc = new Processor(config);
proc.addMatchListener(new DukeStitcherMatchListener(stitches));
proc.link();
proc.close();
} catch (IOException e) {
return null;
}
stopTime = System.currentTimeMillis();
return stitches;
}
开发者ID:HewlettPackard,项目名称:loom,代码行数:40,代码来源:DukeStitcher.java
示例6: generateBaseDataSource
import no.priv.garshol.duke.DataSource; //导入依赖的package包/类
/**
* Abstract method to be implemented by subclasses of this one. It should generate a
* <tt>DataSource</tt> which will be provided to Duke for its record linkage process.
* <p>
*
* @param baseElements Base elements which will be processed by Duke.
* @return A <tt>DataSource</tt> that will generate the base elements that will be provided to
* Duke as <tt>DukeStitcherRecord</tt>s.
*/
protected abstract DataSource generateBaseDataSource(Collection<B> baseElements);
开发者ID:HewlettPackard,项目名称:loom,代码行数:11,代码来源:DukeStitcher.java
示例7: generateCandidateDataSource
import no.priv.garshol.duke.DataSource; //导入依赖的package包/类
/**
* Abstract method to be implemented by subclasses of this one. It should generate a
* <tt>DataSource</tt> which will be provided to Duke for its record linkage process.
* <p>
*
* @param candidateElements Candidate elements which will be processed by Duke.
* @return A <tt>DataSource</tt> that will generate the candidate elements that will be provided
* to Duke as <tt>DukeStitcherRecord</tt>s.
*/
protected abstract DataSource generateCandidateDataSource(Collection<C> candidateElements);
开发者ID:HewlettPackard,项目名称:loom,代码行数:11,代码来源:DukeStitcher.java
注:本文中的no.priv.garshol.duke.DataSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论