Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor / Add configuration for field to use a thesaurus. #3078

Merged
merged 18 commits into from
Oct 31, 2018

Conversation

fxprunayre
Copy link
Member

@fxprunayre fxprunayre commented Sep 10, 2018

Due to the increase of usage of registries (#2741) for managing list of values, catalogue administrators need to be able to configure which thesaurus to use to populate a field in the editor form.

When configured, then an autocomplete list is available in the editor:

image

Example of usage for use limitation which propose a list of values based on INSPIRE recommendation and Creative commons licenses https://www.youtube.com/watch?v=k5lONHoz-rU&feature=youtu.be

Editor can still enter an alternative text and not pick a value from the list.

Work description

  • Add editor configuration / Configuration for field in any views

Sample configurations:

Use LimitationsOnPublicAccess INSPIRE codelist to populate gmd:useLimitation. This is the easiest configuration where you use the data-gn-keyword-picker directive pointing to the thesaurus identified by the data-thesaurus-key. The thesaurus key is available in the admin console > thesaurus panel.

<for name="gmd:useLimitation"
         use="data-gn-keyword-picker">
  <directiveAttributes data-thesaurus-key="external.theme.httpinspireeceuropaeumetadatacodelistLimitationsOnPublicAccess-LimitationsOnPublicAccess"/>
</for>

Additional attributes are available to customize the suggestion:

  • data-number-of-suggestions define the number of suggestions to list
  • data-display-definition allows to display the definition
<for name="gmd:otherConstraints"
         use="data-gn-keyword-picker">
      <directiveAttributes 
              data-thesaurus-key="external.theme.httpinspireeceuropaeumetadatacodelistOnLineDescriptionCode-OnLineDescriptionCode"
              data-display-definition="true"/>
</for>

image

  • Add editor configuration / Configuration for field in a specific view. Use and directive attributes can be used in a field defined in a view:
   <tab id="default" default="true" mode="flat">
        <section>
          <field xpath="/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:language"
                 use="data-gn-keyword-picker">
            <directiveAttributes
              data-thesaurus-key="external.theme.httpinspireeceuropaeumetadatacodelistOnLineDescriptionCode-OnLineDescriptionCode"
              data-display-definition="true"
              data-thesaurus-concept-id-attribute="xlinkCOLONhref"/>
          </field>
        </section>
  • Add multilingual support. Populate all translations based on the record languages and the languages available in the thesaurus.

image

<gmx:Anchor xlink:href="http://example.com/fr">francais</gmx:Anchor>
<gmd:PT_FreeText>
   <gmd:textGroup>
      <gco:localisedCharacterString locale="#EN">english</gco:localisedCharacterString>
   </gmd:textGroup>
</gmd:PT_FreeText>
  • Add any attribute encoding based on concept id. Example for a LocalName element:
<gmd:featureTypes>
  <gco:LocalName codeSpace="http://purl.org/myocean/ontology/vocabulary/feature-type#Grid">Grid</gco:LocalName>
</gmd:featureTypes>

... the configuration would be:

          <field xpath="/gmd:MD_Metadata/gmd:contentInfo/*/gmd:featureTypes"
                   use="data-gn-keyword-picker">
              <directiveAttributes data-thesaurus-key="local.feature-type.myocean.feature-type"
                                              data-thesaurus-concept-id-attribute="codeSpace"/>
          </field>

This mode is recommended to be used instead of using helper which may trigger issues in multilingual context (#3076)

Schema plugin changes for ISO19139 extension:

  • add the following to config-editor.xml
    <for name="gts:TM_PeriodDuration" use="data-gn-field-duration-div"/>
    <for name="gml:duration" use="data-gn-field-duration-div"/>
  • Update type mapping for attribute (to avoid to use a field directive on an attribute)
    <for name="src" use="data-gn-logo-selector"/>

by

    <for name="gmx:FileName/@src" use="data-gn-logo-selector"/>
  • replace for topic category (if using it)
      <xsl:with-param name="directive" select="'gn-topiccategory-selector'"/>

by

      <xsl:with-param name="type" select="'data-gn-topiccategory-selector-div'"/>
  • Add field configuration per view in dispatcher template
--- a/schemas/iso19139/src/main/plugin/iso19139/layout/dispatcher.xsl
+++ b/schemas/iso19139/src/main/plugin/iso19139/layout/dispatcher.xsl
@@ -50,9 +50,11 @@
     <xsl:param name="base" as="node()"/>
     <xsl:param name="overrideLabel" as="xs:string" required="no" select="''"/>
     <xsl:param name="refToDelete" as="node()?" required="no"/>
+    <xsl:param name="config" as="node()?" required="no"/>
     <xsl:apply-templates mode="mode-iso19139" select="$base">
       <xsl:with-param name="overrideLabel" select="$overrideLabel"/>
       <xsl:with-param name="refToDelete" select="$refToDelete"/>
+      <xsl:with-param name="config" select="$config"/>
     </xsl:apply-templates>
   </xsl:template>

Future work to plan

  • Indexing / Check indexing of Anchors and render them properly
  • UI / Make link field layout more consistent (in attribute div or in the form or with "add/update link" button)
  • UI / Display links when set (once indexed for the Angular view, add support for multilingual Anchor in XSL formatter)
  • UI / Display images when link point to an image (related to XSL Formatter / handle logos in contact info #3149)

@fxprunayre fxprunayre added this to the 3.6.0 milestone Sep 10, 2018
@fxprunayre fxprunayre added the schema plugin change Indicate that this work introduces a schema plugin change. label Sep 10, 2018
@pvgenuchten
Copy link

Does this approach also allow users to not use the pull-down value and enter an alternative text (which is then stored as characterstring in stead of anchor?

as described here #2867

@fxprunayre
Copy link
Member Author

Does this approach also allow users to not use the pull-down value and enter an alternative text (which is then stored as characterstring in stead of anchor?

Yes the pull down is only suggestions from the thesaurus. Free text is still allowed.

@pvgenuchten
Copy link

How does this work on xml for multilingual, like this?

<gmx:Anchor xlink:href="http://example.com/fr">francais</gmx:Anchor>
<gmd:PT_FreeText>
   <gmd:textGroup>
      <gmx:Anchor xlink:href="http://example.com/en">english</gmx:Anchor>
   </gmd:textGroup>
</gmd:PT_FreeText>

but then is missing the locale

or alternatively:

<gmx:Anchor xlink:href="http://example.com/fr">francais</gmx:Anchor>
<gmd:PT_FreeText>
   <gmd:textGroup>
      <gco:localisedCharacterString locale="#EN">english</gco:localisedCharacterString>
   </gmd:textGroup>
</gmd:PT_FreeText>

@fxprunayre
Copy link
Member Author

How does this work on xml for multilingual, like this?

Testing with Oxygen, the schema validation works when you only substitute the CharacterString with the Anchor. The multilingual part is the same.

juanluisrp added a commit to juanluisrp/core-geonetwork that referenced this pull request Sep 25, 2018
juanluisrp added a commit to juanluisrp/core-geonetwork that referenced this pull request Sep 25, 2018
@pvgenuchten
Copy link

pvgenuchten commented Sep 26, 2018

Seems 6 modes of configuration are relevant for any text element

text anchor
free text text
optional codelist text+suggest -
required codelist keyword directive (no xlinkCOLONhref) keyword directive (xlinkCOLONhref)

The one missing in the current approach seems anchor+optional codelist, in which a user could select a value from a codelist or enter a value+link manually

And missing is a way to switch between anchor and string for no-codelist fields as described in #2867

@fxprunayre
Copy link
Member Author

Seems 6 modes of configuration are relevant for any text element

@pvgenuchten, what do you mean by suggest ? helpers set in labels.xml ?

I don't think we should bother editor with a choice between CharacterString or Anchor choice. The rule could be simple : if a link is defined, encode with an Anchor, if not, use a CharacterString. This is handled by https://github.com/geonetwork/core-geonetwork/pull/3078/files#diff-d7aa3900840fb8648241a671c2b92be1R414. This is working now in this branch for keyword picker based field. So we should add this to standard field and apply the rule when a link is set. Then maybe the layout of this link field should be improved.

We should avoid usage of helpers (and maybe drop support for it at some point) and prefer use of thesaurus codelist.

@pvgenuchten
Copy link

pvgenuchten commented Oct 2, 2018

I like the idea of not bothering the user with anchor/string choice.
I'm also in favour to remove the helper option in labels.xml

Some use cases around anchor/string/codelist, derived from dutch profile.

Text field that either or not has an anchor-link defined
This applies for example for the organisationName field. The specification suggests to insert the organisationName with an Anchor linking to an URI defining the organisation. Another example is the gmd:identifier field

<gmd:identifier>
<gmd:MD_Identifier>
<gmd:code>
<Anchor
  xlink:href="http://domein/id/record/ee543323-0fe4-4353">
  ee543323-0fe4-4353-9161-eda61ff26c07</Anchor>
</gmd:code>
</gmd:MD_Identifier>
</gmd:identifier>

Text field that could use a value from a codelist
Some options here:

  • field does not use an xlink (should be encoded as characterString)
  • field does have an xlink but not one from the suggested codelist
  • field uses a value from the suggested codelist

An example here is gmd:protocol in onlineresource

<gmd:protocol>
      <gmx:Anchor
        xlink:href="https://www.iana.org/assignments/media-types/application/json">
        json</gmx:Anchor>
</gmd:protocol>

Dropdown field that must use a value from a codelist

  • legal-constraints
  • conformsto-specification-title
<gmd:report>
<gmd:title>
<gmx:Anchor
 xlink:href="http://inspire.ec.europa.eu/id/document/tg/au">
   Data specificatie administratieve eenheden
</gmx:Anchor>
</gmd:title>
</gmd:report>

challenge here is that individual quality reports or restriction elements may require values from multiple codelists. What could be an option here is to create a field entry in config.xml for each thesaurus to be used

@fxprunayre fxprunayre changed the title [WIP] Editor / Add configuration for field to use a thesaurus. Editor / Add configuration for field to use a thesaurus. Oct 11, 2018
fxprunayre added a commit to camptocamp/iso19115-3 that referenced this pull request Oct 17, 2018
fxprunayre and others added 7 commits October 27, 2018 11:36
When using a gnKeywordPicker sends an _ID_xlinkCOLONhref field with the selected keyword's URI
to be processed by the backend to replace `gco:CharacterString` with a `gmx:Anchor` in case
the schema requires it.
Call to a new SchemaPlugin method to preprocess the elements. For example
to replace  a CharacterString for an Anchor.
@fxprunayre fxprunayre force-pushed the feature/thesaurus-for-any-fields branch from 9b02ce7 to 4695eb3 Compare October 27, 2018 09:37
@fxprunayre
Copy link
Member Author

A review/merge of this one would be good to not to have to solve conflict for weeks. It has been tested by Ifremer and is used for custom editor views using both ISO19139 and ISO19115-3 (changes ready camptocamp/iso19115-3@d81d758 to be integrated in metadata101).

@pvgenuchten pvgenuchten self-requested a review October 30, 2018 09:10
Copy link
Member

@josegar74 josegar74 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested (no multilingual) using Text and Anchors for Use limitations and looks working fine.

@fxprunayre fxprunayre merged commit 4586396 into master Oct 31, 2018
fxprunayre pushed a commit that referenced this pull request Oct 31, 2018
@fxprunayre fxprunayre deleted the feature/thesaurus-for-any-fields branch October 31, 2018 10:16
fxprunayre added a commit to metadata101/iso19115-3 that referenced this pull request Oct 31, 2018
@juanluisrp juanluisrp restored the feature/thesaurus-for-any-fields branch November 5, 2018 10:44
@juanluisrp juanluisrp deleted the feature/thesaurus-for-any-fields branch November 5, 2018 10:54
juanluisrp added a commit to juanluisrp/core-geonetwork that referenced this pull request Nov 5, 2018
juanluisrp added a commit to juanluisrp/core-geonetwork that referenced this pull request Nov 5, 2018
@pvgenuchten
Copy link

i know this is merged, but would like to add this listing of various potential modes of visualisation for the various modes this directive can be used in

image

@pvgenuchten
Copy link

the widget does not have a help-icon/tooltip yet

return el;
} else {
el.setNamespace(GMX).setName("Anchor");
el.setAttribute("href", "", XLINK);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fxprunayre , why not
el.setAttribute("href", attributeValue, XLINK);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement schema plugin change Indicate that this work introduces a schema plugin change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants