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


Java Dataset.getKey方法代码示例

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


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

示例1: cleanup

import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
private void cleanup(Dataset d) throws IOException {
  try {
    if (cfg.zookeeper.isConfigured()) {
      zk().delete(ZookeeperUtils.getCrawlInfoPath(d.getKey(), null));
      LOG.info("Removed crawl {} from ZK running queue", d.getKey());

      //TODO: clear pending & running queues
    }

    // cleanup repo files
    final File dwcaFile = new File(cfg.archiveRepository, d.getKey() + DWCA_SUFFIX);
    FileUtils.deleteQuietly(dwcaFile);
    File dir = cfg.archiveDir(d.getKey());
    if (dir.exists() && dir.isDirectory()) {
      FileUtils.deleteDirectory(dir);
    }
    LOG.info("Removed dwca files from repository {}", dwcaFile);

    RegistryService.deleteStorageFiles(cfg.neo, d.getKey());

  } catch (Exception e) {
    LOG.error("Failed to cleanup dataset {}", d.getKey(), e);
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:25,代码来源:AdminCommand.java

示例2: buildSource

import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
private static NubSource buildSource(Dataset d, Rank rank, ClbConfiguration cfg, boolean ignoreSynonyms) {
  NubSource src = new ClbSource(cfg, d.getKey(), d.getTitle());
  src.created = d.getCreated();
  src.ignoreSynonyms = ignoreSynonyms;
  src.nomenclator = DatasetSubtype.NOMENCLATOR_AUTHORITY == d.getSubtype();
  if (rank != null) {
    src.ignoreRanksAbove = rank;
  }
  return src;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:11,代码来源:ClbSourceList.java

示例3: ClbSource

import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
public ClbSource(ClbConfiguration clb, Dataset dataset) {
  this(clb, dataset.getKey(), dataset.getTitle());
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:4,代码来源:ClbSource.java

示例4: matchDataset

import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
/**
 * Updates a datasets nub matches.
 * Uses the internal Lookup to generate a complete id map and then does postgres writes in a separate thread ?!
 */
public DatasetMatchSummary matchDataset(UUID key) throws DatasetMatchFailed {
  Dataset d = new Dataset();
  d.setKey(key);
  d.setTitle("Dataset " + key);

  final DatasetMatchSummary summary = new DatasetMatchSummary(d.getKey());

  if (Constants.NUB_DATASET_KEY.equals(d.getKey())) {
    LOG.warn("Cannot match backbone to itself. Ignore");
    return summary;
  }

  LOG.info("Rematch checklist {} to Backbone", d.getKey());
  Map<Integer, Integer> relations = Maps.newHashMap();
  try (ClbSource src = new ClbSource(cfg, d)) {
    // read in postgres usages
    LOG.info("Copy usages for {} from pg into neo", d.getKey());
    src.init(false, false);

    NubUsage unknown = new NubUsage();
    unknown.usageKey = Kingdom.INCERTAE_SEDIS.nubUsageKey();
    unknown.kingdom = Kingdom.INCERTAE_SEDIS;
    // this is a taxonomically sorted iteration. We remember the parent kingdom using the ParentStack
    ParentStack parents = new ParentStack(unknown);
    for (SrcUsage u : src) {
      parents.add(u);
      if (u.parsedName == null || !u.parsedName.isParsed()) {
        summary.addUnparsable();
      }
      LookupUsage match = nubLookup.match(u.parsedName.canonicalName(), u.parsedName.getAuthorship(), u.parsedName.getYear(), u.rank, parents.nubKingdom());
      if (match != null) {
        summary.addMatch(u.rank);
        // add to relations
        relations.put(u.key, match.getKey());
        // store current kingdom in parent stack for further nub lookups of children
        NubUsage nub = new NubUsage();
        nub.kingdom = match.getKingdom();
        parents.put(nub);

      } else {
        summary.addNoMatch(u.rank);
        LOG.debug("No match for {} in dataset {}. Parsed name: {}", u, d.getKey(), u.parsedName);
        // also store no matches as nulls so we can flag an issue
        relations.put(u.key, null);
      }
    }

    // warn if matches are little
    // but ignore very small datasets where chances are high due to higher taxa often not matching
    if (summary.percBackboneRelevantNoMatches() < 25 || (summary.percMatches() < 25 && summary.getTotalUsages() > 25)) {
      LOG.warn("Only {}% of all names and {}% of genera and below in dataset {} were matching", summary.percMatches(), summary.percBackboneRelevantNoMatches(), d.getKey());
    }

    if (sqlService != null) {
      LOG.info("Updating {} nub relations with {} ({}%) matches and {} unparsable names from dataset {}",
          relations.size(),
          summary.getMatches(),
          summary.percMatches(),
          summary.getUnparsable(),
          d.getKey()
      );
      sqlService.insertNubRelations(d.getKey(), relations);
      solrService.insertNubRelations(d.getKey(), relations);
      counter++;
    } else {
      LOG.warn("No sql service configured to persist the matches for dataset {}!", d.getKey());
    }

  } catch (Exception e) {
    LOG.error("Failed to match checklist {} {}", d.getKey(), d.getTitle());
    throw new DatasetMatchFailed(d.getKey(), e);
  }

  LOG.info("{}", summary);
  return summary;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:81,代码来源:NubMatchService.java

示例5: title

import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
private String title(Dataset d) {
  return d.getKey() + ": " + d.getTitle().replaceAll("\n", " ");
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:4,代码来源:AdminCommand.java

示例6: DatasetCore

import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
public DatasetCore(Dataset d) {
  this.key = d.getKey();
  this.title = d.getTitle();
  this.parent = d.getParentDatasetKey();
  this.publisher = d.getPublishingOrganizationKey();
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:7,代码来源:DatasetCore.java


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