當前位置: 首頁>>代碼示例>>Java>>正文


Java Occurrence.getDatasetKey方法代碼示例

本文整理匯總了Java中org.gbif.api.model.occurrence.Occurrence.getDatasetKey方法的典型用法代碼示例。如果您正苦於以下問題:Java Occurrence.getDatasetKey方法的具體用法?Java Occurrence.getDatasetKey怎麽用?Java Occurrence.getDatasetKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.gbif.api.model.occurrence.Occurrence的用法示例。


在下文中一共展示了Occurrence.getDatasetKey方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: map

import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
@Override
protected void map(ImmutableBytesWritable key, Result row, Context context) throws IOException, InterruptedException {
  try {
    Occurrence o = OccurrenceBuilder.buildOccurrence(row);
    Preconditions.checkNotNull(o, "Unable to generate an Occurrence from the HBase using the OccurrenceBuilder");
    if (o.getDatasetKey() != null && o.getCountry() != null) {
      Key k = new Key(o.getDatasetKey(), o.getCountry());
      context.setStatus(k.toString());
      context.write(k, ONE);
    } else {
      context.getCounter("GBIF", "Missing dataset key or country (skipped record)").increment(1);
    }
  } catch (Exception e) {
    throw new IOException(e);
  }
}
 
開發者ID:gbif,項目名稱:metrics,代碼行數:17,代碼來源:TableReaderMapper.java

示例2: OccurrenceWritable

import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
public OccurrenceWritable(Occurrence occ, Integer cnt) {
  taxonKey = occ.getTaxonKey();
  ClassificationUtils.copyLinneanClassificationKeys(occ, this);
  year = occ.getYear();
  count = cnt;
  pubOrgKey = occ.getPublishingOrgKey();
  datasetKey = occ.getDatasetKey();
  latitude = occ.getDecimalLatitude();
  longitude = occ.getDecimalLongitude();
  country = occ.getCountry();
  publishingCountry = occ.getPublishingCountry();
  basisOfRecord = occ.getBasisOfRecord();
  protocol = occ.getProtocol();
  issues = occ.getIssues();
}
 
開發者ID:gbif,項目名稱:metrics,代碼行數:16,代碼來源:OccurrenceWritable.java

示例3: map

import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
@Override
protected void map(ImmutableBytesWritable key, Result row, Context context) throws IOException, InterruptedException {
  try {
    Occurrence o = OccurrenceBuilder.buildOccurrence(row);
    Preconditions.checkNotNull(o, "Unable to generate an Occurrence from the HBase using the OccurrenceBuilder");

    if (o.getDatasetKey() != null) {
      Set<Integer> nubs = Sets.newHashSet();
      insertIfPresent(nubs, o.getKingdomKey());
      insertIfPresent(nubs, o.getPhylumKey());
      insertIfPresent(nubs, o.getClassKey());
      insertIfPresent(nubs, o.getOrderKey());
      insertIfPresent(nubs, o.getFamilyKey());
      insertIfPresent(nubs, o.getGenusKey());
      insertIfPresent(nubs, o.getSubgenusKey());
      insertIfPresent(nubs, o.getSpeciesKey());
      insertIfPresent(nubs, o.getTaxonKey());
      for (Integer i : nubs) {
        Key k = new Key(o.getDatasetKey(), i);
        context.setStatus(k.toString());
        context.write(k, ONE);
      }
    } else {
      context.getCounter("GBIF", "Missing dataset key (skipped record)").increment(1);
    }
  } catch (Exception e) {
    throw new IOException(e);
  }
}
 
開發者ID:gbif,項目名稱:metrics,代碼行數:30,代碼來源:TableReaderMapper.java

示例4: cubeMutations

import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
/**
 * For the given occurrence, determines the mutations (addresses and operations) that need
 * to be applied.
 * 
 * @param o The denormalized representation
 * @param op That is going to be applied to the cube
 * @return The batch of updates to apply
 */
public static Batch<DensityTile> cubeMutations(Occurrence o, Op op, int zoom, int pixelsPerCluster) {
  Double latitude = o.getDecimalLatitude();
  Double longitude = o.getDecimalLongitude();
  Batch<DensityTile> batch = new Batch<DensityTile>();

  if (!o.hasSpatialIssue() && MercatorProjectionUtil.isPlottable(latitude, longitude)) {
    Set<Integer> taxa =
      Sets.newHashSet(o.getKingdomKey(), o.getPhylumKey(), o.getClassKey(), o.getOrderKey(), o.getFamilyKey(),
        o.getGenusKey(), o.getSpeciesKey(), o.getTaxonKey());

    // locate the tile
    int tileX = MercatorProjectionUtil.toTileX(o.getDecimalLongitude(), zoom);
    int tileY = MercatorProjectionUtil.toTileY(o.getDecimalLatitude(), zoom);


    for (Integer id : taxa) {
      if (id != null) {
        addMutations(batch, TileContentType.TAXON, String.valueOf(id), tileX, tileY, zoom, pixelsPerCluster, op, o);
      }
    }
    if (o.getPublishingOrgKey() != null) {
      addMutations(batch, TileContentType.PUBLISHER, String.valueOf(o.getPublishingOrgKey()), tileX, tileY, zoom,
        pixelsPerCluster, op, o);
    }
    if (o.getDatasetKey() != null) {
      addMutations(batch, TileContentType.DATASET, String.valueOf(o.getDatasetKey()), tileX, tileY, zoom,
        pixelsPerCluster, op, o);
    }
    if (o.getCountry() != null) {
      addMutations(batch, TileContentType.COUNTRY, o.getCountry().getIso2LetterCode(), tileX, tileY, zoom,
        pixelsPerCluster, op, o);
    }
    if (o.getPublishingCountry() != null) {
      addMutations(batch, TileContentType.PUBLISHING_COUNTRY, o.getPublishingCountry().getIso2LetterCode(), tileX,
        tileY, zoom,
        pixelsPerCluster, op, o);
    }
  }
  return batch;
}
 
開發者ID:gbif,項目名稱:metrics,代碼行數:49,代碼來源:DensityCubeUtil.java


注:本文中的org.gbif.api.model.occurrence.Occurrence.getDatasetKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。