Skip to content

Commit

Permalink
adapted code to new GbifTerm.projectId (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-lg authored Jun 9, 2023
1 parent 12f30f7 commit d8eaddc
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public static boolean isHiveArray(Term term) {
|| DwcTerm.recordedBy == term
|| DwcTerm.identifiedBy == term
|| DwcTerm.preparations == term
|| DwcTerm.samplingProtocol == term;
|| DwcTerm.samplingProtocol == term
|| GbifTerm.projectId == term;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ private static Set<Term> termsPopulatedByInterpretation() {
DwcTerm.recordedBy,
DwcTerm.identifiedBy,
DwcTerm.preparations,
DwcTerm.samplingProtocol);
DwcTerm.samplingProtocol,
GbifTerm.projectId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public static Map<String, String> buildInterpretedOccurrenceMap(Occurrence occur
interpretedOccurrence.put(DwcTerm.identifiedBy.simpleName(), getSimpleValueAndNormalizeDelimiters(occurrence.getIdentifiedBy()));
interpretedOccurrence.put(DwcTerm.preparations.simpleName(), getSimpleValueAndNormalizeDelimiters(occurrence.getPreparations()));
interpretedOccurrence.put(DwcTerm.samplingProtocol.simpleName(), getSimpleValueAndNormalizeDelimiters(occurrence.getSamplingProtocol()));
interpretedOccurrence.put(GbifTerm.projectId.simpleName(), getSimpleValueAndNormalizeDelimiters(occurrence.getProjectId()));

Optional.ofNullable(occurrence.getVerbatimField(DcTerm.identifier))
.ifPresent(x -> interpretedOccurrence.put(DcTerm.identifier.simpleName(), x));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public enum EventEsField implements EsField {
NETWORK_KEY(new BaseEsField("metadata.networkKeys", GbifInternalTerm.networkKey)),
PROTOCOL(new BaseEsField("metadata.protocol", GbifTerm.protocol)),
LICENSE(new BaseEsField("metadata.license", DcTerm.license)),
PROJECT_ID(new BaseEsField("metadata.projectId", GbifInternalTerm.projectId)),
PROJECT_ID(new BaseEsField("metadata.projectId", GbifTerm.projectId)),
PROGRAMME(new BaseEsField("metadata.programmeAcronym", GbifInternalTerm.programmeAcronym)),

//Core identification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public enum OccurrenceEventEsField implements EsField {
NETWORK_KEY(new BaseEsField("metadata.networkKeys", GbifInternalTerm.networkKey)),
PROTOCOL(new BaseEsField("metadata.protocol", GbifTerm.protocol)),
LICENSE(new BaseEsField("metadata.license", DcTerm.license)),
PROJECT_ID(new BaseEsField("metadata.projectId", GbifInternalTerm.projectId)),
PROJECT_ID(new BaseEsField("metadata.projectId", GbifTerm.projectId)),
PROGRAMME(new BaseEsField("metadata.programmeAcronym", GbifInternalTerm.programmeAcronym)),

//Core identification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public enum OccurrenceEsField implements EsField {
NETWORK_KEY(new BaseEsField("networkKeys", GbifInternalTerm.networkKey)),
PROTOCOL(new BaseEsField("protocol", GbifTerm.protocol)),
LICENSE(new BaseEsField("license", DcTerm.license)),
PROJECT_ID(new BaseEsField("projectId", GbifInternalTerm.projectId)),
PROJECT_ID(new BaseEsField("projectId", GbifTerm.projectId)),
PROGRAMME(new BaseEsField("programmeAcronym", GbifInternalTerm.programmeAcronym)),

//Core identification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ private void setOccurrenceFields(SearchHit hit, Occurrence occ) {
occRelation.setId(v);
occ.setRelations(Collections.singletonList(occRelation));
});
getStringValue(hit, occurrenceBaseEsFieldMapper.getEsField(GbifInternalTerm.projectId)).ifPresent(occ::setProjectId);
getListValueAsString(hit, occurrenceBaseEsFieldMapper.getEsField(GbifTerm.projectId)).ifPresent(occ::setProjectId);
getStringValue(hit, occurrenceBaseEsFieldMapper.getEsField(GbifInternalTerm.programmeAcronym)).ifPresent(occ::setProgrammeAcronym);

getStringValue(hit, occurrenceBaseEsFieldMapper.getEsField(DwcTerm.sampleSizeUnit)).ifPresent(occ::setSampleSizeUnit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public final class HiveDataTypes {
DwcTerm.preparations,
DwcTerm.samplingProtocol,
GbifInternalTerm.parentEventGbifId,
GbifInternalTerm.projectId
GbifTerm.projectId
);

// dates are all stored as BigInt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private static List<InitializableField> internalFields() {
.put(GbifInternalTerm.installationKey, columnFor(GbifInternalTerm.installationKey))
.put(GbifInternalTerm.institutionKey, columnFor(GbifInternalTerm.institutionKey))
.put(GbifInternalTerm.collectionKey, columnFor(GbifInternalTerm.collectionKey))
.put(GbifInternalTerm.projectId, columnFor(GbifInternalTerm.projectId))
.put(GbifTerm.projectId, columnFor(GbifTerm.projectId))
.put(GbifInternalTerm.programmeAcronym, columnFor(GbifInternalTerm.programmeAcronym))
.put(GbifInternalTerm.hostingOrganizationKey, columnFor(GbifInternalTerm.hostingOrganizationKey))
.put(GbifInternalTerm.isInCluster, columnFor(GbifInternalTerm.isInCluster))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public static String occurrenceXMLAsString(Occurrence occurrence) throws Respons

appendIfNotNull(dwcXMLDocument, GbifTerm.datasetKey, occurrence.getDatasetKey());
//append(dwcXMLDocument, GbifTerm., occurrence.getPublishingOrgKey());
appendIfNotNull(dwcXMLDocument, GbifTerm.projectId, occurrence.getProjectId());

appendIfNotNull(dwcXMLDocument, GbifTerm.protocol, occurrence.getProtocol());
dwcXMLDocument.append(GbifTerm.lastCrawled, toISODateTime(occurrence.getLastCrawled()));
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<!-- GBIF VERSIONS -->
<hbase-utils.version>0.12</hbase-utils.version>
<download-query-tools.version>1.47</download-query-tools.version>
<dwc-api.version>1.43</dwc-api.version>
<dwc-api.version>1.45-SNAPSHOT</dwc-api.version>
<dwca-io.version>2.15</dwca-io.version>
<gbif-api.version>1.5.0</gbif-api.version>
<gbif-common.version>0.59</gbif-common.version>
Expand Down

0 comments on commit d8eaddc

Please sign in to comment.