当前位置: 首页>>代码示例>>Java>>正文


Java Record.getValues方法代码示例

本文整理汇总了Java中no.priv.garshol.duke.Record.getValues方法的典型用法代码示例。如果您正苦于以下问题:Java Record.getValues方法的具体用法?Java Record.getValues怎么用?Java Record.getValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在no.priv.garshol.duke.Record的用法示例。


在下文中一共展示了Record.getValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: testSplitting

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
@Test
public void testSplitting() {
  perform("insert into testdata values (1, 'foo bar baz')");

  source.addColumn(new Column("ID", null, null, null));
  Column col = new Column("NAME", null, null, null);
  col.setSplitOn(" ");
  source.addColumn(col);
      
  RecordIterator it = source.getRecords();
  assertTrue(it.hasNext());

  Record r = it.next();
  assertEquals("1", r.getValue("ID"));
  Collection<String> values = r.getValues("NAME");
  assertEquals(3, values.size());
  assertTrue(values.contains("foo"));
  assertTrue(values.contains("bar"));
  assertTrue(values.contains("baz"));

  assertFalse(it.hasNext());
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:23,代码来源:JDBCDataSourceTest.java

示例4: lookup

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
/**
 * Tokenizes lookup fields and returns all matching buckets in the
 * index.
 */
private List<Bucket> lookup(Record record) {
  List<Bucket> buckets = new ArrayList();
  for (Property p : config.getLookupProperties()) {
    String propname = p.getName();
    Collection<String> values = record.getValues(propname);
    if (values == null)
      continue;

    for (String value : values) {
      String[] tokens = StringUtils.split(value);
      for (int ix = 0; ix < tokens.length; ix++) {
        Bucket b = store.lookupToken(propname, tokens[ix]);
        if (b == null || b.records == null)
          continue;
        long[] ids = b.records;
        if (DEBUG)
          System.out.println(propname + ", " + tokens[ix] + ": " + b.nextfree + " (" + b.getScore() + ")");
        buckets.add(b);
      }
    }
  }

  return buckets;
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:29,代码来源:KeyValueDatabase.java

示例5: value

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
private static String value(Record r, String p) {
  Collection<String> vs = r.getValues(p);
  if (vs == null)
    return "<null>";
  if (vs.isEmpty())
    return "<null>";

  StringBuffer buf = new StringBuffer();
  for (String v : vs) {
    buf.append("'");
    buf.append(v);
    buf.append("', ");
  }
    
  return buf.toString();
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:17,代码来源:PrintMatchListener.java

示例6: 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

示例7: testSplittingCleaning

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
@Test
public void testSplittingCleaning() throws IOException {
  source.addColumn(new Column("F1", null, null, null));
  Column c = new Column("F2", null, null, new LowerCaseNormalizeCleaner());
  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

示例8: 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

示例9: index

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
/**
 * Add the record to the index.
 */
@Override
public void index(Record record) {
	if (this.client == null) {
		this.init();
	}

	String id = null;
	Map<String, Object> json = new HashMap<String, Object>();
	for (String propname : record.getProperties()) {
		Property prop = config.getPropertyByName(propname);

		if (prop == null) {
			throw new DukeConfigException("Record has property " + propname
					+ " for which there is no configuration");
		}

		if (prop.isIdProperty()) {
			id = record.getValue(propname);
		} else {

			Collection<String> values = record.getValues(propname);
			if (values != null && !values.isEmpty()) {
				if (values.size() == 1) {
					json.put(propname, Iterables.get(values, 0));
				} else {
					json.put(propname, values);
				}
			}
		}

	}

	this.addToIndex(id, json);
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:38,代码来源:ElasticSearchDatabase.java

示例10: toString

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
public static String toString(Record r) {
  StringBuffer buf = new StringBuffer();
  for (String p : r.getProperties()) {
    Collection<String> vs = r.getValues(p);
    if (vs == null || vs.isEmpty())
      continue;
    
    buf.append(p + ": ");          
    for (String v : vs)
      buf.append("'" + v + "', ");
  }

  //buf.append(";;; " + r);
  return buf.toString();
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:16,代码来源:PrintMatchListener.java

示例11: prettyCompare

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
public static void prettyCompare(Record r1, Record r2, double confidence,
                                 String heading, List<Property> props) {
  System.out.println(heading + " " + confidence);

  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(prop);
    System.out.println("  " + value(r1, prop));
    System.out.println("  " + value(r2, prop));
  }
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:16,代码来源:PrintMatchListener.java

示例12: prettyPrint

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
public static void prettyPrint(Record r, List<Property> props) {
  for (Property p : props) {
    String prop = p.getName();
    if (r.getValues(prop) == null || r.getValues(prop).isEmpty())
      continue;
    
    System.out.println(prop + ": " + value(r, prop));
  }
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:10,代码来源:PrintMatchListener.java

示例13: toString

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
public static String toString(Record r) {
    StringBuffer buf = new StringBuffer();
    for (String p : r.getProperties()) {
        Collection<String> vs = r.getValues(p);
        if (vs == null)
            continue;

        buf.append(p + ": ");
        for (String v : vs)
            buf.append("'" + v + "', ");
    }

    //buf.append(";;; " + r);
    return buf.toString();
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:16,代码来源:EasyrecProfileMatcher.java

示例14: getIdentity

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
private String getIdentity(Record r) {
  for (Property p : config.getIdentityProperties())
    for (String v : r.getValues(p.getName()))
      return v;
  throw new RuntimeException("No identity found in record [" +
                             PrintMatchListener.toString(r) + "]");
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:8,代码来源:ClassDatabaseMatchListener.java

示例15: getIdentity

import no.priv.garshol.duke.Record; //导入方法依赖的package包/类
private String getIdentity(Record r) {
  for (Property p : config.getIdentityProperties()) {
    Collection<String> vs = r.getValues(p.getName());
    if (vs == null)
      continue;
    for (String v : vs)
      return v;
  }
  throw new DukeException("No identity found in record [" +
                          PrintMatchListener.toString(r) + "]");
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:12,代码来源:LinkDatabaseMatchListener.java


注:本文中的no.priv.garshol.duke.Record.getValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。