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


Java ParsedName.setAuthorship方法代码示例

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


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

示例1: testCompareSanctioning

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
/**
 * Ignore the sanctioning author
 */
@Test
public void testCompareSanctioning() throws Exception {
  ParsedName p1 = new ParsedName();
  ParsedName p2 = new ParsedName();

  p1.setAuthorship("Fr. : Fr.");
  p2.setAuthorship("Fr.");

  assertEquals(Equality.EQUAL, comp.compare(p1, p2));

  p2.setAuthorship("Fr. : Pers.");
  assertEquals(Equality.EQUAL, comp.compare(p1, p2));

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

示例2: 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

示例3: 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

示例4: testTransliterations

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
/**
 * see http://dev.gbif.org/issues/browse/PF-2445
 */
@Test
public void testTransliterations() throws Exception {
  ParsedName p1 = new ParsedName();
  p1.setAuthorship("Müller");

  ParsedName p2 = new ParsedName();
  p2.setAuthorship("Muller");

  ParsedName p3 = new ParsedName();
  p3.setAuthorship("Mueller");

  assertEquals(Equality.EQUAL, comp.compare(p1, p2));
  assertEquals(Equality.EQUAL, comp.compare(p1, p3));
  assertEquals(Equality.EQUAL, comp.compare(p2, p3));


  p1.setAuthorship("Müll.");
  p2.setAuthorship("Mull");
  p3.setAuthorship("Muell");

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

示例5: 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

示例6: parseAuthorship

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
/**
 * Extract authorship from the name itself as best as we can to at least do some common string comparison
 */
private void parseAuthorship(ParsedName pn) {
  // try to use full sciname minus the epithets
  String lastEpithet = ObjectUtils.coalesce(pn.getInfraSpecificEpithet(), pn.getSpecificEpithet(), pn.getGenusOrAbove());
  if (lastEpithet != null && pn.getScientificName() != null) {
    int idx = pn.getScientificName().lastIndexOf(lastEpithet);
    if (idx >= 0) {
      pn.setAuthorship(pn.getScientificName().substring(idx + lastEpithet.length()));
    }
  }
  // copy full name to year, will be extracted/normalized in year comparison
  pn.setYear(pn.getScientificName());
  pn.setParsedPartially(false);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:17,代码来源:AuthorComparator.java

示例7: testEqualsSubstring

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testEqualsSubstring() throws Exception {
  ParsedName p1 = new ParsedName();
  ParsedName p2 = new ParsedName();

  p1.setAuthorship("L.");
  p2.setAuthorship("Linne");
  assertEquals(Equality.EQUAL, comp.compare(p1, p2));

  p2.setAuthorship("Lin.");
  assertEquals(Equality.EQUAL, comp.compare(p1, p2));

  p1.setAuthorship("DC.");
  p2.setAuthorship("De Candolle");
  assertEquals(Equality.EQUAL, comp.compare(p1, p2));

  p1.setAuthorship("Miller");
  p2.setAuthorship("Mill.");
  assertEquals(Equality.EQUAL, comp.compare(p1, p2));

  p1.setAuthorship("Hern.");
  p2.setAuthorship("Hernandez");
  assertEquals(Equality.EQUAL, comp.compare(p1, p2));

  p1.setAuthorship("Robertson, T., Miller, P. et Jameson, R. J.");
  p2.setAuthorship("Miller");
  assertEquals(Equality.EQUAL, comp.compare(p1, p2));

  p1.setAuthorship("T. Robertson, P. Miller & R.J. Jameson");
  p2.setAuthorship("Miller");
  assertEquals(Equality.EQUAL, comp.compare(p1, p2));

  p2.setAuthorship("Mülles");
  assertEquals(Equality.DIFFERENT, comp.compare(p1, p2));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:36,代码来源:AuthorComparatorTest.java

示例8: testBlattariaAuthors

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testBlattariaAuthors() throws Exception {
  ParsedName p1 = new ParsedName();
  p1.setAuthorship("P. Miller");
  p1.setYear("1754");

  ParsedName p2 = new ParsedName();
  p2.setAuthorship("O. Kuntze");
  p2.setYear("1891");

  ParsedName p3 = new ParsedName();
  p3.setAuthorship("Voet, ?");
  p3.setYear("1806");

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

  List<ParsedName> names = Lists.newArrayList(p1, p2, p3, p4);
  for (ParsedName p : names) {
    if (!p1.equals(p)) {
      assertEquals(Equality.DIFFERENT, comp.compare(p1, p));
    }
    if (!p2.equals(p)) {
      assertEquals(Equality.DIFFERENT, comp.compare(p2, p));
    }
    if (!p3.equals(p)) {
      assertEquals(Equality.DIFFERENT, comp.compare(p3, p));
    }
    if (!p4.equals(p)) {
      assertEquals(Equality.DIFFERENT, comp.compare(p4, p));
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:35,代码来源:AuthorComparatorTest.java

示例9: assertAuth

import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
private void assertAuth(String a1, String y1, String a1b, String y1b, Equality eq, String a2, String y2, String a2b, String y2b) {
  ParsedName p1 = new ParsedName();
  p1.setAuthorship(a1);
  p1.setYear(y1);
  p1.setBracketAuthorship(a1b);
  p1.setBracketYear(y1b);

  ParsedName p2 = new ParsedName();
  p2.setAuthorship(a2);
  p2.setYear(y2);
  p2.setBracketAuthorship(a2b);
  p2.setBracketYear(y2b);

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

示例10: 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

示例11: 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

示例12: 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

示例13: 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.setAuthorship方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。