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


Java RecordImpl类代码示例

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


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

示例1: generateBaseDataSource

import no.priv.garshol.duke.RecordImpl; //导入依赖的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.RecordImpl; //导入依赖的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: testMultiValue

import no.priv.garshol.duke.RecordImpl; //导入依赖的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

示例4: testMultiValue

import no.priv.garshol.duke.RecordImpl; //导入依赖的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

示例5: addStatement

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
private void addStatement(RecordImpl record,
                          String subject,
                          String property,
                          String object) {
  Collection<Column> cols = columns.get(property);
  if (cols == null) {
    if (property.equals(RDF_TYPE) && !types.isEmpty())
      addValue(record, subject, property, object);
    return;
  }
  
  for (Column col : cols) {
    String cleaned = object;
    if (col.getCleaner() != null)
      cleaned = col.getCleaner().clean(object);
    if (cleaned != null && !cleaned.equals(""))
      addValue(record, subject, col.getProperty(), cleaned);
  }
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:20,代码来源:NTriplesDataSource.java

示例6: filterByTypes

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
public void filterByTypes() {
  // this is fairly ugly. if types has values we add an extra property
  // RDF_TYPE to records during build, then filter out records of the
  // wrong types here. finally, we strip away the RDF_TYPE property here.
  
  if (types.isEmpty())
    return;
  
  for (String uri : new ArrayList<String>(records.keySet())) {
    RecordImpl r = records.get(uri);
    if (!filterbytype(r))
      records.remove(uri);
    else
      r.remove(RDF_TYPE);
  }
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:17,代码来源:NTriplesDataSource.java

示例7: parseRecord

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
private Record parseRecord() {
  RecordImpl record = new RecordImpl();
  String current = subject;

  // we've stored the first statement about the next resource, so we
  // need to process that before we move on to read anything
  
  while (current != null && current.equals(subject)) {
    addStatement(record, subject, property, object);
    parseNextLine();
    // we have now received a callback to statement() with the
    // next statement
  }

  // ok, subject is now either null (we're finished), or different from
  // current, because we've started on the next resource
  if (current == null)
    return null;
  return record;
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:21,代码来源:NTriplesDataSource.java

示例8: run

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
public void run(String[] argv)
  throws IOException, SAXException {
  Collection<CommandLineParser.Option> options =
    Collections.singleton((CommandLineParser.Option) new CommandLineParser.StringOption("maxhits", 'H'));
  argv = init(argv, 3, 3, options);
  int max_hits = 10000;
  if (parser.getOptionValue("maxhits") != null)
    max_hits = Integer.parseInt(parser.getOptionValue("maxhits"));

  // build record
  RecordImpl prototype = new RecordImpl();
  prototype.addValue(argv[1], argv[2]);

  // search
  Collection<Record> records = database.findCandidateMatches(prototype);
  int hitno = 1;
  for (Record record : records) {
    PrintMatchListener.prettyPrint(record, config.getProperties());
    System.out.println();
    if (hitno++ == max_hits)
      break;
  }
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:24,代码来源:RecordSearch.java

示例9: runAsDouble

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
/**
 * . Computes probability that objects are the same
 *
 * @return float the computed score
 */
@Override
public double runAsDouble() {
    HashMap<String, Collection<String>> props =
            new HashMap<>();
    LeafDocLookup doc = doc();
    Collection<String> docKeys = comparedRecord.getProperties();

    for (String key : docKeys) {
        if (doc.containsKey(key)) {
            String value = (doc.get(key) == null ? "" : getFieldValue(doc.get(key)));
            props.put(key, value == null
                    ? Collections.singleton("")
                    : Collections.singleton(value));
        }
    }
    Record r2 = new RecordImpl(props);
    return compare(comparedRecord, r2, entityParams);
}
 
开发者ID:YannBrrd,项目名称:elasticsearch-entity-resolution,代码行数:24,代码来源:EntityResolutionScript.java

示例10: convertToRecord

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
/**
 * Helper method which receives an <tt>HpCloudItem</tt> and creates a new <tt>Record</tt> to be
 * used by Duke.
 *
 * @param item The object where the properties' values are going to be read from.
 * @return A <tt>Record</tt> containing all the properties specified in the constructor of this
 *         class.
 */
protected Record convertToRecord(final T item) {
    RecordImpl newRecord = new RecordImpl();

    // This method is called from a parallelised one. Hence, there is no need for this one to be
    // parallelised.
    for (String property : propertiesInfo.keySet()) {
        String value = item.getCore().getAttributeAsString(propertiesInfo.get(property));
        newRecord.addValue(property, value);
    }

    return newRecord;
}
 
开发者ID:HewlettPackard,项目名称:loom,代码行数:21,代码来源:HpCloudDataSource.java

示例11: addValue

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
private void addValue(RecordImpl record, String subject,
                      String property, String object) {
  if (record.isEmpty())
    for (Column idcol : columns.get("?uri"))
      record.addValue(idcol.getProperty(), subject);

  record.addValue(property, object);      
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:9,代码来源:NTriplesDataSource.java

示例12: configureWithFieldsOnly

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
/**
 * . Configures with data from JSON payload only
 *
 * @param fieldsParams fields parameters from JSON
 * @return the record for comparison
 */
private Record configureWithFieldsOnly(
        final List<Map<String, Object>> fieldsParams) {

    Map<String, Collection<String>> props =
            new HashMap<>();
    entityParams = new HashMap<>();

    for (Map<String, Object> value : fieldsParams) {
        HashMap<String, Object> map = new HashMap<>();

        String field = (String) value.get("field");

        List<Cleaner> cleanList =
                getCleaners((ArrayList<Map<String, String>>) value.get(CLEANERS));

        map.put(CLEANERS, cleanList);

        Double maxValue = 0.0;
        if (value.get(HIGH) != null) {
            maxValue = (Double) value.get(HIGH);
        }

        Double minValue = 0.0;
        if (value.get(LOW) != null) {
            minValue = (Double) value.get(LOW);
        }

        Comparator comp = getComparator(value);

        map.put(HIGH, maxValue);
        map.put(LOW, minValue);
        map.put(COMPARATOR, comp);

        entityParams.put(field, map);
    }

    readFields(fieldsParams, props);
    return new RecordImpl(props);
}
 
开发者ID:YannBrrd,项目名称:elasticsearch-entity-resolution,代码行数:46,代码来源:EntityResolutionScript.java

示例13: getRecords

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
public Map<String, RecordImpl> getRecords() {
  return records;
}
 
开发者ID:enricopal,项目名称:STEM,代码行数:4,代码来源:NTriplesDataSource.java

示例14: next

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
@Override
public Record next() {
    if (iterator.hasNext()) {
        ItemVO<Integer, Integer> itemVO = iterator.next();

        Map<String, Collection<String>> values = new HashMap<String, Collection<String>>();

        // TODO: fill the record

        String profile = profileService.getProfile(itemVO);





        //Record record = new ProfileDBRecord();
        Record record = new RecordImpl(values);
        return record;
    } else
        return null;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:22,代码来源:ProfileDBRecordIterator.java

示例15: makeRecord

import no.priv.garshol.duke.RecordImpl; //导入依赖的package包/类
public static Record makeRecord() {
  return new RecordImpl(new HashMap());    
}
 
开发者ID:larsga,项目名称:Duke,代码行数:4,代码来源:TestUtils.java


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