Managing data sources

Data sources in IBM Watson® Explorer oneWEX Application Builder provide the data used by your project. A data source can be a collection created in Watson™ Explorer oneWEX, Watson Discovery, or an external REST Service.

To access the Manage Data Sources page, click Menu > Data Sources on any page or click Manage Data Sources on the Data Sources page of the Create Project wizard. The existing data sources are listed.

Creating a data source

Click Create data source to add a data source. You can create a oneWEX data source, Watson Discovery data source, or a REST Service data source.

oneWEX data source
Select a backend from the drop-down list. The Watson Explorer oneWEX Application Builder server that hosts your server is listed as Local oneWEX backend. After selecting a backend, select a collection from the Select collection drop-down list. Then provide a name for this data source.
Note:

Applies to version 12.0.2.2 and subsequent versions unless specifically overriddenThe following widgets support only oneWEX data source

  • Document Recommendation
  • Query Recommendation
  • Clustering

The following properties are supported only when used with oneWEX data source

  • Auto completion of Search Input widget
Applies to version 12.0.2.2 and subsequent versions unless specifically overriddenWatson Discovery data source
Select a backend from the drop-down list. If there's no backends in the dropdown, you need to first create a Watson Discovery backend from the Manage Backends page. After selecting a backend, select a collection from the Select collection drop-down list. Then provide a name for this data source.
Rest Service data source
Create a data source boilerplate for an external REST service. It consists of a data source definition JSON and optional adapter written in JavaScript. Then click Create button and open the created data source and complete updating the settings by manually editing the generated code.

Applies to version 12.0.3 and subsequent versions unless specifically overridden Editing a data source

Click the pencil icon in the data source list to edit a data source. You can edit the selected data source in the data source edit pane.

General
Specify name, ID, and description for the data source.
Connection
Select a backend and collection for the data source. Note that if you create a new data source, field mapping is generated by using the selected collection information. But if you change a collection here, you need to update field mapping to match the new collection.
Field mapping

Create or edit field mapping for the data source. In the field mapping table, each field shows a preview based on the first item in Preview Search Result.

If you click the pencil icon or the Create button, the Edit Field Mapping dialog opens. Specify a property name of the normalized search result in the Name box, and a dotted object path or a JavaScript expression in the Value box. If you press the Enter key in the Value box, or press the Preview button, a preview is shown based on the first item in Preview Search Result.

Associations
Create or edit associations for the data source. A data source can have one or more associations to other data sources. By defining associations, the data source can have additional fields that are linked to a field of another data source. You can specify a target data source and condition, which consists of a field name and value, for each association definition. Then, when you perform a search, new fields that have matched values from the target data source will be added to the search results.

If you click the pencil icon for an existing association or the Create button, the Edit Association dialog opens. Fill out the dialog box to define an association:

Table 1. Associations settings
Input Description
Name The name of a new field in search results. It must be composed of letters, numbers, and underscore.
Target data source The name of the other data source to retrieve associated values.
Result set Target data source fields to retrieve. Select one or more fields of the target data source in which you have interest. * indicates all the fields.
Field The name of a field of the target data source to find corresponding records.
Value The name of a field of this data source. Its value is used to find corresponding records.
Limit Maximum number of records to retrieve.

Think about the following example:

Table 2. Associations settings example
Input Description
Name discount
Target data source deals
Result set *
Field CustomerId
Value $(customer_id)
Limit 1

By using the analogy of a SQL statement, it could be expressed as something like this:

SELECT * from deals WHERE CustomerId = $(customer_id) LIMIT 1;

Then the returned value will be the value of the discount field in the search results.

The above explanation tries to make it easy to understand each input in the dialog box, but in reality, the search API is not SQL, and typically takes field:value as a search term. If, for example, $(customer_id) from this data source is 123, then CustomerID:123 is passed to the search API for the target data source.

Other settings
Table 3. Other settings
Setting Description
Enable adapter Enables the data source adapter. If unchecked, even if you have an adapter for the data source, it will not be loaded.
Enable endpoint Enables endpoint and allows access to the data source through REST API.
Page size Specifies the number of rows to load per page when search is performed.
Default query A keyword to send when search is performed with a blank keyword.
Preview search result
The right-hand side pane shows preview of search result from the current data source. It shows the first 3 records of the search result. Uncheck the Show normalized result checkbox to show unprocessed, raw results from the search backend.

Applies to version 12.0.3 and subsequent versions unless specifically overridden Checking status

If you check the Status checkbox at the top-right corner of the Manage Data Sources page, the Status column appears in the table. The column shows the status of each data source. The status indicates error if a test search request fails.

Applies to version 12.0.3 and subsequent versions unless specifically overridden Active column

The data source table shows the Active column where you can select active data sources. The active flag is used only for controlling visibility in the Compose > Data Sources view. Even if you uncheck the flag for a data source that is in use from existing projects, that will not remove or disable it from the projects.

Applies to version 12.0.3 and subsequent versions unless specifically overridden Exporting a data source

Follow the steps to export a data source.

  1. In the Manage Data Sources pane, click the three-dot icon for a data source to export. The icon appears at the right side of a table row when you hover over it.
  2. Select Export from the drop-down menu. The browser downloads a zip file.

The file may download into your Downloads folder, but it depends on your browser settings.

Applies to version 12.0.3 and subsequent versions unless specifically overridden Importing a data source

Follow the steps to import an exported data source file.

  1. Click Create data source to open the Create Data Source pane.
  2. Select the From file tab.
  3. Press the Import button.
  4. Choose a data source file to import. (Typically, the file name of an exported data source looks something like datasource_voc_20190511T1040+0900.zip)

Applies to version 12.0.3 and subsequent versions unless specifically overridden Duplicating a data source

Follow the steps to duplicate a data source.

  1. In the Manage Data Sources pane, click the three-dot icon for a data source to duplicate. The icon appears at the right side of a table row when you hover over it.
  2. Select Duplicate data source from the drop-down menu.
  3. Specify Name and ID for the duplicated data source.
  4. Click Duplicate.

The duplicated data source appears in the table of the Manage Data Sources pane.