本文整理汇总了Java中no.priv.garshol.duke.Record类的典型用法代码示例。如果您正苦于以下问题:Java Record类的具体用法?Java Record怎么用?Java Record使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Record类属于no.priv.garshol.duke包,在下文中一共展示了Record类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getRecords
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Override
public RecordIterator getRecords() {
it = new DukeStitcherRecordIterator<T>();
// Sequential implementation
// for (T item : items) {
// it.addRecord(convertToRecord(item));
// }
// Parallel implementation
Collection<Record> records =
items.parallelStream().map(item -> convertToRecord(item)).collect(Collectors.toList());
it.addRecords(records);
return it.start();
}
开发者ID:HewlettPackard,项目名称:loom,代码行数:17,代码来源:HpCloudDataSource.java
示例2: testMultiValue
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testMultiValue() throws IOException {
// First, index up the record
HashMap<String, Collection<String>> props = new HashMap<String, Collection<String>>();
props.put("ID", Collections.singleton("abc"));
Collection<String> list = new ArrayList<String>();
list.add("b");
list.add("c");
props.put("NAME", list);
Record r = new RecordImpl(props);
db.index(r);
db.commit();
// Then, retrieve it and verify that it's correct
r = db.findRecordById("abc");
assertEquals("abc", r.getValue("ID"));
list = r.getValues("NAME");
assertEquals(2, list.size());
assertTrue(list.contains("b"));
assertTrue(list.contains("c"));
}
开发者ID:enricopal,项目名称:STEM,代码行数:22,代码来源:DocumentRecordTest.java
示例3: testOneRowMapColumnTwice
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testOneRowMapColumnTwice() {
perform("insert into testdata values (1, 'smith, john')");
RegexpCleaner givencleaner = new RegexpCleaner();
givencleaner.setRegexp(", (.+)");
RegexpCleaner familycleaner = new RegexpCleaner();
familycleaner.setRegexp("^([^,]+), ");
source.addColumn(new Column("ID", null, null, null));
source.addColumn(new Column("NAME", "GIVENNAME", null, givencleaner));
source.addColumn(new Column("NAME", "FAMILYNAME", null, familycleaner));
RecordIterator it = source.getRecords();
assertTrue(it.hasNext());
Record r = it.next();
assertEquals("1", r.getValue("ID"));
assertEquals("john", r.getValue("GIVENNAME"));
assertEquals("smith", r.getValue("FAMILYNAME"));
assertFalse(it.hasNext());
}
开发者ID:enricopal,项目名称:STEM,代码行数:24,代码来源:JDBCDataSourceTest.java
示例4: testBadCoordinate
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testBadCoordinate() throws IOException {
Collection<Record> records = new ArrayList();
records.add(TestUtils.makeRecord("ID", "1",
"LOCATION", "59.948011,11.042239"));
records.add(TestUtils.makeRecord("ID", "2",
"LOCATION", "159.948053,11.042276"));
try {
processor.deduplicate(records);
} catch (com.spatial4j.core.exception.InvalidShapeException e) {
// this is not a legal coordinate, because a latitude of 159 degrees
// makes no sense
return;
}
fail("Invalid coordinate accepted.");
}
开发者ID:enricopal,项目名称:STEM,代码行数:19,代码来源:GeoSearchingTest.java
示例5: testMultiValue
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testMultiValue() throws IOException {
// First, index up the record
HashMap props = new HashMap();
props.put("ID", Collections.singleton("abc"));
Collection<String> list = new ArrayList();
list.add("b");
list.add("c");
props.put("NAME", list);
Record r = new RecordImpl(props);
db.index(r);
db.commit();
// Then, retrieve it and verify that it's correct
r = db.findRecordById("abc");
assertEquals("abc", r.getValue("ID"));
list = r.getValues("NAME");
assertEquals(2, list.size());
assertTrue(list.contains("b"));
assertTrue(list.contains("c"));
}
开发者ID:enricopal,项目名称:STEM,代码行数:22,代码来源:DocumentRecordTest.java
示例6: testOneMatchOneMiss2
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testOneMatchOneMiss2() throws IOException {
config.setMaybeThreshold(0.0);
source1.add(TestUtils.makeRecord("ID", "1", "NAME", "aaaaa", "EMAIL", "bbbbb"));
source2.add(TestUtils.makeRecord("ID", "2", "NAME", "aaaaa", "EMAIL", "bbbbb"));
source2.add(TestUtils.makeRecord("ID", "3", "NAME", "xxxxx", "EMAIL", "bbbbb"));
processor.link();
assertEquals("bad record count", 2, listener.getRecordCount());
List<TestUtils.Pair> matches = listener.getMatches();
assertEquals("bad number of matches", 1, matches.size());
assertEquals("bad number of missed matches", 1, listener.getNoMatchCount());
TestUtils.Pair pair = matches.get(0);
if (pair.r1.getValue("ID").equals("2")) {
Record r = pair.r1;
pair.r1 = pair.r2;
pair.r2 = r;
}
assertEquals("1", pair.r1.getValue("ID"));
assertEquals("2", pair.r2.getValue("ID"));
}
开发者ID:enricopal,项目名称:STEM,代码行数:24,代码来源:RecordLinkTest.java
示例7: testTableModePaging
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testTableModePaging() {
setupTabularConfig1();
source.setPageSize(1);
source.setRows(new String[][] {
{"http://a/1", "Peter", "15"},
{"http://a/2", "George", "151"}});
RecordIterator it = source.getRecords();
assertTrue("data source contains no records", it.hasNext());
Record r = it.next();
assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
assertEquals("wrong NAME", "Peter", r.getValue("NAME"));
assertEquals("wrong AGE", "15", r.getValue("AGE"));
assertTrue("data source contains only one record", it.hasNext());
r = it.next();
assertEquals("wrong ID", "http://a/2", r.getValue("ID"));
assertEquals("wrong NAME", "George", r.getValue("NAME"));
assertEquals("wrong AGE", "151", r.getValue("AGE"));
assertFalse("data source contains more than two records", it.hasNext());
assertEquals("wrong number of pages", 3, source.getPages());
}
开发者ID:enricopal,项目名称:STEM,代码行数:27,代码来源:SparqlDataSourceTest.java
示例8: testTwoRows
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testTwoRows() {
setupTabularConfig1();
source.setRows(new String[][] {
{"http://a/1", "Peter", "15"},
{"http://a/2", "George", "151"}});
RecordIterator it = source.getRecords();
assertTrue("data source contains no records", it.hasNext());
Record r = it.next();
assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
assertEquals("wrong NAME", "Peter", r.getValue("NAME"));
assertEquals("wrong AGE", "15", r.getValue("AGE"));
assertTrue("data source contains only one record", it.hasNext());
r = it.next();
assertEquals("wrong ID", "http://a/2", r.getValue("ID"));
assertEquals("wrong NAME", "George", r.getValue("NAME"));
assertEquals("wrong AGE", "151", r.getValue("AGE"));
assertFalse("data source contains more than two records", it.hasNext());
assertEquals("wrong number of pages", 2, source.getPages());
}
开发者ID:enricopal,项目名称:STEM,代码行数:26,代码来源:SparqlDataSourceTest.java
示例9: testNoComparator
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testNoComparator() throws IOException {
// nulling out comparator
config.getPropertyByName("EMAIL").setComparator(null);
// now attempt to match
Collection<Record> records = new ArrayList();
records.add(TestUtils.makeRecord("ID", "1",
"NAME", "aaaaa",
"EMAIL", "BBBBB"));
records.add(TestUtils.makeRecord("ID", "2",
"NAME", "aaaaa",
"EMAIL", "BBBBB"));
processor.deduplicate(records);
// this shouldn't produce any matches, because we're not comparing email
assertEquals(0, listener.getMatches().size());
assertEquals(2, listener.getRecordCount());
}
开发者ID:enricopal,项目名称:STEM,代码行数:20,代码来源:DeduplicatorTest.java
示例10: testUseColumnTwice
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testUseColumnTwice() throws IOException {
source.addColumn(new Column("F1", null, null, null));
source.addColumn(new Column("F2", "F2a", null,
new LowerCaseNormalizeCleaner()));
source.addColumn(new Column("F2", "F2b", null, null));
source.addColumn(new Column("F3", null, null, null));
RecordIterator it = read("F1,F2,F3\na,B,c");
Record r = it.next();
assertEquals("a", r.getValue("F1"));
assertEquals("b", r.getValue("F2a"));
assertEquals("B", r.getValue("F2b"));
assertEquals("c", r.getValue("F3"));
}
开发者ID:enricopal,项目名称:STEM,代码行数:17,代码来源:CSVDataSourceTest.java
示例11: testMaybe
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testMaybe() throws IOException {
// this corresponds to maybe-threshold not being set at all
config.setMaybeThreshold(0.0);
// now lets try some matching
Collection<Record> records = new ArrayList();
records.add(TestUtils.makeRecord("ID", "1", "NAME", "aaaaaa",
"EMAIL", "bbbbb"));
records.add(TestUtils.makeRecord("ID", "2", "NAME", "bbbb",
"EMAIL", "bbbbb"));
processor.deduplicate(records);
Collection<TestUtils.Pair> matches = listener.getMatches();
// for (TestUtils.Pair match : matches)
// PrintMatchListener.show(match.r1, match.r2, match.conf, "MATCH");
assertEquals("wrong number of records processed",
2, listener.getRecordCount());
assertEquals("found matches, but shouldn't have",
0, matches.size());
assertEquals("found maybe matches, but shouldn't have",
0, listener.getMaybeCount());
assertEquals("wrong number of no-matches",
2, listener.getNoMatchCount());
}
开发者ID:enricopal,项目名称:STEM,代码行数:27,代码来源:DeduplicatorTest.java
示例12: testTwoRecords
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testTwoRecords() {
source.addColumn(new Column("?uri", "ID", null, null));
source.addColumn(new Column("http://b", "PROP", null, null));
RecordIterator it = read("<http://a> <http://b> \"foo\" .\n" +
"<http://a> <http://c> \"foo\" .\n" +
"<http://a> <" + RDF_TYPE + "> \"http://d\" .\n" +
"<http://e> <http://b> \"bar\" .\n" +
"<http://e> <http://c> \"foo\" .\n" +
"<http://e> <" + RDF_TYPE + "> \"http://f\" .\n");
Record r = it.next();
checkAorE(r); // we don't know the order
assertTrue("second record not found", it.hasNext());
r = it.next();
checkAorE(r);
}
开发者ID:enricopal,项目名称:STEM,代码行数:19,代码来源:NTriplesDataSourceTest.java
示例13: createAssociationBetweenRecords
import no.priv.garshol.duke.Record; //导入依赖的package包/类
/**
* Creates an association and saves it in the DB.
*
* @param r1 first record which represents an item
* @param r2 second record which represents an item
* @param confidence associationValue
*/
public void createAssociationBetweenRecords(Record r1, Record r2, double confidence) {
Date execution = new Date();
ItemAssocVO<Integer, Integer> itemAssoc = new ItemAssocVO<Integer, Integer>(
confTanantId,
new ItemVO(profileDukeGenerator.getTenantId(),
r1.getValue("ItemID"),
profileDukeGenerator.getItemType()),
assocType, confidence,
new ItemVO(profileDukeGenerator.getTenantId(),
r2.getValue("ItemID"),
profileDukeGenerator.getItemType()),
sourceType, "ProfileDuke Plugin", viewType, null, execution);
numberOfCreatedAssociations++;
itemAssocDAO.insertOrUpdateItemAssoc(itemAssoc);
}
开发者ID:major2015,项目名称:easyrec_major,代码行数:27,代码来源:EasyrecProfileMatcher.java
示例14: testNoValueForEmptySplit
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testNoValueForEmptySplit() throws IOException {
source.addColumn(new Column("F1", null, null, null));
Column c = new Column("F2", null, null, null);
c.setSplitOn(";");
source.addColumn(c);
source.addColumn(new Column("F3", null, null, null));
RecordIterator it = read("F1,F2,F3\na,b;;e,c");
Record r = it.next();
assertEquals("a", r.getValue("F1"));
assertEquals("c", r.getValue("F3"));
Collection<String> values = r.getValues("F2");
assertEquals(2, values.size());
assertTrue(values.contains("b"));
assertTrue(values.contains("e"));
}
开发者ID:enricopal,项目名称:STEM,代码行数:20,代码来源:CSVDataSourceTest.java
示例15: htmlCompare
import no.priv.garshol.duke.Record; //导入依赖的package包/类
public static void htmlCompare(Record r1, Record r2, double confidence,
String heading, List<Property> props) {
System.out.println("<p>" + heading + " " + confidence + "</p>");
System.out.println("<table>");
for (Property p : props) {
String prop = p.getName();
if ((r1.getValues(prop) == null || r1.getValues(prop).isEmpty()) &&
(r2.getValues(prop) == null || r2.getValues(prop).isEmpty()))
continue;
System.out.println("<tr><td>" + prop);
System.out.println("<td>" + value(r1, prop));
System.out.println("<td>" + value(r2, prop));
}
System.out.println("</table>");
}
开发者ID:enricopal,项目名称:STEM,代码行数:18,代码来源:PrintMatchListener.java
示例16: testTwoTriples
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testTwoTriples() {
setupTripleConfig1("?uri");
source.setRows(new String[][] {
{"http://a/1", "http://a/name", "1"},
{"http://a/1", "http://a/age", "32"}});
RecordIterator it = source.getRecords();
assertTrue("data source contains no records", it.hasNext());
Record r = it.next();
assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
assertEquals("wrong NAME", "1", r.getValue("NAME"));
assertEquals("wrong AGE", "32", r.getValue("AGE"));
assertFalse("data source contains more than one record", it.hasNext());
assertEquals("wrong number of pages", 2, source.getPages());
}
开发者ID:enricopal,项目名称:STEM,代码行数:19,代码来源:SparqlDataSourceTest.java
示例17: testTripleMissingColumn
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testTripleMissingColumn() {
setupTripleConfig1("?uri");
source.setRows(new String[][] {
{"http://a/1", "http://a/name", "1"},
{"http://a/1", "http://a/age", "32"},
// next column is not configured. Duke should accept it even so
{"http://a/1", "http://a/wtf", "whee"}});
RecordIterator it = source.getRecords();
assertTrue("data source contains no records", it.hasNext());
Record r = it.next();
assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
assertEquals("wrong NAME", "1", r.getValue("NAME"));
assertEquals("wrong AGE", "32", r.getValue("AGE"));
assertFalse("data source contains more than one record", it.hasNext());
assertEquals("wrong number of pages", 2, source.getPages());
}
开发者ID:enricopal,项目名称:STEM,代码行数:21,代码来源:SparqlDataSourceTest.java
示例18: testOneRow
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testOneRow() {
perform("insert into testdata values (1, 'foo')");
source.addColumn(new Column("ID", null, null, null));
source.addColumn(new Column("NAME", null, null, null));
RecordIterator it = source.getRecords();
assertTrue(it.hasNext());
Record r = it.next();
assertEquals("1", r.getValue("ID"));
assertEquals("foo", r.getValue("NAME"));
assertFalse(it.hasNext());
}
开发者ID:enricopal,项目名称:STEM,代码行数:17,代码来源:JDBCDataSourceTest.java
示例19: next
import no.priv.garshol.duke.Record; //导入依赖的package包/类
public Record next() {
builder.newRecord();
for (int colix = 0; colix < variables.size(); colix++) {
Collection<Column> cols = columns.get(variables.get(colix));
if (cols != null)
for (Column col : cols)
addValue(colix, col);
}
pagerow++;
// do we need to load the next page?
if (pagerow >= page.size())
fetchNextPage();
return builder.getRecord();
}
开发者ID:enricopal,项目名称:STEM,代码行数:18,代码来源:SparqlDataSource.java
示例20: testSplitting
import no.priv.garshol.duke.Record; //导入依赖的package包/类
@Test
public void testSplitting() throws IOException {
source.addColumn(new Column("F1", null, null, null));
Column c = new Column("F2", null, null, null);
c.setSplitOn(";");
source.addColumn(c);
source.addColumn(new Column("F3", null, null, null));
RecordIterator it = read("F1,F2,F3\na,b;d;e,c");
Record r = it.next();
assertEquals("a", r.getValue("F1"));
assertEquals("c", r.getValue("F3"));
Collection<String> values = r.getValues("F2");
assertEquals(3, values.size());
assertTrue(values.contains("b"));
assertTrue(values.contains("d"));
assertTrue(values.contains("e"));
}
开发者ID:enricopal,项目名称:STEM,代码行数:21,代码来源:CSVDataSourceTest.java
注:本文中的no.priv.garshol.duke.Record类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论