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


Java VerbatimNameUsage类代码示例

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


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

示例1: UsageDao

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
/**
 * @param kvp
 * @param neoDir
 * @param neoFactory
 * @param registry
 */
private UsageDao(DB kvp, File neoDir, @Nullable File kvpStore, GraphDatabaseBuilder neoFactory, @Nullable MetricRegistry registry) {
  try {
    this.neoFactory = neoFactory;
    this.neoDir = neoDir;
    this.kvpStore = kvpStore;
    this.kvp = kvp;
    this.registry = registry;

    names = createKvpMap("names", ParsedName.class, 128);
    facts = createKvpMap("facts", UsageFacts.class, 128);
    verbatim = createKvpMap("verbatim", VerbatimNameUsage.class, 512);
    usages = createKvpMap("usages", NameUsage.class, 256);
    extensions = createKvpMap("extensions", UsageExtensions.class, 512);
    srcUsages = createKvpMap("srcUsages", SrcUsage.class, 256);
    nubUsages = createKvpMap("nubUsages", NubUsage.class, 256);

    openNeo();
  } catch (Exception e) {
    LOG.error("Failed to initialize a new DAO", e);
    close();
    throw e;
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:30,代码来源:UsageDao.java

示例2: parseAcceptedIDs

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
/**
 * Checks if this node is a pro parte synonym by looking if multiple accepted taxa are referred to.
 * If so, new taxon nodes are created each with a single, unique acceptedNameUsageID property.
 */
private List<String> parseAcceptedIDs(NameUsageNode nn, @Nullable VerbatimNameUsage v) {
  List<String> acceptedIds = Lists.newArrayList();
  final String unsplitIds = v.getCoreField(DwcTerm.acceptedNameUsageID);
  if (unsplitIds != null) {
    if (unsplitIds.equals(nn.usage.getTaxonID())) {
      acceptedIds.add(unsplitIds);
    } else {
      if (meta.getMultiValueDelimiters().containsKey(DwcTerm.acceptedNameUsageID)) {
        acceptedIds = meta.getMultiValueDelimiters().get(DwcTerm.acceptedNameUsageID).splitToList(unsplitIds);
      } else {
        // lookup by taxon id to see if this is an existing identifier or if we should try to split it
        Node a = nodeByTaxonId(unsplitIds);
        if (a != null) {
          acceptedIds.add(unsplitIds);
        } else {
          acceptedIds = splitByCommonDelimiters(unsplitIds);
        }
      }
    }
  }
  return acceptedIds;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:27,代码来源:Normalizer.java

示例3: createTaxonWithClassification

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的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: interpretVernacularNames

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
private void interpretVernacularNames(NameUsage u, UsageExtensions e, VerbatimNameUsage v) {
  if (v.hasExtension(Extension.VERNACULAR_NAME)) {
    for (Map<Term, String> rec : v.getExtensions().get(Extension.VERNACULAR_NAME)) {
      VernacularName vn = new VernacularName();
      vn.setVernacularName(value(rec, DwcTerm.vernacularName));
      if (vn.getVernacularName() == null) {
        u.addIssue(NameUsageIssue.VERNACULAR_NAME_INVALID);
        continue;
      }
      // locationID > locality
      vn.setArea(value(rec, DwcTerm.locationID, DwcTerm.locality));
      vn.setCountry(enumify(rec, null, countryParser, u,
                            DwcTerm.countryCode, DwcTerm.country, DwcTerm.locationID, DwcTerm.locality));
      vn.setLanguage(enumify(rec, NameUsageIssue.VERNACULAR_NAME_INVALID, languageParser, u, DcTerm.language));
      vn.setLifeStage(enumify(rec, NameUsageIssue.VERNACULAR_NAME_INVALID, lifeStageParser, u, DwcTerm.lifeStage));
      vn.setPlural(bool(rec, NameUsageIssue.VERNACULAR_NAME_INVALID, u, GbifTerm.isPlural));
      vn.setPreferred(bool(rec, NameUsageIssue.VERNACULAR_NAME_INVALID, u, GbifTerm.isPreferredName));
      vn.setSex(enumify(rec, NameUsageIssue.VERNACULAR_NAME_INVALID, sexParser, u, DwcTerm.sex));
      vn.setSource(value(rec, DcTerm.source));
      // interpret rec
      e.vernacularNames.add(vn);
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:25,代码来源:ExtensionInterpreter.java

示例5: interpretTypes

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
/**
 * We only keep type names and ignore specimens...
 */
private void interpretTypes(NameUsage u, UsageExtensions e, VerbatimNameUsage v) {
  if (v.hasExtension(Extension.TYPES_AND_SPECIMEN)) {
    for (Map<Term, String> rec : v.getExtensions().get(Extension.TYPES_AND_SPECIMEN)) {
      TypeSpecimen t = new TypeSpecimen();
      // interpret
      t.setScientificName(expandGenus(value(rec, DwcTerm.scientificName), u.getScientificName()));

      if (t.getScientificName() == null || t.getScientificName().equalsIgnoreCase(u.getScientificName())) {
        LOG.debug("Ignore type name for {} as the name is the same as the taxon", u.getScientificName());
        continue;
      }
      t.setTypeDesignatedBy(value(rec, GbifTerm.typeDesignatedBy));
      t.setTypeStatus(enumify(rec, null, typeStatusParser, u, DwcTerm.typeStatus));
      t.setSource(value(rec, DcTerm.source));
      //t.setCitation(value(rec, DcTerm.bibliographicCitation));
      //t.setTypeDesignationType(value(rec, GbifTerm.typeDesignatedType));
      e.typeSpecimens.add(t);
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:24,代码来源:ExtensionInterpreter.java

示例6: interpretSpeciesProfiles

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
private void interpretSpeciesProfiles(NameUsage u, UsageExtensions e, VerbatimNameUsage v) {
  if (v.hasExtension(Extension.SPECIES_PROFILE)) {
    for (Map<Term, String> rec : v.getExtensions().get(Extension.SPECIES_PROFILE)) {
      SpeciesProfile s = new SpeciesProfile();
      // interpret rec
      s.setSource(value(rec, DcTerm.source));
      s.setAgeInDays(integer(rec, NameUsageIssue.SPECIES_PROFILE_INVALID, u, GbifTerm.ageInDays));
      s.setMassInGram(integer(rec, NameUsageIssue.SPECIES_PROFILE_INVALID, u, GbifTerm.massInGram));
      s.setSizeInMillimeter(integer(rec, NameUsageIssue.SPECIES_PROFILE_INVALID, u, GbifTerm.sizeInMillimeter));
      s.setHybrid(bool(rec, NameUsageIssue.SPECIES_PROFILE_INVALID, u, GbifTerm.isHybrid));
      s.setMarine(bool(rec, NameUsageIssue.SPECIES_PROFILE_INVALID, u, GbifTerm.isMarine));
      s.setFreshwater(bool(rec, NameUsageIssue.SPECIES_PROFILE_INVALID, u, GbifTerm.isFreshwater));
      s.setTerrestrial(bool(rec, NameUsageIssue.SPECIES_PROFILE_INVALID, u, GbifTerm.isTerrestrial));
      s.setExtinct(bool(rec, NameUsageIssue.SPECIES_PROFILE_INVALID, u, GbifTerm.isExtinct));
      s.setLivingPeriod(value(rec, GbifTerm.livingPeriod));
      s.setLifeForm(value(rec, GbifTerm.lifeForm));
      s.setHabitat(value(rec, DwcTerm.habitat));
      e.speciesProfiles.add(s);
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:22,代码来源:ExtensionInterpreter.java

示例7: interpretReference

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
private void interpretReference(NameUsage u, UsageExtensions e, VerbatimNameUsage v) {
  if (v.hasExtension(Extension.REFERENCE)) {
    for (Map<Term, String> rec : v.getExtensions().get(Extension.REFERENCE)) {
      Reference r = new Reference();
      // interpret rec
      r.setType(value(rec, DcTerm.type));
      r.setCitation(value(rec, DcTerm.bibliographicCitation));
      r.setTitle(value(rec, DcTerm.title));
      r.setAuthor(value(rec, DcTerm.creator));
      r.setDate(value(rec, DcTerm.date, DcTerm.created));
      r.setSource(value(rec, DcTerm.source));
      r.setRemarks(value(rec, DwcTerm.taxonRemarks));
      // TODO: need to check this mapping!
      r.setDoi(value(rec, DcTerm.identifier));
      r.setLink(value(rec, DcTerm.references));
      e.referenceList.add(r);
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:20,代码来源:ExtensionInterpreter.java

示例8: interpretMultimedia

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
private void interpretMultimedia(NameUsage u, UsageExtensions e, VerbatimNameUsage v) {
  extractMedia(u, e, v, Extension.IMAGE, false);
  extractMedia(u, e, v, Extension.MULTIMEDIA, false);
  extractMedia(u, e, v, Extension.EOL_MEDIA, true);
  extractMedia(u, e, v, Extension.AUDUBON, false);
  extractMediaCore(u, e, v);
  /**
   * merges media records if the same image URL or link is given several times.
   * Remove any media that has not either a file or webpage uri.
   */
  Map<String, NameUsageMediaObject> media = Maps.newLinkedHashMap();
  for (NameUsageMediaObject m : e.media) {
    // we can get file uris or weblinks. Prefer file URIs as they clearly identify a single image
    URI uri = m.getIdentifier() != null ? m.getIdentifier() : m.getReferences();
    if (uri != null) {
      String url = uri.toString();
      if (media.containsKey(url)) {
        // TODO: merge infos about the same image?
      } else {
        media.put(url, m);
      }
    }
  }
  e.media = Lists.newArrayList(media.values());
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:26,代码来源:ExtensionInterpreter.java

示例9: interpretIdentifier

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
private void interpretIdentifier(NameUsage u, UsageExtensions e, VerbatimNameUsage v) {
  if (v.hasExtension(Extension.IDENTIFIER)) {
    for (Map<Term, String> rec : v.getExtensions().get(Extension.IDENTIFIER)) {
      Identifier i = new Identifier();
      // interpret rec
      i.setIdentifier(value(rec, DcTerm.identifier));
      if (i.getIdentifier() == null) {
        u.addIssue(NameUsageIssue.ALT_IDENTIFIER_INVALID);
        continue;
      }
      i.setTitle(value(rec, DcTerm.title));
      i.setType(IdentifierType.inferFrom(i.getIdentifier()));
      e.identifiers.add(i);
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:17,代码来源:ExtensionInterpreter.java

示例10: testEmptyModels

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
@Test
public void testEmptyModels() throws Exception {
    assertSerde(new NameUsage());
    assertSerde(new VerbatimNameUsage());
    assertSerde(new NameUsageMetrics());
    assertSerde(new UsageExtensions());
    assertSerde(new ParsedName());
    assertSerde(new Description());
    assertSerde(new Distribution());
    assertSerde(new Identifier());
    assertSerde(new NameUsageMediaObject());
    assertSerde(new Reference());
    assertSerde(new SpeciesProfile());
    assertSerde(new NameUsage());
    assertSerde(new TypeSpecimen());
    assertSerde(new VernacularName());
    assertSerde(new DatasetMetrics());
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:19,代码来源:CliKryoFactoryTest.java

示例11: assertName

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
private NameUsageContainer assertName(VerbatimNameUsage v, Rank rank, String sciname, String canonical, NameType ntype)
    throws IgnoreNameUsageException {
  NameUsageContainer u = new NameUsageContainer();
  ins.parseName(u, v, rank);
  if (sciname != null) {
    assertEquals(sciname, u.getScientificName());
  } else {
    assertNull(u.getScientificName());
  }
  if (canonical != null) {
    assertEquals(canonical, u.getCanonicalName());
  } else {
    assertNull(u.getCanonicalName());
  }
  if (ntype != null) {
    assertEquals(ntype, u.getNameType());
  } else {
    assertNull(u.getNameType());
  }
  return u;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:22,代码来源:NeoInserterTest.java

示例12: testVernacularNames

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
@Test
public void testVernacularNames() throws Exception {
  ExtensionInterpreter interp = new ExtensionInterpreter();
  NameUsage u = new NameUsage();
  VerbatimNameUsage v = new VerbatimNameUsage();

  Map<Term, String> v1 = Maps.newHashMap();
  v1.put(DwcTerm.vernacularName, "palmeirinha");
  v1.put(DcTerm.language, "PORTUGUES");
  v1.put(DwcTerm.locality, "Acre");

  Map<Term, String> v2 = Maps.newHashMap();
  v2.put(DwcTerm.vernacularName, "ubim");
  v2.put(DcTerm.language, "PORTUGUES");
  v2.put(DwcTerm.locality, "Acre");

  v.getExtensions().put(Extension.VERNACULAR_NAME, Lists.newArrayList(v1, v2));

  UsageExtensions ext = interp.interpret(u, v);
  assertEquals(2, ext.vernacularNames.size());
  assertTrue(u.getIssues().isEmpty());
  assertEquals("palmeirinha", ext.vernacularNames.get(0).getVernacularName());
  assertEquals(Language.PORTUGUESE, ext.vernacularNames.get(0).getLanguage());
  assertEquals("Acre", ext.vernacularNames.get(0).getArea());
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:26,代码来源:ExtensionInterpreterTest.java

示例13: testRoundTripping

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
@Test
public void testRoundTripping() throws Exception {
  VerbatimNameUsage v = new VerbatimNameUsage();
  v.setCoreField(DwcTerm.scientificName, "Abies alba");
  v.setCoreField(DwcTerm.taxonRank, "Gattung");
  v.setCoreField(DwcTerm.taxonID, "dqwd23");
  v.setCoreField(GbifTerm.depth, "1200");
  v.setCoreField(new UnknownTerm(qname1), "1200");
  v.setCoreField(new UnknownTerm(qname2), null);

  List<Map<Term, String>> vernaculars = Lists.newArrayList();
  vernaculars.add(map(DwcTerm.vernacularName, "Tanne", DcTerm.language, "de"));
  vernaculars.add(map(DwcTerm.vernacularName, "Fir", DcTerm.language, "en", new UnknownTerm(qname2), ""));
  v.getExtensions().put(Extension.VERNACULAR_NAME, vernaculars);

  List<Map<Term, String>> infos = Lists.newArrayList();
  infos.add(map(GbifTerm.ageInDays, "750", IucnTerm.threatStatus, "extinct", GbifTerm.isExtinct, "true"));
  v.getExtensions().put(Extension.SPECIES_PROFILE, infos);

  String json = mapper.write(v);

  VerbatimNameUsage v2 = mapper.read(json);
  assertEquals(v, v2);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:25,代码来源:VerbatimNameUsageMapperJsonTest.java

示例14: buildAuthorship

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
private static String buildAuthorship(VerbatimNameUsage v) {
  StringBuilder sb = new StringBuilder();
  if (v.hasCoreField(DwcTerm.scientificNameAuthorship)) {
    sb.append(v.getCoreField(DwcTerm.scientificNameAuthorship));
  }
  if (v.hasCoreField(DwcTerm.namePublishedInYear) && !sb.toString().contains(v.getCoreField(DwcTerm.namePublishedInYear))) {
    if (sb.length() > 0) {
      sb.append(", ");
    }
    sb.append(v.getCoreField(DwcTerm.namePublishedInYear));
  }
  return sb.toString();
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:14,代码来源:NeoInserter.java

示例15: firstClean

import org.gbif.api.model.checklistbank.VerbatimNameUsage; //导入依赖的package包/类
private static String firstClean(VerbatimNameUsage v, Term... terms) {
  for (Term t : terms) {
    String x = clean(v.getCoreField(t));
    if (x != null) {
      return x;
    }
  }
  return null;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:10,代码来源:NeoInserter.java


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