Skip to content

Dublin Core Related Resources

josegar74 edited this page Apr 24, 2014 · 8 revisions
Date Apr 14 2014 Contacts Jose García, Juan Luis Rodríguez
Status Motion passed / Done Release 2.12
Resources Available Ticket # https://github.com/geonetwork/core-geonetwork/issues/457
Source code https://github.com/geonetwork/core-geonetwork/pull/459
Funding Ontario Ministry of Natural Resources (OMNR)

Overview

This proposal aims to extend the metadata editor for Dublin Core, allowing upload files similar as for iso19139 and storing the file reference(s) in dct:references element(s).

The developments are done for the classic metadata editor and will be migrated to the new metadata editor extending the Associated resources panel to allow upload files in a similar way as in the iso19139 metadata editor.

Online Resources option in Dublin Core metadata editor:

Online Resources option in Dublin Core metadata editor

Add url online resource for Dublin Core:

Add url online resource for Dublin Core:

Add file online resource for Dublin Core:

Add file online resource for Dublin Core

Example of online resources added to Dublin Core metadata:

Example of online resources added to Dublin Core metadata

The ExtJs search interface will be extended to display the download button for Dublin Core metadata records that have referenced files.

Technical Details:

Dublin Core profile

Extended the Dublin Core profile with 2 processes to add/remove the online resources:

  • Add online resource: dublin-core/process/onlinesrc-add.xsl
  <xsl:template match="/simpledc">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:copy-of
          select="dc:*|dct:*"/>

      <dct:references>
        <xsl:choose>
          <xsl:when test="not(starts-with($url, 'http'))">
            upload@<xsl:value-of select="$url"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$url"/>
          </xsl:otherwise>
        </xsl:choose>

      </dct:references>
    </xsl:copy>
  </xsl:template>

The upload@ prefix is processed by dublin-core/update-fixed-info.xsl to add the link to resources.get or file.disclaimer services, allowing also to the user add dct:references with any text (to not manage the value as an online resource).

<xsl:template match="dct:references">
    <xsl:copy>
      <xsl:variable name="value" select="."/>
      <xsl:choose>
        <!-- convention: use upload@ prefix in dct:references to identify an uploaded file from metadata editor
                         dct:refereces stores then the URL to download the uploaded file.
        -->
        <xsl:when test="starts-with($value, 'upload@')">
          <xsl:variable name="valueFixed" select="replace(.,'upload@', '')"/>
          <xsl:choose>
            <xsl:when test="/root/env/config/downloadservice/simple='true'">
              <xsl:value-of select="concat(/root/env/siteURL,'/resources.get?uuid=',/root/env/uuid,'&amp;fname=',$valueFixed,'&amp;access=private')"/>
            </xsl:when>
            <xsl:when test="/root/env/config/downloadservice/withdisclaimer='true'">
              <xsl:value-of select="concat(/root/env/siteURL,'/file.disclaimer?uuid=',/root/env/uuid,'&amp;fname=',$valueFixed,'&amp;access=private')"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="."/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:when>

        <!-- if not an uploaded file, keep the value -->
        <xsl:otherwise>
          <xsl:value-of select="."/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:copy>
  </xsl:template>
  • Remove online resource: dublin-core/process/onlinesrc-remove.xsl
<xsl:stylesheet version="2.0"
                xmlns:dct="http://purl.org/dc/terms/"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:geonet="http://www.fao.org/geonetwork">

  <xsl:param name="url"/>

  <!-- Do a copy of every nodes and attributes -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <!-- Remove geonet:* elements. -->
  <xsl:template match="geonet:*|dct:references[text() = $url]"
                priority="2"/>
</xsl:stylesheet>
  • To display the online resources in the relations panel added dublin-core/extract-relations.xsl
  <xsl:template mode="relation" match="metadata[simpledc]" priority="99">
    <xsl:for-each select="*/descendant::*[name(.) = 'dct:references'][starts-with(., 'http') or contains(. , 'resources.get') or contains(., 'file.disclaimer')]">
      <relation type="onlinesrc">
        <id><xsl:value-of select="."/></id>
        <title>
          <xsl:value-of select="."/>
        </title>
        <url>
          <xsl:value-of select="."/>
        </url>
        <name>
          <xsl:value-of select="."/>
        </name>
        <abstract><xsl:value-of select="."/></abstract>
        <description><xsl:value-of select="."/></description>
        <xsl:choose>
          <xsl:when test="contains(. , 'resources.get') or contains(., 'file.disclaimer')">
            <protocol><xsl:value-of select="'WWW:DOWNLOAD-1.0-http--download'"/></protocol>
          </xsl:when>
          <xsl:otherwise>
            <protocol><xsl:value-of select="'WWW:LINK-1.0-http--link'"/></protocol>
          </xsl:otherwise>
        </xsl:choose>
      </relation>
    </xsl:for-each>
  </xsl:template>
  • Metadata editor template dublin-core/present/layout/layout.xsl: hide from the editor the dct:references pointing to uploaded files
  <!-- Hide from the editor the dct:references pointing to uploaded files -->
  <xsl:template mode="mode-dublin-core" priority="101" match="dct:references[starts-with(., 'http') or contains(. , 'resources.get') or contains(., 'file.disclaimer')]" />

Metadata editor customisations

  • Updated the setting metadata/editor/schemaConfig to add the onlinesrc category to dublin core:
"dublin-core":{
  "defaultTab":"default",
  "related":{"display":true,
             "readonly":false,
             "categories":["parent","onlinesrc"]
            }
  }
  • The Add online resource dialog has been customised to display the fields depending on the metadata profile.

web-ui/src/main/resources/catalog/components/metadatamanager/EditorService.js, add the schema identifier to gnCurrentEdit:

 angular.extend(gnCurrentEdit, {
               isService: getInputValue('isService') == 'true',
               isTemplate: getInputValue('template'),
               mdLanguage: getInputValue('language'),
               mdOtherLanguages: getInputValue('otherLanguages'),
               showValidationErrors: getInputValue('showvalidationerrors'),
               uuid: getInputValue('uuid'),
               schema: getInputValue('schema'),

web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js, add the schema identifier to the add online resource dialog scope:

 gnOnlinesrc.register('onlinesrc', function() {
                scope.metadataId = gnCurrentEdit.id;
                scope.schema = gnCurrentEdit.schema;

web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/addOnlinesrc.html, disable add online resource form fields that doesn't apply to dublin core:

      <!-- Name text Field -->
      <div class="form-group" data-ng-show="mode == 'url' && schema !== 'dublin-core'">

Proposal Type:

  • Type: Editor-UI
  • Module: web-ui, web

Voting History

  • Vote Proposed: 17 april 2014
  • +1 from Francois, Jeroen, Jose

Participants

  • Jose García
  • Juan Luis Rodríguez
Clone this wiki locally