Skip to content

Commit

Permalink
Record view / ISO / Temporal range details support. (geonetwork#5918)
Browse files Browse the repository at this point in the history
  • Loading branch information
fxprunayre authored Aug 19, 2021
1 parent dbc0fc5 commit 564acc6
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ private void checkIndexResponse(BulkResponse bulkItemResponses,
.add("resourceVerticalRange")
.add("resourceTemporalDateRange")
.add("resourceTemporalExtentDateRange")
.add("resourceTemporalExtentDetails")
.build();
booleanFields = ImmutableSet.<String>builder()
.add("hasxlinks")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,19 +868,24 @@
<xsl:if test="$start &lt; $end and not($end/@indeterminatePosition = 'now')">
,"lte": "<xsl:value-of select="$zuluEndDate"/>"
</xsl:if>
}</resourceTemporalExtentDateRange>
}</resourceTemporalExtentDateRange>
</xsl:when>
<xsl:otherwise>
<indexingErrorMsg>Warning / Field resourceTemporalDateRange / Lower and upper bounds empty. Date range not indexed.</indexingErrorMsg>
</xsl:otherwise>
</xsl:choose>


<xsl:if test="$zuluStartDate != ''
and $zuluEndDate != ''
and $start &gt; $end">
<indexingErrorMsg>Warning / Field resourceTemporalDateRange / Lower range bound '<xsl:value-of select="$start"/>' can not be greater than upper bound '<xsl:value-of select="$end"/>'.</indexingErrorMsg>
</xsl:if>


<xsl:call-template name="build-range-details">
<xsl:with-param name="start" select="$start"/>
<xsl:with-param name="end" select="$end"/>
</xsl:call-template>
</xsl:for-each>

<xsl:for-each select=".//gex:verticalElement/*">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,11 @@
and $start &gt; $end">
<indexingErrorMsg>Warning / Field resourceTemporalDateRange / Lower range bound '<xsl:value-of select="$start"/>' can not be greater than upper bound '<xsl:value-of select="$end"/>'.</indexingErrorMsg>
</xsl:if>

<xsl:call-template name="build-range-details">
<xsl:with-param name="start" select="$start"/>
<xsl:with-param name="end" select="$end"/>
</xsl:call-template>
</xsl:for-each>

<xsl:for-each select=".//gmd:verticalElement/*">
Expand Down
2 changes: 1 addition & 1 deletion services/src/main/resources/config-spring-geonetwork.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<value>json/core+search+v4</value>
<value>json/schemas</value>
<value>standards/iso19139/codelists/gmd:MD_TopicCategoryCode+gmd:MD_ScopeCode+gmd:MD_MaintenanceFrequencyCode+gmd:MD_ProgressCode+gmd:DS_InitiativeTypeCode+gmd:MD_SpatialRepresentationTypeCode</value>
<value>standards/iso19115-3.2018/codelists/cit:CI_DateTypeCode</value>
<value>standards/iso19115-3.2018/codelists/cit:CI_DateTypeCode+indeterminatePosition</value>
<value>db/MetadataCategory+Operation+Group+StatusValue+Source</value>
</util:list>
</entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,25 +586,34 @@ <h2>
</ul>
</div>

<div data-ng-show="mdView.current.record.resourceTemporalExtentDateRange">
<div data-ng-show="mdView.current.record.resourceTemporalExtentDetails">
<h2>
<i class="fa fa-fw fa-clock-o"></i>
<span data-translate="">tempExtent</span>
</h2>


<div class="flex-row flex-align-center gn-period"
data-ng-repeat="range in mdView.current.record.resourceTemporalExtentDateRange">
data-ng-repeat="range in mdView.current.record.resourceTemporalExtentDetails">
<div class="flex-start"
data-ng-show="range.gte">
<dt data-gn-humanize-time="{{range.gte}}"/>
data-ng-show="range.start">
<dt>
<span data-ng-show="range.start.indeterminatePosition">{{range.start.indeterminatePosition | translate}}&nbsp;</span>
<span data-gn-humanize-time="{{range.start.date}}"/>
<span data-ng-show="range.start.calendarEraName">{{range.start.calendarEraName | translate}}</span>

</dt>
</div>
<div class="spacer">
<i class="fa fa-chevron-right"></i>
</div>
<div class="flex-end"
data-ng-show="range.lte">
<dt data-gn-humanize-time="{{range.lte}}"/>
data-ng-show="range.end">
<dt>
<span data-ng-show="range.end.indeterminatePosition">{{range.end.indeterminatePosition | translate}}&nbsp;</span>
<span data-gn-humanize-time="{{range.end.date}}"/>
<span data-ng-show="range.end.calendarEraName">{{range.end.calendarEraName | translate}}</span>
</dt>
</div>
</div>
</div>
Expand Down
36 changes: 35 additions & 1 deletion web/src/main/webapp/xslt/common/index-utils.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,40 @@
</xsl:template>


<xsl:template name="build-range-details">
<xsl:param name="start" as="node()?"/>
<xsl:param name="end" as="node()?"/>

<xsl:variable name="rangeStartDetails">
<xsl:if test="$start != ''">
<value><xsl:value-of select="concat('&quot;date&quot;: &quot;', $start, '&quot;')"/></value>
</xsl:if>
<xsl:for-each select="$start/@*[. != '']">
<value><xsl:value-of select="concat('&quot;', name(.), '&quot;: &quot;', gn-fn-index:json-escape(.), '&quot;')"/></value>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="rangeEndDetails">
<xsl:if test="$end != ''">
<value><xsl:value-of select="concat('&quot;date&quot;: &quot;', $end, '&quot;')"/></value>
</xsl:if>
<xsl:for-each select="$end/@*[. != '']">
<value><xsl:value-of select="concat('&quot;', name(.), '&quot;: &quot;', gn-fn-index:json-escape(.), '&quot;')"/></value>
</xsl:for-each>
</xsl:variable>

<xsl:if test="count($rangeStartDetails/value) > 0 or count($rangeEndDetails/value) > 0">
<resourceTemporalExtentDetails type="object">{
"start": {
<xsl:value-of select="string-join($rangeStartDetails/value, ',')"/>
},
"end": {
<xsl:value-of select="string-join($rangeEndDetails/value, ',')"/>
}
}</resourceTemporalExtentDetails>
</xsl:if>
</xsl:template>


<xsl:template name="build-thesaurus-fields">
<xsl:param name="thesaurus" as="xs:string"/>
<xsl:param name="thesaurusId" as="xs:string"/>
Expand Down Expand Up @@ -456,7 +490,7 @@
<indexingError>true</indexingError>
</xsl:if>
</xsl:for-each>


<xsl:variable name="thesaurusTree" as="node()">
<values>
Expand Down

0 comments on commit 564acc6

Please sign in to comment.