Skip to content

GXE Crash Course

Christine White edited this page Sep 5, 2013 · 2 revisions

This topic builds upon the information in the Geoportal XML Editor (GXE) topics Geoportal XML Editor, GXE Concepts, and GXE Structure. In this topic, you will become familiar with changing the GXE Editor by going through a step by step process to add a field that references a dropdown list to the INSPIRE (Data) geoportal online form.

For our example, we'll add a Frequency element we'll call gmd:CI_DateFreqCode (you can call it whatever you want in your deployment), and it will appear at this xpath in the resulting metadata:

/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:dateFreq/gmd:CI_DateFreqCode
Note, gmd:CI_DateFreqCode is a fictitious metadata element! - and thus it won’t be recognized by the ISO xsd validation. So first, you’ll want to turn off xsd validation for your schema – see the wiki topic at Customize Metadata Validation for how to do that.

Another important note is that the files reference one another in the order that they appear on the form, to provide file-by-file method to make up the metadata generated by the editor. You'll notice this as you work through the steps below.

Table of Contents

Overview Steps

Here are steps for what you'll do, using the INSPIRE (Data) profile as an example:

Investigate the Geoportal form you will be changing

Open the geoportal, and login as a publisher or administrator. Click on the Administration tab, and choose to Add a record. Then choose to add a record using the online metadata editor. Now, from the available options select the INSPIRE (Data) radio button. When the editor loads, click on the Identification tab, and then the Citation subtab. For our example, we'll add a field between date and date type.

Determine the impact of your change

The Citation section is a reusable element by default. Making a change to this section means that a Frequency section will show every time the Citation section is used throughout the editor. So first, make a decision on if that is OK, or if you want to make a copy of the Citation section to be used in only this part of the editor. In this step, let's assume that it's OK that the change is in all places where the Citation section appears.

Open the file that defines the form's structure

The GXE files are defined in two places: general GXE files that many of the profiles use, and then specific files used for the specific profile itself. For example, the INSPIRE profile uses some general files that all the ISO 19139 schemas would use (found in \\geoportal\WEB-INF\classes\gpt\gxe\iso); it also has some very specific items that are for INSPIRE alone (found in \\geoportal\WEB-INF\classes\gpt\gxe\iso\iso19139\profiles\inspire). The INSPIRE profile does use a lot of the ISO 19139 files in an unmodified state.

In your geoportal deployment, first identify what set of GXE config files the INSPIRE (Data) profile uses. This is defined in the definition file for the profile, e.g., \\geoportal\WEB-INF\classes\gpt\metadata\iso\inspire\inspire-iso-19115-definition.xml. In this file, look for the "Geopoprtal XML editor" comment; you'll note that it points to the file at /gpt/gxe/iso/iso19139/profiles/inspire/inspire-iso19139-dataset-editor.xml. When you open this file, you'll see that it is using the base iso19139-dataset-editor.xml file to define the base editor.

This iso19139-dataset-editor.xml file will lead you to the structure for the INSPIRE profile. Open this file.

Changes to the GXE Files - Steps

Finding the root element

Once the iso19139-dataset-editor.xml file is opened, you'll note a reference to the root metadata element, MD_Metadata, defined in MD_Metadata_Dataset.xml. Remember our xpath, /gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:dateFreq/gmd:CI_DateFreqCode? This is defining that first MD_Metadata element. Open the MD_Metadata_Dataset.xml file.

Navigate to the file that will be changed

Once the MD_Metadata_Dataset.xml file is opened, you will see sections that define tabs of ISO-based metadata profiles; note the section for the Identification tab:

 <!-- Identification tab -->
        <h:div g:label="$i18n.catalog.iso19139.MD_Metadata.section.identification">
          <g:element g:extends="$base/xtn/gmd/identification/XTN_Identification.xml"/>
        </h:div>
If you open the XTN_Identification.xml file from the xtn\gmd\identification location (this file defines the next element gmd:identificationInfo in our xpath), you'll see where the Citation section is defined:
<!-- Citation tab -->
          <h:div g:extends="$base/xtn/gmd/identification/XTN_Tab_IdentificationCitation.xml"/>
Open the XTN_Tab_IdentificationCitation.xml file (which defines the gmd:citation element in our xpath). When you open it, you'll see subsections that correspond to what you'd see in the user interface for the Identification\Citation tab. There are three sections: Resource Title, Resource Date, and URI.

The Resource Date section is defined by the \\gpt\gxe\iso\iso19139\schema\gmd\citation\CI_Date_PropertyType.xml file. Open this file. You'll see a reference to the CI_Date.xml file. When you open that file you'll see a reference to CI_Date_Type.xml. This is the file that we will update with a reference to the Frequency.

Update CI_Date_Type.xml

Make a backup copy of this CI_Date_Type.xml file, and then open the original. Using the section for the dateType as a guide, you can put a reference to a Frequency section here between the other two sections:

<g:element g:targetName="gmd:dateType" g:minOccurs="1" g:maxOccurs="1"
      g:extends="$base/schema/gmd/citation/CI_DateTypeCode_PropertyType.xml"/>
Update the g:targetName="gmd:dateType" to be the XML element you want to occur in the metadata, e.g., g:targetName="gmd:dateFreq".

Update the g:minOccurs="1" and g:maxOccurs="1" accordingly; minOccurs is the minimum occurrences for the element. This should be '0' for not mandatory and '1' for mandatory. MaxOccurs is the maximum occurrences; this can be '1', or ‘unbounded’ for multiple occurrences. In this example, leave it set to g:minOccurs="1" and g:maxOccurs="1".

Now, update the g:extends="$base/schema/gmd/citation/CI_DateTypeCode_PropertyType.xml". It will reference a new file you will create. So this section will point to your new file, which will be called CI_DateFreqCode_PropertyType.xml.

Finally, add a label to the section; you could make this localizable by using a reference to the gpt.properties file, but for this example we’ll just give it a label, just after the g:targetName element – add g:label="Frequency".

So now, this section looks like this:

<g:element g:targetName="gmd:dateFreq" g:label="Frequency" g:minOccurs="1" g:maxOccurs="1"
      g:extends="$base/schema/gmd/citation/CI_DateFreqCode_PropertyType.xml"/>
Save the CI_Date_Type.xml file.

Write the CI_DateFreqCode_PropertyType.xml file

Now, you’ll need to write the CI_DateFreqCode_PropertyType.xml file. This is a wrapper file for the next file you’ll write, which will define your codelist. Create the CI_DateFreqCode_PropertyType.xml file with the following – note that this file will call a CI_DateFreqCode.xml file, which you’ll write next:

<?xml version="1.0" encoding="UTF-8"?> 
<g:element xmlns:g="http://www.esri.com/geoportal/gxe" 
           xmlns:h="http://www.esri.com/geoportal/gxe/html"
           g:extends="$base/schema/gco/xtn/Wrapped_CodePropertyType.xml">       
  <g:body>
    <g:element g:minOccurs="0" g:extends="$base/schema/gmd/citation/CI_DateFreqCode.xml"/>
  </g:body>
</g:element>

Write the CI_DateFreqCode.xml file

Now you'll need to write the CI_DateFreqCode.xml file that defines the Frequency section; something like this (copied from CI_DateTypeCode.xml, with placeholder dropdown values):

<?xml version="1.0" encoding="UTF-8"?> 
<g:element xmlns:g="http://www.esri.com/geoportal/gxe" 
           xmlns:h="http://www.esri.com/geoportal/gxe/html"
           g:targetName=" gmd:CI_DateFreqCode " 
           g:i18nBase="catalog.iso19139.CI_DateFreqCode" g:label="$i18nBase"
           g:extends="$base/schema/gco/gcoBase/CodeListValue_Type.xml">
  <g:body>
   
    <g:attribute g:extends="$base/schema/gco/gcoBase/codeSpace.xml" 
      g:value="ISOTC211/19115"/>
       
    <g:attribute g:extends="$base/schema/gco/gcoBase/codeList.xml"/>
     
    <g:attribute g:extends="$base/schema/gco/gcoBase/codeListValue.xml">
      <g:body>
        <g:input g:extends="$base/core/ui/InputSelectOne.xml">
          <g:options>
            <g:option g:label="" g:value="" />
            <g:option g:label="$i18nBase.frequency1" g:value="first frequency value" />
            <g:option g:label="$i18nBase.frequency2" g:value="second frequency value"/>
            <g:option g:label="$i18nBase.frequency3" g:value="third frequency value "/>
          </g:options>
        </g:input>
      </g:body>          
    </g:attribute>     
     
  </g:body> 
</g:element>

Update gpt.properties with your new strings

Add new strings to \\geoportal\WEB-INF\classes\gpt\resources\gpt.properties file. The new strings you’ll need to add – as they were referenced in your CI_DateFreqCode.xml file – are the following:

catalog.iso19139.CI_DateFreqCode = Date Frequency
catalog.iso19139.CI_DateFreqCode.frequency1 = first frequency value
catalog.iso19139.CI_DateFreqCode.frequency2 = second frequency value
catalog.iso19139.CI_DateFreqCode.frequency3 = third frequency value
Save the gpt.properties file, and restart your geoportal web application in Tomcat.

Test

Test and see if the Frequency now appears in your INSPIRE (Data) metadata form.

Clone this wiki locally