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


Java Language类代码示例

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


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

示例1: testVernacularNames

import org.gbif.api.vocabulary.Language; //导入依赖的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

示例2: testAnalyse

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testAnalyse() {
    final Date downloaded = new Date();
    DatasetMetrics d = service.analyse(ClbDbTestRule.SQUIRRELS_DATASET_KEY, downloaded);
    System.out.println(d);
    assertEquals(ClbDbTestRule.SQUIRRELS_DATASET_KEY, d.getDatasetKey());
    assertEquals(downloaded, d.getDownloaded());
    assertEquals(44, d.getUsagesCount());
    assertEquals(16, d.getSynonymsCount());
    assertEquals(44, d.getDistinctNamesCount());
    assertEquals(2, d.getNubMatchingCount());
    assertEquals(4, d.getNubCoveragePct());
    assertEquals(0, d.getColCoveragePct());
    assertEquals(0, d.getColMatchingCount());
    assertEquals(1, d.getCountByKingdom().size());
    // there are more animal records in this dataset, but only 2 are mapped to the nub!
    assertEquals(2, d.getCountByKingdom(Kingdom.ANIMALIA));
    assertEquals(0, d.getCountByKingdom(Kingdom.PLANTAE));
    assertEquals(10, d.getCountByRank(Rank.SUBSPECIES));
    assertEquals(3, d.getCountByRank(Rank.SPECIES));
    assertEquals(2, d.getCountByRank(Rank.GENUS));
    assertEquals(1, d.getCountByRank(Rank.PHYLUM));
    assertEquals(4, d.getCountNamesByLanguage(Language.ENGLISH));
    assertEquals(2, d.getCountNamesByLanguage(Language.GERMAN));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:26,代码来源:DatasetAnalysisServiceMyBatisIT.java

示例3: testMapper

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testMapper() throws Exception {
    assertTrue(mapper.listByChecklistUsage(usageKey, new PagingRequest()).isEmpty());
    assertTrue(mapper.listByNubUsage(usageKey, new PagingRequest()).isEmpty());

    Description obj = new Description();
    obj.setContributor("contribtr");
    obj.setCreator("creatr");
    obj.setDescription("description");
    obj.setLanguage(Language.ABKHAZIAN);
    obj.setLicense("license");
    obj.setType("myType");
    // these should get ignored
    obj.setSource("sourcy s");
    obj.setSourceTaxonKey(123);

    mapper.insert(usageKey, obj, citationKey1);

    Description obj2 = mapper.listByChecklistUsage(usageKey, new PagingRequest()).get(0);
    assertObject(obj, obj2, citation1, null);


    obj2 = mapper.listByNubUsage(nubKey, new PagingRequest()).get(0);
    // these are now nub source usage values
    assertObject(obj, obj2, datasetTitle, usageKey);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:27,代码来源:DescriptionMapperTest.java

示例4: addDescription

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
public void addDescription(int key, Language lang, String topic) {
  topic = Strings.isNullOrEmpty(topic) ? DEFAULT_TOPIC : topic.toLowerCase().trim();

  if (lang == null) {
    // default to english
    lang = Language.ENGLISH;
  }

  if (!toc.containsKey(lang)) {
    toc.put(lang, Maps.<String, List<Integer>>newTreeMap());
  }
  if (!toc.get(lang).containsKey(topic)) {
    toc.get(lang).put(topic, Lists.<Integer>newArrayList());
  }
  toc.get(lang).get(topic).add(key);
}
 
开发者ID:gbif,项目名称:gbif-api,代码行数:17,代码来源:TableOfContents.java

示例5: getFacetEnumValue

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
/**
 * Gets the facet value of Enum type parameter.
 * If the Enum is either a Country or a Language, its iso2Letter code it's used.
 */
public static <P extends SearchParameter> String getFacetEnumValue(P facetParam, String value) {
  // the expected enum type for the value if it is an enum - otherwise null
  final Enum<?>[] enumValues = ((Class<? extends Enum<?>>) facetParam.type()).getEnumConstants();
  // if we find integers these are ordinals, translate back to enum names
  final Integer intValue = Ints.tryParse(value);
  if (null != intValue) {
    final Enum<?> enumValue = enumValues[intValue];
    if (Country.class.equals(facetParam.type())) {
      return ((Country) enumValue).getIso2LetterCode();
    } else if (Language.class.equals(facetParam.type())) {
      return ((Language) enumValue).getIso2LetterCode();
    } else {
      return enumValue.name();
    }
  } else {
    if (Country.class.equals(facetParam.type())) {
      return Country.fromIsoCode(value).getIso2LetterCode();
    } else if (Language.class.equals(facetParam.type())) {
      return Language.fromIsoCode(value).getIso2LetterCode();
    } else {
      return VocabularyUtils.lookupEnum(value, (Class<? extends Enum<?>>) facetParam.type()).name();
    }
  }
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:29,代码来源:SolrQueryUtils.java

示例6: testGetResult

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testGetResult() throws ServiceUnavailableException {
  try {
    when(mockedRs.getObject("language_i")).thenReturn("en");
    assertThat(th.getResult(mockedRs, "language_i"), is(Language.ENGLISH));
  } catch (SQLException e) {
  }
}
 
开发者ID:gbif,项目名称:common-mybatis,代码行数:9,代码来源:LanguageTypeHandlerTest.java

示例7: testCompleteness

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testCompleteness() {
  for (Language t : Language.values()) {
    if (t == Language.UNKNOWN) {
      assertTrue(conv.fromEnum(t) == null);
    } else {
      assertTrue(conv.fromEnum(t) != null);
    }
  }
}
 
开发者ID:gbif,项目名称:common-mybatis,代码行数:11,代码来源:LanguageConverterTest.java

示例8: testToEnum

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testToEnum() {
  assertEquals(Language.DANISH, conv.toEnum("DA"));
  assertEquals(Language.DANISH, conv.toEnum("da"));
  assertEquals(Language.ENGLISH, conv.toEnum("EN"));
  assertEquals(Language.SPANISH, conv.toEnum("ES"));
  assertEquals(Language.UNKNOWN, conv.toEnum("ZZ"));
  assertEquals(Language.UNKNOWN, conv.toEnum("nothing"));
  assertEquals(Language.UNKNOWN, conv.toEnum(""));
  assertEquals(Language.UNKNOWN, conv.toEnum(" "));
  assertEquals(Language.UNKNOWN, conv.toEnum(null));
}
 
开发者ID:gbif,项目名称:common-mybatis,代码行数:13,代码来源:LanguageConverterTest.java

示例9: testGet

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testGet() {
  final Integer KEY = 14;
  Description d = wsClient.get(KEY);
  assertEquals("introduction", d.getType());
  assertEquals(Language.ENGLISH, d.getLanguage());

  assertNull(wsClient.get(-2));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:10,代码来源:DescriptionWsClientIT.java

示例10: testGet

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testGet() {
  DatasetMetrics d = wsClient.get(CHECKLIST_KEY);
  assertEquals(CHECKLIST_KEY, d.getDatasetKey());
  assertEquals(1000, d.getUsagesCount());
  assertEquals(25, d.getColCoveragePct());
  assertEquals(250, d.getColMatchingCount());
  assertEquals(100, d.getCountByKingdom(Kingdom.ANIMALIA));
  assertEquals(700, d.getCountByKingdom(Kingdom.PLANTAE));
  assertEquals(0, d.getCountByKingdom(Kingdom.FUNGI));
  assertEquals(120, d.getCountByRank(Rank.GENUS));
  assertEquals(10, d.getCountByRank(Rank.PHYLUM));
  assertEquals(4, d.getCountNamesByLanguage(Language.DANISH));
  assertEquals(132, d.getCountNamesByLanguage(Language.GERMAN));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:16,代码来源:DatasetMetricsWsClientIT.java

示例11: bindTypeHandlers

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Override
protected void bindTypeHandlers() {
  // mybatis type handler
  handleType(Country.class).with(CountryTypeHandler.class);
  handleType(Language.class).with(LanguageTypeHandler.class);
  handleType(UUID.class).with(UuidTypeHandler.class);
  handleType(URI.class).with(UriTypeHandler.class);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:9,代码来源:InternalChecklistBankServiceMyBatisModule.java

示例12: testInsert

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testInsert() {
    DatasetMetricsServiceMyBatis srv = (DatasetMetricsServiceMyBatis) service;

    srv.create(ClbDbTestRule.SQUIRRELS_DATASET_KEY, new Date());

    DatasetMetrics d = service.get(ClbDbTestRule.SQUIRRELS_DATASET_KEY);
    assertEquals(ClbDbTestRule.SQUIRRELS_DATASET_KEY, d.getDatasetKey());
    assertEquals(44, d.getUsagesCount());
    assertEquals(16, d.getSynonymsCount());
    assertEquals(44, d.getDistinctNamesCount());
    assertEquals(2, d.getNubMatchingCount());
    assertEquals(0, d.getColMatchingCount());
    assertEquals(0, d.getColCoveragePct());

    assertEquals(44, d.getCountByOrigin(Origin.SOURCE));
    assertEquals(2, d.getCountByKingdom(Kingdom.ANIMALIA));
    assertEquals(0, d.getCountByKingdom(Kingdom.FUNGI));
    assertEquals(2, d.getCountByRank(Rank.GENUS));
    assertEquals(1, d.getCountByRank(Rank.PHYLUM));
    assertEquals(10, d.getCountByRank(Rank.SUBSPECIES));
    assertEquals(1, d.getCountByRank(Rank.FAMILY));
    assertEquals(0, d.getCountNamesByLanguage(Language.DANISH));
    assertEquals(2, d.getCountNamesByLanguage(Language.GERMAN));
    assertEquals(1, d.getCountByIssue(NameUsageIssue.RANK_INVALID));
    assertEquals(0, d.getCountByIssue(NameUsageIssue.BACKBONE_MATCH_NONE));
    assertEquals(0, d.getCountByIssue(NameUsageIssue.CLASSIFICATION_NOT_APPLIED));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:29,代码来源:DatasetMetricsServiceMyBatisIT.java

示例13: testGet

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testGet() {
    DatasetMetrics d = service.get(ClbDbTestRule.SQUIRRELS_DATASET_KEY);
    assertEquals(ClbDbTestRule.SQUIRRELS_DATASET_KEY, d.getDatasetKey());
    assertEquals(1000, d.getUsagesCount());
    assertEquals(25, d.getColCoveragePct());
    assertEquals(250, d.getColMatchingCount());
    assertEquals(100, d.getCountByKingdom(Kingdom.ANIMALIA));
    assertEquals(700, d.getCountByKingdom(Kingdom.PLANTAE));
    assertEquals(0, d.getCountByKingdom(Kingdom.FUNGI));
    assertEquals(120, d.getCountByRank(Rank.GENUS));
    assertEquals(10, d.getCountByRank(Rank.PHYLUM));
    assertEquals(4, d.getCountNamesByLanguage(Language.DANISH));
    assertEquals(132, d.getCountNamesByLanguage(Language.GERMAN));
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:16,代码来源:DatasetMetricsServiceMyBatisIT.java

示例14: testGet

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
@Test
public void testGet() {
    Description description = service.get(26);
    assertEquals((Integer) 100000040, description.getSourceTaxonKey());
    assertEquals(
            "The Caucasian squirrel (or Persian squirrel) is a tree squirrel in the genus Sciurus endemic to Armenia, Azerbaijan, Georgia, Greece, Iran, Iraq, Israel, Jordan, Lebanon, Syria, and Turkey. Its natural habitat is temperate broadleaf and mixed forests.[1]",
            description.getDescription());
    assertEquals(Language.ENGLISH, description.getLanguage());
    assertEquals("general", description.getType());
    assertNull(description.getSource());
    assertNull(description.getContributor());
    assertNull(description.getCreator());
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:14,代码来源:DescriptionServiceMyBatisIT.java

示例15: listTopicEntries

import org.gbif.api.vocabulary.Language; //导入依赖的package包/类
/**
 * @return map of all topics for a given language with a list of entry keys for each language
 */
@JsonIgnore
public Map<String, List<Integer>> listTopicEntries(Language lang) {
  if (toc.containsKey(lang)) {
    return toc.get(lang);
  }
  return Maps.newHashMap();
}
 
开发者ID:gbif,项目名称:gbif-api,代码行数:11,代码来源:TableOfContents.java


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