Migrating custom annotators

You can use the IBM Watson® Explorer oneWEX REST API to migrate an IBM Watson Explorer Analytical Components custom annotator to Watson™ Explorer oneWEX.

Get the Watson Explorer Analytical Components custom annotator files and the category tree file

You will need the original processing engine archive (PEAR) file and the CAS2INDEX file, which is an XML file that maps annotations to search fields or facets. For more information, see Custom text analysis integration and XML markup in analysis and search.

The category tree file is stored in the Watson Explorer Analytical Components master server. The folder path is $ES_NODE_ROOT/master_config/<collection_id>.indexservice. The file name is category_tree.xml.

Migrate the custom annotator to Watson Explorer oneWEX

These instruction use the swagger interface to submit REST API calls to Watson Explorer oneWEX.

  1. Go to https://<wexONE_server>/docs/. Click Authorize and enter your signin credentials. Click Authorize and then click Done.
  2. Open FileResource > POST /api/v1/fileResources Create a file resource. Click Try it out.
  3. Update the body as shown below. Choose values for <annotator_description> and <annotator_name>.
    {
        "description": "<annotator_description>",
        "id": "string",
        "metadata": {
            "lastModified": 1531288825136
        },
        "name": "<annotator_name>",
        "tags": {
        },
        "type": "pear"
    }
  4. Click Execute and confirm the server response code. is 200.
  5. Copy the value of the id field in the Response body.
  6. Open FileResource > POST /api/v1/fileResources/{fileResourceId}/upload Update a file resource content. Click Try it out.
  7. Enter the id from step 5 and click Choose File to browse to the PEAR file.
  8. Click Execute and confirm the server response code is 200.

Migrate the Watson Explorer Analytical Components CAS2INDEX file

  1. Open Migration > POST /api/v1/migration/cas2index Migrate CAS to index mapping file. Click Try it out.
  2. Paste the contents of the CAS2INDEX file into the body field.
  3. Click Execute and confirm the server response code is 200.
  4. Copy the contents of Response body into a file and save it as a JSON file. For example, migrated_cas2index.json.

This is an example of the original CAS2INDEX file.

<?xml version="1.0" encoding="UTF-8"?>
<indexBuildSpecification xmlns="http://www.ibm.com/of/822/consumer/index/xml">
    <indexBuildItem>
        <name>com.ibm.custom.Product</name>
        <indexRule>
            <style name="Facet">
                <attribute name="fixedName" value="$.product"/>
            </style>
        </indexRule>
    </indexBuildItem>
</indexBuildSpecification>

This is an example of the migrated JSON file.

{
    "annotationIndexingSpec": [{
        "asFacet": [{
            "pathComponent": [
                {
                    "literal": ".product"
                },
                {
                    "featurePath": "/:coveredText()"
                }]
            }],
        "uimaType": "com.ibm.custom.Product"
    }]
}

Migrate the Watson Explorer Analytical Components category tree file

  1. Open Migration > POST /api/v1/migration/category Migrate category tree file. Click Try it out.
  2. Paste the contents of the category tree file into the body field.
  3. Click Execute and confirm the server response code is 200.
  4. Copy the contents of Response body into a file and save it as a JSON file. For example, migrated_tree.json.

Create enrichment

  1. Open Migration > POST /api/v1/enrichments Create an enrichment. Click Try it out.
  2. Update the body field as shown below.
    • <enrichment_name> and <enrichment_description> are the enrichment name and description that you choose.
    • <contents_of_migrated_category tree_file> is the entire content of the migrated category tree file.
    • <contents_of_migrated_cas2index_file> is the entire content of the migrated CAS2INDEX file.
    • The fileResources element contains the id value of the PEAR file.
    {
        "name": "<enrichment_name>",
        "description": "<enrichment_description>",
        "metadata": {
            "lastModified": 1532479085299
        },
        "tags": {
        },
        "type": "pear",
        "fileResources": [
            "<pear_file_id>"
        ],
        "category": {
        <contents_of_migrated_category tree_file>
        },
        "annotationIndexingSpecs": {
        <contents_of_migrated_cas2index_file>
        },
        "facetDictionaries": [
           
        ],
        "labelerId": null,
        "modelId": null
    }
  3. Click Execute and confirm the server response code is 200.
  4. Go to the Resources page of the Watson Explorer oneWEX Admin Console and verify the annotator has been added.