Show / Hide Table of Contents

# Term base in TBX format

Below you can see the TBX format of term bases. The following settings are used for exporting term bases through WS API:

- File format: ZIP
- Images are exported
- Only QTerm term bases can be exported to TBX
- Spaces in pick list values will be replaced with underscores

## Structure

The output of the TBX export is a ZIP file which contains the followings:

- Images
- Scheme
- Term base content

### Images

Images are exported into a folder inside the ZIP file called media_[TB name]. The file paths of the images are used to specify them, you can see further details in the next sections.

### Scheme

See TBX specification for details.
In a QTerm database, you can define your custom metadata fields at each term base level. Custom fields could be of different types:

- Text (Unicod text)
- DateTime (encapsulates date and time, stored in yyyy-MM-ddTHH:mm:ssZ format)
- Number (integer)
- Media (refers to media files)
- True/false (Boolean)
- pick list (single)
- pick list (multiple)

Custom fields of a QTerm term base will be present in the exported structure, if you set the value of the ExportQTermSpecificMeta field to true (or, during manual export, select the Export QTerm-specific metadata option). Representation of a custom field is shown below. Custom fields might have a default value, which is also represented in the schema:

    <descripSpec name="Status" datcatId="">
    	<contents datatype="picklist">new in_progress approved rejected</contents>
    	<levels>term</levels>
    <!--
       <x_mq>
         <isrequired>true</isrequired>
         <defaultvalue>new</defaultvalue>
       </x_mq>
    -->
    </descripSpec>

### Term base content

See TBX specification for details. In the following example, you can see the representation of an entry from a term base with the following custom metadata fields:

| Built-in | Custom
--- | --- | ---
Entry level | Entry ID Creator User Creation Time Domain Subject Client Project Image | Part of speech
Language level | Definition | Definition source
Term level | Case sensitivity Forbidden Matching | Status

    <termEntry id="eid-2">
      <descripGrp>
        <descrip type="Creator">admin</descrip>
      </descripGrp>
      <descripGrp>
        <descrip type="xDate_CreateTime">2016-04-03T12:40:30Z</descrip>
      </descripGrp>
      <descripGrp>
        <descrip type="Domain">Culinary</descrip>
      </descripGrp>
      <descripGrp>
        <descrip type="Subject">Kitchen_utensils</descrip>
      </descripGrp>
      <descripGrp>
        <descrip type="Client">RemoteCooking</descrip>
      </descripGrp>
      <descripGrp>
        <descrip type="Project">CulinaryTB</descrip>
      </descripGrp>
      <xref type="xImage_Image" target="media_culinaryTB_demoK/e3ec9ce9-5436-451b-b26a-d0fdce423bce.jpg" />
      <descripGrp>
        <descrip type="PartOfSpeech">noun</descrip>
      </descripGrp>
      <langSet xml:lang="en-us">
        <descripGrp>
          <descrip type="Definition">All-purpose knife used for a variety of chopping, slicing and mincing chores. The blade is normally 8 to 12 inches long. Also known as French knife.</descrip>
        </descripGrp>
        <descripGrp>
          <descrip type="Def.source">The Professional Chef (CIA)</descrip>
        </descripGrp>
        <tig>
      	  <term id="tid-2-en-us-1">chef's knife</term>
      	  <descripGrp>
      	    <descrip type="CaseSense">Near</descrip>
      	  </descripGrp>
      	  <descripGrp>
      	    <descrip type="xBool_Forbidden">False</descrip>
      	  </descripGrp>
      	  <descripGrp>
      	    <descrip type="PartialTreshold">Any</descrip>
      	  </descripGrp>
      	  <descripGrp>
      	    <descrip type="Status">approved</descrip>
      	  </descripGrp>
        </tig>
        <tig>
      	  <term id="tid-2-en-us-2">French knife</term>
      	  <descripGrp>
      	    <descrip type="CaseSense">Near</descrip>
      	  </descripGrp>
      	  <descripGrp>
      	    <descrip type="xBool_Forbidden">False</descrip>
      	  </descripGrp>
      	  <descripGrp>
      	    <descrip type="PartialTreshold">Any</descrip>
      	  </descripGrp>
      	  <descripGrp>
      	    <descrip type="Status">approved</descrip>
      	  </descripGrp>
        </tig>
      </langSet>
      <langSet xml:lang="hu">
        <tig>
      	  <term id="tid-2-hu-4">szakácskés</term>
      	  <descripGrp>
      	    <descrip type="CaseSense">Near</descrip>
      	  </descripGrp>
      	  <descripGrp>
      	    <descrip type="xBool_Forbidden">False</descrip>
      	  </descripGrp>
      	  <descripGrp>
      	    <descrip type="PartialTreshold">Any</descrip>
      	  </descripGrp>
      	  <descripGrp>
      	    <descrip type="Status">approved</descrip>
      	  </descripGrp>
        </tig>
      </langSet>
    </termEntry>

## Field definitions

QTerm term bases have some built-in fields at each level, and you can also specify your custom fields. The following types can be specified for a field, and it appears as a prefix in the TBX representation.

Type | Prefix
--- | ---
Text | `<none>`
DateTime | xDate_
Number | xInteger_
True/false | xBool_
Media | xImage_
Pick list (single) | `<none>`
Pick list (multiple) | xMultiplePicklist_

Field names are unique at a single level. If there is a field with the same name, its representation will get a postfix according to the current level, `_mmq_Language` or `_mmq_Term`. For example, if there is a field with the same name at the Entry and Language levels, e.g. MyField, the value of `type` attribute will be `xInteger_MyField` at the entry level and `xInteger_MyField_mmq_Language` at the language level.

### Entry level fields

The following fields are present in the exported TBX, the order of nodes is not taken into account during import.
Entry level fields are represented in the following formats:

- The `Id` of the entry is present in the value of the id attribute of the `<termEntry>` element. In the following example, the ID is 2: `<termEntry id="eid-2">`. This ID is unique to the entry and it is assigned automatically upon entry creation or when reindexing the term base.
- Fields with media type are represented with the `<xref>` element, where the `type` attribute identifies the given field and the `target` contains the relative path of the exported file.

    <xref type="xImage_Image" target="media_culinaryTB_demoK/74def8e6-6875-4cb9-bc33-76391d53746b.jpg" />

- All other entry level fields are represented with the `<descrip>` element, where the `type` attribute identifies the given field, and the value of the element holds the content of the field. Please see the following example:

    <termEntry id="eid-3">
      <descripGrp>
        <descrip type="xDate_CreateTime">2016-04-03T12:52:54Z</descrip>
      </descripGrp>
    ...
    </termEntry>

Built-in fields

Property | Type | Representation | Description
--- | --- | --- | ---
ID | Number | <termEntry id="eid-[id]"> | The id of the TB entry.
Image | Media | <xref type="xImage_Image" target="[relative path]" /> | The relative path of TB entry's image.

##### Note

ID:
The ID of the entry is present in the value of the id attribute of the `<termEntry>` tag. In the following example the ID is 2: `<termEntry id="eid-2">`

The following built-in fields are represented as `<descrip type="[type prefix]_[type value]">`.

Property | Type | Value of type attribute | Description
--- | --- | --- | ---
Subject | Text | Subject | The subject of the TB entry.
Domain | Text | Domain | The domain of the TB entry.
Client | Text | Client | The client of the TB entry.
Project | Text | Project | The project of the TB entry.
Created | DateTime | xDate_CreateTime | The creation UTC date of the TB entry in format `yyyy-MM-ddTHH:mm:ssZ`.
Creator | Text | Creator | The creator of the TB entry.

Custom metadata fields of other types are presented as `<descrip type="[type prefix]_[type value]">`.

Property | Type | Value of type attribute | Description
--- | --- | --- | ---
Custom metadata field | Text | Number | True/False | Date | Picklist (single) | Picklist (multiple) | [type prefix]_[FieldName] | Value for the given custom metadata field.

##### Note

Custom metadata field:
For QTerm term bases you can specify multiple custom entry level fields. Please see the following example:

- Type: Number
- Name of the field: MyField

Value of the `type` attribute: `xInteger_MyField`
For more type prefixes, see the types above.

Custom media fields are presented the following way:

Property | Type | Value of type attribute | Description
--- | --- | --- | ---
Custom media metadata field | Media | <xref type="xImage_[FiledName]" target="[relative path]" /> | The relative path of the file.

##### Note

Custom media metadata field:
Please see the following example:

- Field type: Media
- Name of the field: MyImageField
- Name of the term base: My term base
- File name: will be generated during import

Representation: `<xref type="xImage_MyImageField" target="media_My term base\74def8e6-6875-4cb9-bc33-76391d53746b.png" />`

### Language level fields

A language is represented with the `<langSet>` element. The language code is present as the value of xml:lang attribute in two-letter ISO language code format.

    <langSet xml:lang="en-us">
      <descripGrp>
        <descrip type="Definition">All-purpose knife used for a variety of chopping, slicing and mincing chores. The blade is normally 8 to 12 inches long. Also known as French knife.</descrip>
      </descripGrp>
    ...
    </langset>

Fields of non-media types are represented as `<descrip type="[type prefix]_[type value]>`

Property | Value of type attribute | Type | Description
--- | --- | --- | ---
Definition | Definition | Text | The definition of the entry concept in the given language.
Custom metadata field | [type prefix]_[FieldName] | Text | Number | True/False | Date | Picklist (single) | Picklist (multiple) | Value for the given custom metadata field

##### Note

Custom metadata field:
For QTerm term bases you can specify multiple custom language level fields. Please see the following example:

- Type: Number
- Name of the field: MyField

Value of the `type` attribute: `xInteger_MyField`
If there is a field, also called MyField at Entry level, the value of `type` attribute will be `xInteger_MyField_mmq_Language`. For more type prefixes see the types above.

Representation of the fields of media type:

Property | Type | Representation | Description
--- | --- | --- | ---
Custom media metadata field | Media | <xref type="xImage_[FiledName]" target="[relative path]" /> | The relative path of the file.

##### Note

Custom media metadata field:
Please see the following example:

- Field type: Media
- Name of the field: MyImageField
- Name of the term base: My term base
- File name: will be generated during import

Representation: `<xref type="xImage_MyImageField" target="media_My term base\74def8e6-6875-4cb9-bc33-76391d53746b.png" />`

### Term level fields

A term is represented with the `<tig>` element. The term text can be found as the value of `<term>` element. The term has its ID (given automatically by the system at creation or term base reindexing), captured as the value of the id attribute. It has the following structure, referring to the entry and language the term belongs to:

- Entry ID: the ID of the entry which contains the current term, e.g. 2
- LanguageCode: en-us
- Term ID: the ID of the term, it's unique within a language, e.g. 1

In the following example, you can see an English (United States) term with a custom field, called Status.

    <tig>
      <term id="tid-2-en-us-1">chef's knife</term>
      <descripGrp>
        <descrip type="CaseSense">Near</descrip>
      </descripGrp>
      <descripGrp>
        <descrip type="xBool_Forbidden">False</descrip>
      </descripGrp>
      <descripGrp>
        <descrip type="PartialTreshold">Any</descrip>
      </descripGrp>
      <descripGrp>
        <descrip type="Status">approved</descrip>
      </descripGrp>
    </tig>

Fields of non-media types are represented as `<descrip type="[type prefix]_[type value]>` elements:

Property | Value of type attribute | Type | Description
--- | --- | --- | ---
Case sensitivity | CaseSense | Strict | Near | Insensitive | Defines the case sensitivity level of the term (Sensitive, Permissive, or Insensitive).
Forbidden | xBool_Forbidden | True | False | Defines whether the term is forbidden. True=forbidden | False(default value]=not forbidden
Matching | PartialTreshold | None | Half | Any | Custom | Defines the degree to which partial matches are allowed against this term (Exact, 50% prefix, Fuzzy or Custom)
Custom metadata field | [type prefix]_[FieldName] | Text | Number | True/False | Date | Picklist (single) | Picklist (multiple) | Value for the given custom metadata field

##### Note

Custom metadata field:
For QTerm term bases you can specify multiple custom term level fields. Please see the following example:

- Type: Number
- Name of the field: MyField

Value of the `type` attribute: xNumber_MyField
If there is a field, called MyField at the Entry or the Language level, the value of the `type` attribute at the term level will be `xNumber_MyField_mmq_Term`. For more type prefixes, see the field types above.

Representation of the fields of media type:

Property | Type | Representation | Description
--- | --- | --- | ---
Custom media metadata field | Media | <xref type="xImage_[FiledName]" target="[relative path]" /> | The relative path of the file.

##### Note

Custom media metadata field:
Please see the following example:

- Field type: Media
- Name of the field: MyImageField
- Name of the term base: My term base
- File name: will be generated during import

Representation: `<xref type="xImage_MyImageField" target="media_My term base\74def8e6-6875-4cb9-bc33-76391d53746b.png" />`

## Samples and references

1. You can find a term base exported into TBX format here.
2. "LISA OSCAR Standards", GALA website. http://www.gala-global.org/lisa-oscar-standards