本文整理汇总了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);
}
}
示例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();
}
示例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);
}
}
示例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;
}