Structure thesaurus terms using XML

When creating a thesaurus, terms can be added manually using the asset tree or automatically by uploading an XML file. The XML file determines the layout of the thesaurus, including its terms and relations. Read the Thesaurus documentation for more information on importing an XML file.

The XML file used to set the thesaurus' layout must have a set structure to allow the thesaurus to correctly output the terms and their relations.

Below are basic XML code structures for the thesaurus with the code variables highlighted. On the left is the basic structure, while on the right is the code put into context.

<thesaurus>
  <term name="TERM1">
     <relation name="RELATION">
      <term name="TERM2" />
    </relation>
  </term>
</thesaurus>
<thesaurus>
  <term name="disappear">
    <relation name="synonym_of">
      <term name="vanish" />
    </relation>
  </term>
</thesaurus>

The above code displays two thesaurus terms linked by a relation. In this case, disappear and vanish are linked by synonym_of.

The code structure is duplicated within the <thesaurus> tags to display more than one set of terms and relations.

<thesaurus>
  <term name="TERM1">
    <relation name="RELATION">
      <term name="TERM2" />
    </relation>
  </term>
  <term name="TERM3">
    <relation name="RELATION">
      <term name="TERM4" />
    </relation>
  </term>
</thesaurus>
<thesaurus>
  <term name="disappear">
    <relation name="synonym_of">
      <term name="vanish" />
    </relation>
  </term>
  <term name="letter">
    <relation name="synonym_of">
      <term name="message" />
    </relation>
  </term>
</thesaurus>

Now the code displays four thesaurus terms linked in pairs by the same relation. In this case, letter and message are also linked by synonym_of as well as disappear and vanish.

To relate terms to child terms, duplicate the code structure within the child term’s tags, as shown below.

<thesaurus>
  <term name="TERM1">
    <relation name="RELATION">
      <term name="TERM2" >
        <relation name="RELATION2">
          <term name="TERM3" />
        </relation>
      </term>
    </relation>
  </term>
</thesaurus>
<thesaurus>
  <term name="disappear">
    <relation name="synonym_of">
      <term name="vanish" >
        <relation name="antonym_of">
          <term name="appear" />
        </relation>
      </term>
    </relation>
  </term>
 </thesaurus>

The new code contains three thesaurus terms and two relations. In this case, disappear is a synonym of vanish, and an antonym of appear.

To assign multiple children to a term using more than one relation, duplicate the child term tags within multiple sets of relation tags, as shown below.

<thesaurus>
  <term name="TERM1">
    <relation name="RELATION">
      <term name="TERM2" />
      <term name="TERM3" />
      <term name="TERM4" />
    </relation>
    <relation name="RELATION2">
      <term name="TERM5" />
      <term name="TERM6" />
      <term name="TERM7" />
    </relation>
  </term>
</thesaurus>
<thesaurus>
  <term name="disappear">
    <relation name="synonym_of">
      <term name="vanish" />
      <term name="fade_away" />
      <term name="dissolve" />
    </relation>
    <relation name="antonym_of">
      <term name="appear" />
      <term name="materialise" />
      <term name="emerge" />
    </relation>
   </term>
 </thesaurus>

In the above code, the term disappear has six child terms categorized into either synonym_of (vanish, fade away and dissolve) or antonym_of (appear, materialize and emerge) relations.

You can recreate these basic formats to configure a thesaurus of any kind. These relations can reciprocate either the same or different relations back to their parent using reflections. Read the Thesaurus documentation for more information on reflections.