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


Java ParsedName.setGenusOrAbove方法代码示例

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


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

示例1: testCompareUnparsedAuthor

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testCompareUnparsedAuthor() throws Exception {
  ParsedName p1 = new ParsedName();
  p1.setScientificName("Platanus x hispanica Mill. ex Münch., 1770");
  p1.setGenusOrAbove("Platanus");
  p1.setSpecificEpithet("hispanica");
  p1.setNotho(NamePart.SPECIFIC);
  p1.setParsed(false);

  ParsedName p2 = new ParsedName();
  p2.setScientificName("Platanus hispanica Mill. ex Münch.");
  p2.setGenusOrAbove("Platanus");
  p2.setSpecificEpithet("hispanica");
  p2.setNotho(NamePart.SPECIFIC);
  p2.setAuthorship("Mill. ex Münch.");
  p2.setParsed(true);

  assertEquals(Equality.EQUAL, comp.compare(p1, p2));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:20,代码来源:AuthorComparatorTest.java

示例2: testUnparsedAuthors

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testUnparsedAuthors() throws Exception {
  ParsedName p3 = new ParsedName();
  p3.setParsed(false);
  p3.setScientificName("Blattaria Voet, ?, 1806");
  p3.setGenusOrAbove("Blattaria");

  ParsedName p4 = new ParsedName();
  p4.setScientificName("Blattaria Weyenbergh, 1874");
  p4.setAuthorship("Weyenbergh");
  p4.setYear("1874");

  assertEquals(Equality.DIFFERENT, comp.compare(p3, p4));

  p4.setYear("1806");
  assertEquals(Equality.EQUAL, comp.compare(p3, p4));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:18,代码来源:AuthorComparatorTest.java

示例3: buildScientificName

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
/**
 * Assembles the most complete scientific name based on full and individual name parts.
 * @param scientificName the full scientific name
 * @param genericName see GbifTerm.genericName
 * @param genus see DwcTerm.genus
 * @param specificEpithet see DwcTerm.specificEpithet
 * @param infraspecificEpithet see DwcTerm.infraspecificEpithet
 */
public static String buildScientificName(String scientificName, String authorship, String genericName, String genus,
                                         String specificEpithet, String infraspecificEpithet) {
  String sciname = ClassificationUtils.clean(scientificName);
  if (sciname == null) {
    // handle case when the scientific name is null and only given as atomized fields: genus & speciesEpitheton
    ParsedName pn = new ParsedName();
    if (!StringUtils.isBlank(genericName)) {
      pn.setGenusOrAbove(genericName);
    } else {
      pn.setGenusOrAbove(genus);
    }
    pn.setSpecificEpithet(specificEpithet);
    pn.setInfraSpecificEpithet(infraspecificEpithet);
    pn.setAuthorship(authorship);
    sciname = pn.canonicalNameComplete();

  } else if (!Strings.isNullOrEmpty(authorship) && !sciname.toLowerCase().contains(authorship.toLowerCase())) {
    sciname = sciname + " " + authorship;
  }

  return sciname;
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:31,代码来源:TaxonomyInterpreter.java

示例4: interpretGenus

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
/**
 * Expands abbreviated genus names with the full genus if provided in the separate classification.
 *
 * @param pn
 * @param genus
 */
@VisibleForTesting
protected static void interpretGenus(ParsedName pn, String genus) {
  // test if name has an abbreviated genus
  if (pn != null && !Strings.isNullOrEmpty(genus) && pn.getGenusOrAbove() != null && genus.length() > 1) {
    if (pn.getGenusOrAbove().length() == 2
        && pn.getGenusOrAbove().charAt(1) == '.'
        && pn.getGenusOrAbove().charAt(0) == genus.charAt(0)
        || pn.getGenusOrAbove().length() == 1 && pn.getGenusOrAbove().charAt(0) == genus.charAt(0)) {
      pn.setGenusOrAbove(genus);
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:19,代码来源:NubMatchingServiceImpl.java

示例5: testInterpretGenus

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testInterpretGenus() throws Exception {
  ParsedName pn = new ParsedName();
  pn.setGenusOrAbove("P.");
  pn.setSpecificEpithet("concolor");
  NubMatchingServiceImpl.interpretGenus(pn, "Puma");
  assertEquals("Puma concolor", pn.canonicalName());


  pn.setGenusOrAbove("P.");
  NubMatchingServiceImpl.interpretGenus(pn, "Felis");
  assertEquals("P. concolor", pn.canonicalName());
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:14,代码来源:NubMatchingServiceImplTest.java

示例6: roundtrip

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void roundtrip() throws Exception {
  ParsedName pn = new ParsedName();
  pn.setType(NameType.SCIENTIFIC);
  pn.setParsedPartially(true);
  pn.setGenusOrAbove("Abies");
  pn.setSpecificEpithet("alba");
  pn.setInfraSpecificEpithet("alpina");
  pn.setRank(Rank.INFRASUBSPECIFIC_NAME);
  pn.setBracketYear("123");
  pn.setYear("1987");
  pn.setAuthorship("Markus");
  pn.setBracketAuthorship("Peter");
  pn.setNotho(NamePart.SPECIFIC);
  pn.setRemarks("no remarks");
  pn.setNomStatus("nom.illeg.");
  pn.setInfraGeneric("Pineta");
  pn.setCultivarEpithet("Green Hell");
  pn.setSensu("Berendsohn 1999");
  pn.setStrain("train");

  pn.setScientificName(pn.fullName());

  mapper.create(pn);

  ParsedName pn2 = mapper.getByName(pn.getScientificName(), pn.getRank());
  assertEquals(pn, pn2);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:29,代码来源:ParsedNameMapperIT.java

示例7: scientificName

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void scientificName() throws Exception {
  final String UNPARSED_NAME = "A real unparsed name X73a";
  ParsedName n = new ParsedName();
  n.setType(NameType.SCIENTIFIC);
  n.setScientificName(UNPARSED_NAME);
  n.setGenusOrAbove("Abies");
  n.setAuthorship("L.");
  n.setYear("1888");
  n.setBracketAuthorship("Carl.");
  n.setRank(Rank.GENUS);

  assertAllButVirus("Abies (Carl.) L., 1888", n);

  n.setRank(Rank.SPECIES);
  assertAllButVirus("Abies spec.", n);

  n.setSpecificEpithet("alba");
  assertAllButVirus("Abies alba (Carl.) L., 1888", n);

  n.setRank(Rank.SUBSPECIES);
  assertAllButVirus("Abies alba subsp.", n);

  n.setInfraSpecificEpithet("alpina");
  final String expectedWithRank = "Abies alba subsp. alpina (Carl.) L., 1888";
  assertAllAndZoo("Abies alba alpina (Carl.) L., 1888", expectedWithRank, n);
  assertEquals("Abies alba alpina (Carl.) L., 1888", NameFormatter.scientificName(n, Kingdom.ANIMALIA));
  assertEquals(expectedWithRank, NameFormatter.scientificName(n, Kingdom.PLANTAE));

  n.setType(NameType.HYBRID);
  assertEquals(expectedWithRank, NameFormatter.scientificName(n, NomenclaturalCode.BOTANICAL));

  n.setType(NameType.VIRUS);
  assertEquals(expectedWithRank, NameFormatter.scientificName(n, NomenclaturalCode.BOTANICAL));

  n.setParsed(false);
  assertEquals(UNPARSED_NAME, NameFormatter.scientificName(n, NomenclaturalCode.BOTANICAL));

  n.setParsed(true);
  n.setRank(Rank.INFRASPECIFIC_NAME);
  assertAllButVirus("Abies alba alpina (Carl.) L., 1888", n);

  assertEquals(UNPARSED_NAME, NameFormatter.scientificName(n, Kingdom.VIRUSES));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:45,代码来源:NameFormatterTest.java

示例8: testCreateOrGet

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testCreateOrGet() throws Exception {
  ParsedName pn = new ParsedName();
  pn.setScientificName("Abies alba Mill.");
  pn.setGenusOrAbove("Abies");
  pn.setAuthorship("Mill.");
  pn.setSpecificEpithet("alba");
  pn.setType(NameType.SCIENTIFIC);
  assertNull(pn.getKey());

  ParsedName pn2 = service.createOrGet(pn, true);
  assertNotNull(pn2.getKey());
  assertEquals("Abies alba Mill.", pn2.getScientificName());
  assertEquals("Abies alba", pn2.canonicalName());
  assertEquals("Abies", pn2.getGenusOrAbove());
  assertEquals("alba", pn2.getSpecificEpithet());
  assertEquals("Mill.", pn2.getAuthorship());

  pn = service.createOrGet(parse("Abies alba Mill."), true);
  assertEquals("Abies alba Mill.", pn.getScientificName());
  assertEquals("Abies alba", pn.canonicalName());
  assertEquals("Abies", pn.getGenusOrAbove());
  assertEquals("alba", pn.getSpecificEpithet());
  assertEquals("Mill.", pn.getAuthorship());

  pn = service.createOrGet(parse("Abies sp."), true);
  assertEquals("Abies sp.", pn.getScientificName());
  assertEquals("Abies spec.", pn.canonicalName());
  assertEquals("Abies", pn.getGenusOrAbove());
  assertEquals(Rank.SPECIES, pn.getRank());
  assertNull(pn.getSpecificEpithet());

  pn = service.createOrGet(parse("×Abies Mill."), true);
  assertEquals("×Abies Mill.", pn.getScientificName());
  assertEquals("Abies", pn.canonicalName());
  assertEquals("Abies", pn.getGenusOrAbove());
  assertNull(pn.getRank());
  assertNull(pn.getSpecificEpithet());
  assertEquals(NamePart.GENERIC, pn.getNotho());

  pn = service.createOrGet(parse("? hostilis Gravenhorst, 1829"), true);
  assertEquals("? hostilis Gravenhorst, 1829", pn.getScientificName());
  assertEquals("? hostilis", pn.canonicalName());
  assertEquals("?", pn.getGenusOrAbove());
  assertEquals(Rank.SPECIES, pn.getRank());
  assertEquals("hostilis", pn.getSpecificEpithet());
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:48,代码来源:ParsedNameServiceMyBatisIT.java

示例9: testRegularImport

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
/**
 * pro parte usages are synced differently and not tested here
 */
@Test
public void testRegularImport() throws ExecutionException, InterruptedException {

  ParsedName pn = new ParsedName();
  pn.setGenusOrAbove("Abies");
  pn.setSpecificEpithet("alba");
  pn.setAuthorship("Mill.");
  pn.setScientificName(pn.fullName());
  pn.setType(NameType.SCIENTIFIC);

  NameUsage u = new NameUsage();
  u.setKey(USAGE_ID);
  u.setScientificName(pn.getScientificName());
  u.setCanonicalName(pn.canonicalName());
  u.setNameType(pn.getType());
  u.setAuthorship(pn.getAuthorship());
  u.setRank(Rank.SPECIES);
  u.setDatasetKey(Constants.NUB_DATASET_KEY);
  u.setOrigin(Origin.SOURCE);
  u.getIssues().add(NameUsageIssue.CONFLICTING_BASIONYM_COMBINATION);
  u.getIssues().add(NameUsageIssue.ACCEPTED_NAME_MISSING);

  UsageExtensions ext = new UsageExtensions();
  VerbatimNameUsage v = new VerbatimNameUsage();
  NameUsageMetrics m = new NameUsageMetrics();

  DummyData data = new DummyData(u, pn, ext, v, m);

  Future<?> f = service.sync(u.getDatasetKey(), data, Lists.newArrayList(1));
  f.get();

  NameUsageService usageService = getInstance(NameUsageService.class);
  NameUsage u2 = usageService.get(USAGE_ID, null);

  u2.setLastInterpreted(null);

  // name key is newly assigned
  u.setNameKey(u2.getNameKey());
  u.setNameKey(u2.getNameKey());
  assertNotNull(u.getNameKey());

  assertFalse(u2.getIssues().isEmpty());

  assertEquals(u, u2);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:49,代码来源:DatasetImportServiceMyBatisIT.java


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