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


Java Origin类代码示例

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


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

示例1: getOrigin

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
public Origin getOrigin()
   {
NameUsage<? extends NubNameUsage> n = getNameUsage();
if(n != this && n instanceof NubNameUsage) {
    return ((NubNameUsage)n).getOrigin();
}
if(scientificNameUsage != null) {
    return scientificNameUsage.getOrigin();
}
else if (nameUsageSearchResult != null) {
    return  nameUsageSearchResult.getOrigin();
}
else {
    return null;
}
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:17,代码来源:NubNameUsage.java

示例2: convert

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
private NameUsage convert(NubUsage nub) {
  NameUsage u = new NameUsage();
  u.setKey(nub.usageKey);
  u.setConstituentKey(nub.datasetKey);
  //TODO: add a scientificNameID property to NameUsage
  //nub.scientificNameID
  u.setTaxonID("gbif:" + nub.usageKey);
  u.setScientificName(nub.parsedName.getScientificName());
  u.setCanonicalName(canonicalOrScientificName(nub.parsedName));
  u.setRank(nub.rank);
  u.setTaxonomicStatus(nub.status);
  u.setNomenclaturalStatus(nub.nomStatus);
  u.setPublishedIn(nub.publishedIn);
  u.setOrigin(nub.origin);
  if (!nub.sourceIds.isEmpty()) {
    u.setSourceTaxonKey(nub.sourceIds.getInt(0));
  } else if (nub.origin.equals(Origin.SOURCE)) {
    LOG.warn("Source usage without source id found {} {}", u.getKey(), u.getScientificName());
  }
  u.setRemarks(remarkJoiner.join(nub.remarks));
  u.setIssues(nub.issues);
  return u;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:24,代码来源:UsageDao.java

示例3: createTaxonWithClassification

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
/**
 * Creates a new taxon in neo and the name usage kvp using the source usages as a template for the classification properties.
 * Only copies the classification above genus and ignores genus and below!
 * A verbatim usage is created with just the parentNameUsage(ID) values so they can get resolved into proper neo relations later.
 *
 * @param taxonID the optional taxonID to apply to the new node
 */
private Node createTaxonWithClassification(Origin origin, String sciname, Rank rank, TaxonomicStatus status, NameUsageNode source,
                                           @Nullable String taxonID, @Nullable String remarks, VerbatimNameUsage sourceVerbatim) {
  NameUsage u = new NameUsage();
  u.setScientificName(sciname);
  u.setCanonicalName(sciname);
  u.setRank(rank);
  u.setOrigin(origin);
  u.setTaxonomicStatus(status);
  u.setTaxonID(taxonID);
  u.setRemarks(remarks);
  // copy verbatim classification from source
  ClassificationUtils.copyLinneanClassification(source.usage, u);
  removeGenusAndBelow(u);
  Node n = create(u, false).node;
  // copy parent props from source
  VerbatimNameUsage v = new VerbatimNameUsage();
  v.setCoreField(DwcTerm.parentNameUsageID, sourceVerbatim.getCoreField(DwcTerm.parentNameUsageID));
  v.setCoreField(DwcTerm.parentNameUsage, sourceVerbatim.getCoreField(DwcTerm.parentNameUsage));
  dao.store(n.getId(), v);
  return n;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:29,代码来源:Normalizer.java

示例4: testCountTaxa

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
@Test
public void testCountTaxa() throws Exception {
  UsageDao dao = UsageDao.temporaryDao(10);
  NubDb nub = NubDb.create(dao, AuthorComparator.createWithoutAuthormap());
  try (Transaction tx = dao.beginTx()) {

    assertEquals(0l, nub.countTaxa());

    NubUsage u = new NubUsage();
    u.parsedName = new ParsedName();
    u.origin = Origin.SOURCE;
    u.rank = Rank.SPECIES;
    nub.addRoot(u);
    assertEquals(1l, nub.countTaxa());

    // we add the same nub usage which already has a neo node, nothing changes
    nub.addRoot(u);
    assertEquals(1l, nub.countTaxa());

    u.node = null;
    nub.addRoot(u);
    assertEquals(2l, nub.countTaxa());
    tx.success();
  }

}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:27,代码来源:NubDbTest.java

示例5: nubusage

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
public static NubUsage nubusage(int key) {
  NubUsage u = new NubUsage();
  u.usageKey = key;
  u.datasetKey = UUID.randomUUID();
  u.kingdom = Kingdom.byNubUsageId(RND.nextInt(8));
  u.origin = Origin.SOURCE;
  u.addRemark(StringUtils.randomSpecies());
  u.parsedName = new ParsedName();
  u.parsedName.setGenusOrAbove(StringUtils.randomGenus());
  u.parsedName.setSpecificEpithet(StringUtils.randomEpithet());
  if (key % 5 == 0) {
    u.rank = Rank.SUBSPECIES;
    u.parsedName.setInfraSpecificEpithet(StringUtils.randomEpithet());
  } else {
    u.rank = Rank.SPECIES;
  }
  u.parsedName.setAuthorship(StringUtils.randomAuthor());
  u.parsedName.setYear(StringUtils.randomSpeciesYear());
  u.parsedName.setScientificName(u.parsedName.fullName());
  u.status = TaxonomicStatus.ACCEPTED;
  return u;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:23,代码来源:UsageDaoTest.java

示例6: testHighestParent

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
@Test
public void testHighestParent() throws Exception {
  try(Transaction tx = dao.beginTx()) {

    Node n = idb.create(Origin.DENORMED_CLASSIFICATION, "Abies Mill.", Rank.GENUS, TaxonomicStatus.ACCEPTED, false).node;
    tx.success();

    assertEquals(n, idb.getDirectParent(n).node);


    Node syn = idb.create(Origin.DENORMED_CLASSIFICATION, "Pinus", Rank.GENUS, TaxonomicStatus.SYNONYM, false).node;
    Node n2 = idb.create(Origin.DENORMED_CLASSIFICATION, "Pinaceae", Rank.FAMILY, TaxonomicStatus.ACCEPTED, false).node;
    Node n3 = idb.create(Origin.DENORMED_CLASSIFICATION, "Pinales", Rank.ORDER, TaxonomicStatus.ACCEPTED, false).node;
    Node n4 = idb.create(Origin.DENORMED_CLASSIFICATION, "Plantae", Rank.KINGDOM, TaxonomicStatus.ACCEPTED, false).node;
    n4.createRelationshipTo(n3, RelType.PARENT_OF);
    n3.createRelationshipTo(n2, RelType.PARENT_OF);
    n2.createRelationshipTo(n, RelType.PARENT_OF);
    syn.createRelationshipTo(n, RelType.SYNONYM_OF);
    tx.success();

    assertEquals(n4, idb.getDirectParent(n).node);
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:24,代码来源:ImportDbTest.java

示例7: testGetCountByRank

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
@Test
public void testGetCountByRank() throws Exception {
    NormalizerStats stats = new NormalizerStats(1, 2, 12, 1,
            ImmutableMap.of(Origin.DENORMED_CLASSIFICATION, 2, Origin.IMPLICIT_NAME, 10, Origin.SOURCE, 50),
            ImmutableMap.of(Rank.KINGDOM, 2, Rank.GENUS, 10, Rank.SPECIES, 50),
            Lists.<String>newArrayList());
    assertEquals(62, stats.getCount());
    assertEquals(12, stats.getSynonyms());
    assertEquals(2, stats.getDepth());
    assertEquals(1, stats.getRoots());
    assertEquals(1, stats.getIgnored());

    assertEquals(50, stats.getCountByOrigin(Origin.SOURCE));
    assertEquals(2, stats.getCountByOrigin(Origin.DENORMED_CLASSIFICATION));
    assertEquals(10, stats.getCountByOrigin(Origin.IMPLICIT_NAME));

    assertEquals(50, stats.getCountByRank(Rank.SPECIES));
    assertEquals(10, stats.getCountByRank(Rank.GENUS));
    assertEquals(2, stats.getCountByRank(Rank.KINGDOM));
    assertEquals(0, stats.getCountByRank(Rank.FAMILY));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:22,代码来源:NormalizerStatsTest.java

示例8: testMissingGenusFloraBrazil

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
/**
 * http://dev.gbif.org/issues/browse/POR-2755
 */
@Test
public void testMissingGenusFloraBrazil() throws Exception {
  final UUID datasetKey = NormalizerTest.datasetKey(19);

  // insert neo db
  NormalizerStats stats = insertNeo(datasetKey);
  assertEquals(3, stats.getRoots());
  assertEquals(151, stats.getCount());
  assertEquals(62, stats.getSynonyms());
  assertEquals(3, stats.getCountByOrigin(Origin.VERBATIM_PARENT));
  assertEquals(1, stats.getCountByOrigin(Origin.VERBATIM_ACCEPTED));
  assertEquals(60, stats.getCountByOrigin(Origin.MISSING_ACCEPTED));
  assertEquals(87, stats.getCountByOrigin(Origin.SOURCE));

  // 1st import
  runImport(datasetKey);
  assertTrue(usageService.maxUsageKey(datasetKey) > Constants.NUB_MAXIMUM_KEY);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:22,代码来源:ImporterIT.java

示例9: isImplicit

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
public boolean isImplicit()
   {
NameUsage<? extends NubNameUsage> n = getNameUsage();
if(n != this) {
    if(n instanceof NubNameUsage) {
	return ((NubNameUsage)n).isImplicit();
    }
}

org.gbif.api.model.checklistbank.NameUsage scientificNameUsage = getScientificNameUsage();
if (scientificNameUsage == null)
    return super.isImplicit();

return Origin.SOURCE != scientificNameUsage.getOrigin();
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:16,代码来源:NubNameUsage.java

示例10: create

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
protected NameUsageNode create(Origin origin, String sciname, Rank rank, TaxonomicStatus status, boolean isRoot, @Nullable String taxonID, @Nullable String remark) {
  NameUsage u = new NameUsage();
  u.setScientificName(sciname);
  // or generate via parsed name below???
  u.setCanonicalName(sciname);
  u.setRank(rank);
  u.setOrigin(origin);
  u.setTaxonomicStatus(status);
  u.setTaxonID(taxonID);
  u.setRemarks(remark);
  return create(u, isRoot);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:13,代码来源:ImportDb.java

示例11: setupParentRel

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
/**
 * Sets up the parent relations using the parentNameUsage(ID) term values.
 * The denormed, flat classification is used in a next step later.
 */
private void setupParentRel(NameUsageNode nn, @Nullable VerbatimNameUsage v) {
  Node parent = null;
  if (v != null) {
    final String id = v.getCoreField(DwcTerm.parentNameUsageID);
    if (id != null) {
      if ((nn.usage.getTaxonID() == null || !id.equals(nn.usage.getTaxonID()))) {
        parent = nodeByTaxonId(id);
        if (parent == null) {
          nn.addIssue(NameUsageIssue.PARENT_NAME_USAGE_ID_INVALID);
          LOG.debug("parentNameUsageID {} not existing", id);
        }
      }
    } else {
      final String name = v.getCoreField(DwcTerm.parentNameUsage);
      if (name != null && !name.equals(nn.usage.getScientificName())) {
        try {
          parent = nodeBySciname(name);
          if (parent == null && !name.equals(nn.usage.getCanonicalName())) {
            parent = nodeByCanonical(name);
          }
          if (parent == null) {
            LOG.debug("parentNameUsage {} not existing, materialize it", name);
            parent = create(Origin.VERBATIM_PARENT, name, null, TaxonomicStatus.DOUBTFUL, true).node;
          }
        } catch (NotUniqueException e) {
          nn.addIssue(NameUsageIssue.PARENT_NAME_NOT_UNIQUE);
          LOG.warn("parentNameUsage {} not unique, ignore relationship for name {} and taxonID {}", name, nn.usage.getScientificName(), nn.usage.getTaxonID());
          parent = create(Origin.VERBATIM_PARENT, name, null, TaxonomicStatus.DOUBTFUL, true).node;
        }
      }
    }
  }
  if (parent != null && !parent.equals(nn.node)) {
    parent.createRelationshipTo(nn.node, RelType.PARENT_OF);
  } else if (!nn.usage.isSynonym()) {
    nn.node.addLabel(Labels.ROOT);
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:43,代码来源:Normalizer.java

示例12: setupBasionymRel

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
private void setupBasionymRel(NameUsageNode nn, @Nullable VerbatimNameUsage v) {
  if (meta.isOriginalNameMapped() && v != null) {
    Node basionym = null;
    final String id = v.getCoreField(DwcTerm.originalNameUsageID);
    if (id != null) {
      if (!id.equals(nn.usage.getTaxonID())) {
        basionym = nodeByTaxonId(id);
        if (basionym == null) {
          nn.addIssue(NameUsageIssue.ORIGINAL_NAME_USAGE_ID_INVALID);
          LOG.debug("originalNameUsageID {} not existing", id);
        }
      }
    } else {
      final String name = v.getCoreField(DwcTerm.originalNameUsage);
      if (name != null && !name.equals(nn.usage.getScientificName())) {
        try {
          basionym = nodeBySciname(name);
          if (basionym == null && !name.equals(nn.usage.getCanonicalName())) {
            basionym = nodeByCanonical(name);
          }
          if (basionym == null) {
            LOG.debug("originalNameUsage {} not existing, materialize it", name);
            basionym = create(Origin.VERBATIM_BASIONYM, name, null, TaxonomicStatus.DOUBTFUL, true).node;
          }
        } catch (NotUniqueException e) {
          nn.addIssue(NameUsageIssue.ORIGINAL_NAME_NOT_UNIQUE);
          LOG.warn("originalNameUsage {} not unique, ignore relationship for taxonID {}", nn.usage.getScientificName(), nn.usage.getTaxonID());
        }
      }
    }
    if (basionym != null && !basionym.equals(nn.node)) {
      basionym.createRelationshipTo(nn.node, RelType.BASIONYM_OF);
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:36,代码来源:Normalizer.java

示例13: NormalizerStats

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
@JsonCreator
public NormalizerStats(@JsonProperty("roots") int roots, @JsonProperty("depth") int depth,
                       @JsonProperty("synonyms") int synonyms, @JsonProperty("ignored") int ignored,
                       @JsonProperty("countByOrigin") Map<Origin, Integer> countByOrigin,
                       @JsonProperty("countByRank") Map<Rank, Integer> countByRank, @JsonProperty("cycles") List<String> cycles) {
  this.roots = roots;
  this.depth = depth;
  this.synonyms = synonyms;
  this.ignored = ignored;
  this.countByOrigin = countByOrigin;
  this.countByRank = countByRank;
  this.cycles = cycles;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:14,代码来源:NormalizerStats.java

示例14: syncProParte

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
private void syncProParte() {
  if (!proParteNodes.isEmpty()) {
    LOG.info("Syncing {} pro parte usages", proParteNodes.size());
    for (List<Long> ids : Iterables.partition(proParteNodes, cfg.chunkSize)) {
      List<NameUsage> usages = Lists.newArrayList();
      List<ParsedName> names = Lists.newArrayList();
      try (Transaction tx = dao.getNeo().beginTx()) {
        for (Long id : ids) {
          Node n = dao.getNeo().getNodeById(id);
          NameUsage primary = readUsage(n);
          ParsedName pn = readName(id);
          // modify as a template for all cloned pro parte usages
          primary.setProParteKey(primary.getKey());
          primary.setOrigin(Origin.PROPARTE);
          primary.setTaxonID(null); // if we keep the original id we will do an update, not an insert
          primary.setParentKey(null);
          for (Relationship rel : n.getRelationships(RelType.PROPARTE_SYNONYM_OF, Direction.OUTGOING)) {
            // pro parte synonyms keep their id in the relation, read it
            // http://dev.gbif.org/issues/browse/POR-2872
            NameUsage u = clone(primary);
            u.setKey( (Integer) rel.getProperty(NeoProperties.USAGE_KEY, null));
            Node accN = rel.getEndNode();
            // all nodes should be synced by now, so clb keys must be known
            u.setAcceptedKey(clbKeys.get((int) accN.getId()));
            // use accepted taxon classification for this synonym record
            applyClbClassification(u, accN.getId());
            usages.add(u);
            names.add(pn);
          }
        }
      }
      // submit sync job
      syncCounterProParte = syncCounterProParte + usages.size();
      proParteFuture = sqlService.sync(datasetKey, this, usages, names);
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:38,代码来源:Importer.java

示例15: usage

import org.gbif.api.vocabulary.Origin; //导入依赖的package包/类
private void usage(Node n, String name, Rank rank, TaxonomicStatus status) {
  NameUsage u = new NameUsage();
  u.setScientificName(name);
  u.setRank(rank);
  u.setTaxonomicStatus(status);
  u.setOrigin(Origin.SOURCE);
  dao.store(n.getId(), u, true);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:9,代码来源:ChunkingEvaluatorTest.java


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