Skip to content

Commit

Permalink
Record view / Group keyword by thesaurus #1654
Browse files Browse the repository at this point in the history
* Add a keywordGroup field in the index containing keywords grouped by thesaurus title. Keywords with no thesaurus info are grouped in a common group named keywords.
* Applied to ISO19139, dublin-core and ISO19115-3 and multilingual record support.
  • Loading branch information
fxprunayre committed Aug 18, 2016
1 parent f534bf3 commit 5bb6020
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,26 @@
<xsl:with-param name="store" select="'true'"/>
</xsl:apply-templates>

<xsl:variable name="listOfKeywords">{
<xsl:variable name="keywordWithNoThesaurus"
select="/simpledc/dc:subject[text() != '']"/>
<xsl:if test="count($keywordWithNoThesaurus) > 0">
'keywords': [
<xsl:for-each select="$keywordWithNoThesaurus">
<xsl:value-of select="concat('''', replace(., '''', '\\'''), '''')"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
]
</xsl:if>
}
</xsl:variable>

<Field name="keywordGroup"
string="{normalize-space($listOfKeywords)}"
store="true"
index="false"/>


<xsl:for-each select="/simpledc/dct:isPartOf">
<Field name="parentUuid" string="{string(.)}" store="true" index="true"/>
</xsl:for-each>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<!-- Dispatching to the profile mode -->
<xsl:template name="dispatch-dublin-core">
<xsl:param name="base" as="node()"/>

<xsl:apply-templates mode="mode-dublin-core" select="$base"/>
</xsl:template>

Expand Down
32 changes: 32 additions & 0 deletions schemas/iso19139/src/main/plugin/iso19139/index-fields/default.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,38 @@
</xsl:for-each>
</xsl:for-each>

<xsl:variable name="listOfKeywords">{
<xsl:variable name="keywordWithNoThesaurus"
select="//gmd:MD_Keywords[
not(gmd:thesaurusName) or gmd:thesaurusName/*/gmd:title/*/text() = '']/
gmd:keyword[*/text() != '']"/>
<xsl:if test="count($keywordWithNoThesaurus) > 0">
'keywords': [
<xsl:for-each select="$keywordWithNoThesaurus/(gco:CharacterString|gmx:Anchor)">
<xsl:value-of select="concat('''', replace(., '''', '\\'''), '''')"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
]
<xsl:if test="//gmd:MD_Keywords[gmd:thesaurusName]">,</xsl:if>
</xsl:if>
<xsl:for-each-group select="//gmd:MD_Keywords[gmd:thesaurusName/*/gmd:title/*/text() != '']"
group-by="gmd:thesaurusName/*/gmd:title/*/text()">
'<xsl:value-of select="replace(current-grouping-key(), '''', '\\''')"/>' :[
<xsl:for-each select="gmd:keyword/(gco:CharacterString|gmx:Anchor)">
<xsl:value-of select="concat('''', replace(., '''', '\\'''), '''')"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
]
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each-group>
}
</xsl:variable>

<Field name="keywordGroup"
string="{normalize-space($listOfKeywords)}"
store="true"
index="false"/>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:apply-templates mode="index-contact"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,43 @@
</xsl:for-each>
</xsl:for-each>


<xsl:if test="count(//gmd:keyword//gmd:LocalisedCharacterString[@locale = $langId and text() != '']) > 0">
<xsl:variable name="listOfKeywords">{
<xsl:variable name="keywordWithNoThesaurus"
select="//gmd:MD_Keywords[
not(gmd:thesaurusName) or gmd:thesaurusName/*/gmd:title/*/text() = '']/
gmd:keyword//gmd:LocalisedCharacterString[@locale=$langId][*/text() != '']"/>
<xsl:if test="count($keywordWithNoThesaurus) > 0">
'keywords': [
<xsl:for-each select="$keywordWithNoThesaurus/(gco:CharacterString|gmx:Anchor)">
<xsl:value-of select="concat('''', replace(., '''', '\\'''), '''')"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
]
<xsl:if test="//gmd:MD_Keywords[gmd:thesaurusName]">,</xsl:if>
</xsl:if>
<xsl:for-each-group select="//gmd:MD_Keywords[
gmd:thesaurusName/*/gmd:title/*/text() != '' and
count(gmd:keyword//gmd:LocalisedCharacterString[@locale = $langId and text() != '']) > 0]"
group-by="gmd:thesaurusName/*/gmd:title/*/text()">

'<xsl:value-of select="replace(current-grouping-key(), '''', '\\''')"/>' :[
<xsl:for-each select="gmd:keyword//gmd:LocalisedCharacterString[@locale = $langId and text() != '']">
<xsl:value-of select="concat('''', replace(., '''', '\\'''), '''')"/>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
]
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each-group>
}
</xsl:variable>

<Field name="keywordGroup"
string="{normalize-space($listOfKeywords)}"
store="true"
index="false"/>
</xsl:if>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:for-each
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@
'denominator', 'resolution', 'geoDesc', 'geoBox', 'inspirethemewithac',
'status', 'status_text', 'crs', 'identifier', 'responsibleParty',
'mdLanguage', 'datasetLang', 'type', 'link'];
var listOfJsonFields = ['keywordGroup'];
var record = this;
this.linksCache = [];
$.each(listOfArrayFields, function(idx) {
Expand All @@ -471,6 +472,14 @@
record[field] = [record[field]];
}
});
$.each(listOfJsonFields, function(idx) {
var field = listOfJsonFields[idx];
if (angular.isDefined(record[field])) {
try {
record[field] = angular.fromJson(record[field]);
} catch (e) {}
}
});

// Create a structure that reflects the transferOption/onlinesrc tree
var links = [];
Expand Down
1 change: 1 addition & 0 deletions web-ui/src/main/resources/catalog/locales/en-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"anyPlaceHolder": "Search ...",
"VALID": "Valid",
"INVALID": "Invalid",
"clickToFilterOn": "Click to filter on ",
"NEVER_CALCULATED": "Never validated",
"validStatus-1": "Valid",
"validStatus-0": "Invalid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

<i class="fa fa-times"></i>
</a>

<a class="btn btn-primary gn-md-edit-btn pull-right"
data-ng-show="user.canEditRecord(mdView.current.record)"
data-ng-href="catalog.edit#/metadata/{{mdView.current.record.getId()}}"
Expand All @@ -74,7 +74,7 @@
</a>

<div class="gnMdfeedback"></div>

<div data-ng-show="usingFormatter"
id="gn-metadata-display"
class="gn-metadata-display">
Expand Down Expand Up @@ -129,7 +129,7 @@ <h2 data-translate="">aboutThisResource</h2>
<div data-ng-repeat="cat in mdView.current.record.inspirethemewithac"
data-ng-click="search({'inspirethemewithac': cat})"
class="iti-box full {{cat.split('|')[0]}} {{cat.split('|')[0]}}-{{langs[lang]}}"
title="{{cat.split('|')[1]}}">
title="{{'clickToFilterOn' | translate}} {{cat.split('|')[1]}} ...">
<div class="icon"><span class="iti-{{cat.split('|')[0]}}"></span></div>
<p class="label"></p>
</div>
Expand All @@ -142,7 +142,7 @@ <h2 data-translate="">aboutThisResource</h2>
<div data-ng-repeat="cat in mdView.current.record.category"
data-ng-click="search({'_cat': cat})"
class="iti-box full gn-iti"
title="{{('cat-' + cat) | translate}}">
title="{{'clickToFilterOn' | translate}} {{('cat-' + cat) | translate}} ...">
<div class="icon">
<span class="fa gn-icon-{{cat}}"></span></div>
<p class="label">{{('cat-' + cat) | translate}}</p>
Expand All @@ -151,24 +151,22 @@ <h2 data-translate="">aboutThisResource</h2>
<div data-ng-repeat="cat in mdView.current.record.topicCat track by $index"
data-ng-click="search({'topicCat': cat})"
class="iti-box full gn-iti"
title="{{cat | translate}}">
title="{{'clickToFilterOn' | translate}} {{cat | translate}} ...">
<div class="icon">
<span class="fa gn-icon-{{cat}}"></span>
</div>
<p class="label">{{cat | translate}}</p>
</div>
</td>
</tr>
<tr data-ng-if="mdView.current.record.keyword">
<th data-translate="">keywords</th>
<tr data-ng-repeat="(thesaurus, keywords) in mdView.current.record.keywordGroup">
<th>{{thesaurus | translate}}</th>
<td>

<ul>
<li data-ng-repeat="k in mdView.current.record.keyword track by $index">
{{k}}
</li>
<li data-ng-repeat="k in keywords track by $index"
title="{{'clickToFilterOn' | translate}} {{k}} ..."
data-ng-click="search({'keyword': k})">{{k}}</li>
</ul>
<!--<span class="badge" data-ng-repeat="k in mdView.current.record.keyword track by $index">{{k}}</span>-->
</td>
</tr>
<tr data-ng-if="mdView.current.record.datasetLang">
Expand Down
1 change: 1 addition & 0 deletions web/src/main/webapp/WEB-INF/config-lucene.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<field name="publicationDate" tagName="publicationDate"/>
<field name="abstract" tagName="abstract" multilingualSortField="true"/>
<field name="keyword" tagName="keyword"/>
<field name="keywordGroup" tagName="keywordGroup"/>
<field name="parentUuid" tagName="parentId"/>
<field name="type" tagName="type"/>
<field name="identifier" tagName="identifier"/>
Expand Down
1 change: 1 addition & 0 deletions web/src/main/webapp/xslt/ui-metadata/form-builder.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
</div>
</xsl:when>
<xsl:otherwise>

<div
class="form-group gn-field gn-{substring-after(name(), ':')} {if ($isRequired) then 'gn-required' else ''} {if ($isFirst) then '' else 'gn-extra-field'}"
id="gn-el-{$editInfo/@ref}"
Expand Down

0 comments on commit 5bb6020

Please sign in to comment.