本文整理匯總了Java中org.gbif.api.model.occurrence.Occurrence.setBasisOfRecord方法的典型用法代碼示例。如果您正苦於以下問題:Java Occurrence.setBasisOfRecord方法的具體用法?Java Occurrence.setBasisOfRecord怎麽用?Java Occurrence.setBasisOfRecord使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.gbif.api.model.occurrence.Occurrence
的用法示例。
在下文中一共展示了Occurrence.setBasisOfRecord方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildOccurrence
import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
private static Occurrence buildOccurrence(UUID datasetKey, UUID ook) {
Occurrence occ1 = new Occurrence();
occ1.setKey(1);
occ1.setDatasetKey(datasetKey);
occ1.setPublishingOrgKey(ook);
occ1.setBasisOfRecord(BasisOfRecord.FOSSIL_SPECIMEN);
occ1.setKingdomKey(1);
occ1.setPhylumKey(1);
occ1.setClassKey(1);
occ1.setOrderKey(1);
occ1.setFamilyKey(1);
occ1.setGenusKey(1);
occ1.setSpeciesKey(1);
occ1.setScientificName("Ursus horribilis");
occ1.addIssue(OccurrenceIssue.COUNTRY_COORDINATE_MISMATCH);
occ1.setDecimalLatitude(1.234);
occ1.setDecimalLongitude(4.567);
occ1.setCountry(Country.AFGHANISTAN);
occ1.setPublishingCountry(Country.CANADA);
occ1.setProtocol(EndpointType.BIOCASE);
return occ1;
}
示例2: occurrenceOf
import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
private Occurrence occurrenceOf(
Integer key, Integer kingdom, Integer phylum, Integer classs, Integer order, Integer family, Integer genus,
Integer species, Integer nub,
UUID dataset, BasisOfRecord bor, Country country, Integer year, Double latitude, Double longitude,
EndpointType protocol) {
Occurrence occ = new Occurrence();
occ.setKey(key);
occ.setKingdomKey(kingdom);
occ.setPhylumKey(phylum);
occ.setClassKey(classs);
occ.setOrderKey(order);
occ.setFamilyKey(family);
occ.setGenusKey(genus);
occ.setSpeciesKey(species);
occ.setTaxonKey(nub);
occ.setDatasetKey(dataset);
occ.setBasisOfRecord(bor);
occ.setCountry(country);
occ.setYear(year);
occ.setDecimalLatitude(latitude);
occ.setDecimalLongitude(longitude);
occ.setProtocol(protocol);
return occ;
}
示例3: get
import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
@Override
public Occurrence get(Integer key) {
if (key == null || key < 1 || key >= 1000000) {
return null;
}
Occurrence occ = new Occurrence();
occ.setKey(key);
occ.setDatasetKey(DATASETS.get(key % 10));
int ord = key % BasisOfRecord.values().length;
occ.setBasisOfRecord(BasisOfRecord.values()[ord]);
occ.setYear(1800 + (key % 200));
occ.setElevation(key % 2000d);
Map<Term, String> fields = occ.getVerbatimFields();
fields.put(DwcTerm.catalogNumber, "cat-" + key);
occ.setVerbatimFields(fields);
occ.setMonth(1 + (key % 12));
ord = key % Kingdom.values().length;
Kingdom k = Kingdom.values()[ord];
occ.setKingdomKey(k.nubUsageID());
occ.setKingdom(StringUtils.capitalize(k.name().toLowerCase()));
return occ;
}
示例4: interpretBor
import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
private static void interpretBor(VerbatimOccurrence verbatim, Occurrence occ) {
ParseResult<BasisOfRecord> parsed = BOR_PARSER.parse(verbatim.getVerbatimField(DwcTerm.basisOfRecord));
if (parsed.isSuccessful()) {
occ.setBasisOfRecord(parsed.getPayload());
} else {
LOG.debug("Unknown basisOfRecord [{}]", verbatim.getVerbatimField(DwcTerm.basisOfRecord));
occ.addIssue(OccurrenceIssue.BASIS_OF_RECORD_INVALID);
occ.setBasisOfRecord(BasisOfRecord.UNKNOWN);
}
}
示例5: testCubeMutation
import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
@Test
public void testCubeMutation() throws Exception {
final UUID datasetKey = UUID.randomUUID();
Occurrence occ = new Occurrence();
occ.setTypeStatus(TypeStatus.HOLOTYPE);
occ.setDatasetKey(datasetKey);
occ.setKey(1);
occ.setElevation(110d);
occ.setDepth(10d);
occ.setBasisOfRecord(BasisOfRecord.PRESERVED_SPECIMEN);
occ.setTaxonKey(1000);
occ.setKingdomKey(6);
occ.setPhylumKey(66);
occ.setClassKey(666);
occ.setOrderKey(6666);
occ.setFamilyKey(66666);
occ.setGenusKey(666666);
occ.setSubgenusKey(6666666);
occ.setSpeciesKey(66666666);
occ.setContinent(Continent.EUROPE);
occ.setCountry(Country.ALBANIA);
occ.setProtocol(EndpointType.DWC_ARCHIVE);
occ.setPublishingCountry(Country.ITALY);
occ.setYear(1992);
occ.setMonth(1);
occ.setDay(31);
occ.getIssues().add(OccurrenceIssue.TYPE_STATUS_INVALID);
occ.getIssues().add(OccurrenceIssue.ELEVATION_NON_NUMERIC);
Batch<LongOp> updates = OccurrenceAddressUtil.cubeMutation(occ, new LongOp(1));
// make sure we have a single dimension rollup for each dimension
Set<Dimension<?>> addressed = Sets.newHashSet();
int nubCounter = 0;
for (Address a : updates.getMap().keySet()) {
Dimension<?> singleDim = singleDimensionAddress(a);
if (singleDim != null) {
if (OccurrenceCube.TAXON_KEY.equals(singleDim)) {
nubCounter++;
} else if (addressed.contains(singleDim)) {
System.out.println("Warning, single dimension " + singleDim + " used multiple times");
System.out.println(a);
}
addressed.add(singleDim);
}
}
System.out.println(OccurrenceCube.API_MAPPING.values());
System.out.println(addressed);
assertEquals("Not all higher taxa are mutated", 9, nubCounter);
assertEquals("Not all cube dimensions are mutated", OccurrenceCube.API_MAPPING.size(), addressed.size());
}
示例6: buildTestOccurrence
import org.gbif.api.model.occurrence.Occurrence; //導入方法依賴的package包/類
private Occurrence buildTestOccurrence(){
Date now = new Date();
Occurrence occurrence = new Occurrence();
occurrence.setKey(1227769253);
occurrence.setDatasetKey(UUID.fromString("50c9509d-22c7-4a22-a47d-8c48425ef4a7"));
occurrence.setPublishingOrgKey(UUID.fromString("28eb1a3f-1c15-4a95-931a-4af90ecb574d"));
occurrence.setPublishingCountry(Country.UNITED_STATES);
occurrence.setProtocol(EndpointType.DWC_ARCHIVE);
occurrence.setLastCrawled(now);
occurrence.setLastParsed(now);
occurrence.setBasisOfRecord(BasisOfRecord.HUMAN_OBSERVATION);
occurrence.setTaxonKey(6505602);
occurrence.setKingdomKey(1);
occurrence.setPhylumKey(52);
occurrence.setClassKey(225);
occurrence.setOrderKey(982);
occurrence.setFamilyKey(2693);
occurrence.setGenusKey(2305748);
occurrence.setSpeciesKey(6505602);
occurrence.setScientificName("Columbella fuscata G.B. Sowerby I, 1832");
occurrence.setKingdom("Animalia");
occurrence.setPhylum("Mollusca");
occurrence.setOrder("Neogastropoda");
occurrence.setFamily("Columbellidae");
occurrence.setGenus("Columbella");
occurrence.setSpecies("Columbella fuscata");
occurrence.setGenericName("Columbella");
occurrence.setSpecificEpithet("fuscata");
occurrence.setTaxonRank(Rank.SPECIES);
occurrence.setDateIdentified(now);
occurrence.setDecimalLongitude(-110.32959d);
occurrence.setDecimalLatitude(24.32329d);
occurrence.setYear(2016);
occurrence.setMonth(1);
occurrence.setDay(2);
Map<Term,String> verbatimFields = new HashMap<>();
verbatimFields.put(DwcTerm.geodeticDatum,"WGS84");
verbatimFields.put(DwcTerm.class_,"Gastropoda");
verbatimFields.put(DwcTerm.countryCode,"MX");
verbatimFields.put(DwcTerm.country, "Mexico");
verbatimFields.put(DcTerm.rightsHolder, "Alison Young");
verbatimFields.put(DcTerm.identifier, "2544088");
verbatimFields.put(DwcTerm.verbatimEventDate, "2016-01-01 15:28:43");
verbatimFields.put(DwcTerm.datasetName, "iNaturalist research-grade observations");
verbatimFields.put(GbifTerm.gbifID, "1227769253");
verbatimFields.put(DwcTerm.verbatimLocality, "La Paz, Baja California Sur, México");
verbatimFields.put(DwcTerm.collectionCode, "Observations");
verbatimFields.put(DwcTerm.occurrenceID, "http://www.inaturalist.org/observations/2544088");
verbatimFields.put(DwcTerm.taxonID, "328630");
verbatimFields.put(DwcTerm.recordedBy, "Alison Young");
verbatimFields.put(DwcTerm.catalogNumber, "2544088");
verbatimFields.put(DwcTerm.institutionCode, "iNaturalist");
verbatimFields.put(DcTerm.rights, "Copyright Alison Young, licensed under a Creative Commons cc_by_nc_sa_name license: http://creativecommons.org/licenses/by-nc-sa/3.0/");
verbatimFields.put(DwcTerm.eventTime, "23:28:43Z");
verbatimFields.put(DwcTerm.identificationID, "4737209");
occurrence.setVerbatimFields(verbatimFields);
return occurrence;
}