Copying Schemas

StreamBase Studio supports two methods for taking a schema from one location and reusing it in another location:

Copy Schema From Dialog

Use the Copy Schema From dialog to insert an existing schema into the Fields grid of an Edit Schema tab in the Properties view. Copy Schema From is also available for arcs when StreamBase cannot automatically determine the schema to use (such as when there are multiple arcs between two components). Unlike the Export Schema to Clipboard command, Copy Schema does not specify a schema format.

Export Schema to Clipboard Command

Use the Export Schema to Clipboard command to copy an existing schema to the system clipboard, in JSON (default) or XML format. This is used primarily for pasting decision table schemas into the TIBCO® Artifact Management Server (AMS) web client, for the purpose of creating new decision table artifacts.

Artifact Management Server is a separately installed product that includes schema usage in its documentation.

Copying Schemas into Field Grids

Copying schemas allows you to reuse an existing schema to avoid having to manually enter the fields. However, the copied fields are only copies, and are inserted as a private schema into the currently selected field grid. If the original schema changes, the copy does not change. For most purposes, TIBCO recommends using named schemas instead.

  1. To display the Copy Schema From dialog, with an input stream or arc selected, choose the Schema tab or Edit Schema tab and click the Copy Schema from Existing Component button. The following image shows a Copy Schema From dialog.

  2. Select a source from which you are copying the schema. For schema source details, see below:

    • From system container schemas

    • From File (CSV, XML, XSD, ZIP)

    • From schemas in any workspace module or interface

  3. Confirm the contents of the selected schema in the Schema Preview section.

  4. Click OK to close the dialog.

  5. If your current component's schema grid already contains schema fields, a dialog is displayed prompting you to confirm that you want to replace those fields. Click Yes to overwrite the current fields in the current schema grid.

The fields of the schema you selected are inserted in the Fields grid of the current component. If you invoked the Copy Schema From dialog from an Edit Named Schema dialog, the converted schema is copied to the named schema's definition grid.

Schema Source Details

You can copy schemas from the following places:

From system container schemas

Copy from the schema of a stream in the global system container. For example, you can copy the schema of the standard StreamBase error tuple by selecting error:schema from the first drop-down list after selecting the From system container schemas radio button.

From File (CSV, XML, XSD, ZIP ...)

Opens the specified file and attempts to convert its contents into StreamBase schema format. Supported file types are:

  • CSV — Comma-separated values files, with or without a header row.

  • XML — Structured data in XML files.

  • XSD — Standard XML Schema files that define a schema.

  • ZIP — Compressed files in zip format that contain one of the above file types.

After selecting a file from a workspace or file system, a preview of the file is shown, if possible.

For CSV files, specify delimiter and quote characters before copying the CSV format into a schema. When you click OK, Studio attempts to infer data types from the first few column values (you can later change the types it chooses). Auto-detection of int, double, boolean, string, timestamp and tuples are supported, but not lists or functions. When indicating tuples, the CSV header must identify sub-tuples with dot notation, such as stock.symbol and stock.price.

For XML files, Studio attempts to infer data types from attribute values for elements.

For XSD files, Studio uses the XSD data type definitions to generate the schema. XSD files are used by many TIBCO products to save schema structure information. Use this feature to migrate schemas in XSD format from other TIBCO products.

From schemas in any workspace application or interface

Copy from the schema of any component in any EventFlow application or interface in any project in the current Studio workspace. You can copy the schemas from named schemas defined in the current module, or from any intermediate stream in any module.

  1. Select the project of interest from the Project drop-down control.

  2. Select an application or interface based on the project selected in the previous step.

  3. Select a schema from one of the components listed in the Copy schema from section. Click the chevron to expand component sections to see the available schemas of each type.

Exporting Schemas to Clipboard

Exporting schemas to the system clipboard allows you to reuse an existing schema to avoid having to manually enter the fields.

  1. With an input stream, named schema, or arc selected (for example, from a decision table artifact), right-click and select Export Schema to Clipboard.

  2. Select JSON (default) or XML format. The Copy to clipboard dialog will indicate whether schema references are resolved and the text to be copied is self-contained. The text must be self-contained to be successfully copied and pasted.

  3. Click Copy to clipboard.