Defining Structured Data Types

Defining Structured Data Types

Structured data are defined on the Structured Types element in the outline view of the model.

Structured Types in the Outline View
Figure: Structured Types in the Outline View

Two categories of structured data types can be defined

Additionally you can import Types, see section Importing Types.

The Structured Types tree contains a table tree structure with all defined structured types:

Subtree
Figure: Structured Types Subtree

Composite Types

Composite types are data types with fields of the following types

for example to describe a person or order data.

To create a new composite type:

Create a New Composite Type.
Figure: Create a New Composite Type.

The name of the new composite type can be specified in the General properties settings.

Using the Visibility Public option, you can specify whether you want to import type definition by reference when referenced in another model. By default, the Visibility Public checkbox is selected. For more information, please refer to Multi Package Modeling Preferences section of Setting Process Manager Preferences chapter.

General Properties
Figure: Composite Type - Visibility Public

The target namespace of the schema contained by a type declaration is selected by default. This namespace is used in creating and parsing XML documents based on this type declaration schema. A type declaration uses two fields, the location which specifies the id of the other model and the Xref which specifies the id of the type declaration in the other model.

To edit the new composite type, open its properties page with a double-click on its entry in the Structured Types tree.

New Composite Type
Figure: Structured Type tree

Data fields can be specified in the Structured Type Definition field.

To create a new data field, select the <new> table cell, type in a name for the data field to be created and press the TAB key. An entire row representing the new data field will be displayed and can be edited by selecting the corresponding table cells:

New Data Field Row
Figure: Structured Type Definition

Note that when using structured data that has cardinality zero or more in scoped data, the data path must be set accordingly. If the data path of structured data is not set according to cardinality a validation warning is displayed. For example, if the cardinality is defined as Zero or more then the data path should be set as structured data[0]. The following screenshot displays the warning message:

Structured Data with Cardinality - Validation Warning
Figure: Structured Data with Cardinality - Validation Warning

Choice

Embedded Unions

Setting a Choice Type.
Figure: Setting a Choice Type.

Types

In the Type column you can select xsd types as well as all other composite and enumeration types - except the current composite type to avoid recursion.

Choose a Type.
Figure: Choose a Type.

Anonymous substructures

Anonymous substructures can be defined within a structure in order to fully support XSD composite structures without defining the substructures as separate data structure definitions.

For example:

<xs:complexType name="PaymentTypeInformation1">
   <xs:sequence>
      <xs:element name="InstrPrty" type="Priority2Code"/>
         <xs:choice>
          <xs:element name="SvcLvl" type="ServiceLevel2Choice"/>
        <xs:element name="ClrChanl" type="ClearingChannel2Code"/>
      </xs:choice>
      <xs:element name="LclInstrm" type="LocalInstrument1Choice"/>
      <xs:element name="CtgyPurp" type="PaymentCategoryPurpose1Code"/>
   </xs:sequence>
</xs:complexType>

Selecting the <xsd:anonymous> type sets the type of the new field to <New Composition> and creates an indented line to enter subfields for this composition.

The <new> entry appears as the last node whenever the node is expanded.

Anonymous Type
Figure: Selecting the Anonymous Type.

Anonymous Type - Subtree
Figure: Subtree of Anonymous Type.

If the type of the field of the anonymous composition is changed to another type later, the subfields are deleted.

Attribute type

In case you intend to export a schema file containing XML attribute types, use the <attribute> type, e.g.:

Attribute Type
Figure: Selecting the Attribute Type.

An attribute type is displayed with an attribute icon on the left side of the name:

Attribute Type
Figure: Attribute Type displayed in Structured Type Definition.

If you import a schema file containing XML attribute types, these types will be mapped as <attribute> type. Note that attribute types can have the cardinality Optional, Prohibited or Required as shown in the above figure.

For example importing a schema file containing:

...
  <xsd:complexType name="Product">
    <xsd:sequence>
      <xsd:element name="Name" type="xsd:string"/>
      <xsd:element name="Synopsis" type="xsd:string"/>
      <xsd:element name="State" type="xsd:string"/>
    </xsd:sequence>
    <xsd:attribute name="Analysis" type="xsd:string" use="required"/>
  </xsd:complexType>
  <xsd:element name="Product" type="pro:Product"/>
...

will result in the following structured data definition:

Imported Attribute Type
Figure: Imported Type Example.

Cardinality

In the Cardinality column, you can specify, how many times the selected type should occur. The following cardinalities can be selected:

Choose Cardinality.
Figure: Choose Cardinality.

The One or More cardinality provides a list-like behavior.

For Attribute Type, following cardinalities can be selected:

Choose Cardinality for attribute type.

Order of keys

You can change the order of the keys by using the Move Up and Move Down buttons.

! Tip:

You can create your entire structure just by using the TAB key, typing in names and selecting types and cardinalities with the UP/DOWN keys.

Enumeration Type

The Stardust Structured data type supports two flavors of the xsd simple types that are enumerations and patterned.

Type Definition for Enumeration

The Enumeration type means that the data object will be of type string and it will accept values from the list of values defined in the enumeration. Enumeration types are lists of enumeration keys, e.g. to describe salutations, titles or countries.

To create a new enumeration type:

Create a New Enumeration Type.
Figure: Create a New Enumeration Type.

To edit the properties of the enumeration type, double-click its entry in the structured types tree.

New Enumeration Type

Select the <new> cell, type in an enumeration key and press the TAB key.

Enumeration Key

Optionally you can enter a Minimum Length and a Maximum Length for the enumeration field.

To change the order of enumeration keys use the Move Up and Move Down buttons.

Type Definition for Patterned

The Patterned type means that the data object is of type string and it accepts values conforming to the defined pattern. Patterned types are series of values. You can define exact sequence of characters that are acceptable. For example, you can define series of numbers [0 - 9] and letters [a - z], gender [male - feamale] where you can give choice.

To create a new patterened type:

Patterened Type
Figure: Patterened Type

Select the <new> cell, type in an enumeration key and press the TAB key.

Patterened Type Values
Figure: Patterened Type Values

Optionally you can enter a Minimum Length and a Maximum Length for the enumeration field.

To change the order of enumeration keys use the Move Up and Move Down buttons.

Using External XSD Types

Importing Types

XSD files describing one or more data structure definition can be imported. The corresponding data structure definitions will be created.

To import an xsd file select Structured Types > Import Types in the Outline view:

Import Types
Figure: Import Types

A dialog opens where you can choose if you want to select the schema from:

Choose where to select the Schema from.
Figure: Choose where to select the Schema from.

Selecting from Workbench Projects

In case you chose to select from workbench project, the next dialog offers to import appropriate files. Select Import Files... to open the file import dialog.

Import Files
Figure: Import Files

Now browse to the import resource in your local file system.

Browse to File.
Figure: Browse to File.

Now select Finish to accept the files you selected. Select the schema file from the projects and click Next.

Select an XML Schema File.
Figure: Select an XML Schema File.

Choose the types you want to import and select Finish to close the dialog.

Choose the Types to be imported.
Figure: Choose the Types to be imported.

Selecting from HTTP

To select the schema from HTTP:

  1. Choose HTTP and click Next.
  2. In the Select an XML schema file from HTTP dialog, type in the URL for your XML schema and select Load to load this URL, e.g.:

Enter a URL.
Figure: Enter a URL for your schema.

  1. After a successful load of the URL, select Next.
  2. You can optionally save the resource in your current project.

Using the loaded schema
Figure: Using the Loaded Schema

  1. In the next dialog select the types you like to import.
  2. You can optionally save the original schema in the model to make the imported structured data editable.

Select the Types
Figure: Select the Types to be imported.

  1. Finish the dialog.

Now the imported type is added to your model. You can see it in the structured types tree of the Outline view, e.g.:

Imported Structured Type
Figure: Imported Structured Type

Note
Please note that there will be no warning in case the imported types have the same name or Id like existing structured types. You need to rename them explicitly.

Using shared XSD Types

In case a model has a reference to an external structured type definition that is also referenced by other models, a change of this structured type definition can cause problems in some of these models. If you change an XSD which is referenced by multiple models, you must make sure that it is still valid for all other referencing models. We recommend to give the XSD file an unique name for every model version to prevent invalid XSDs.

The following example shows such a situation:

If you change the content of XSD_GLOBAL, it can happen that the XSD is valid for Model_B but no longer for Model_A. Using two XSDs with unique names like XSD_GLOBAL_A and XSD_GLOBAL_B would prevent this problem.

Exporting Types

Data structure definitions can be exported to XSD for single data structures or for all data structure definitions in a process model. To export a structured data type:

  1. In the Outline view right-click the data and select Export Schema.

Export Schema

  1. The Export XML schema dialog opens.
  2. In case the type depends on other structured types, you have to select in a list the types to be exported.

Export Schema

  1. Select folder where you like your schema to be located.

Export Schema

Now the exported types appear as xsd files in the selected folder, e.g.:

Exported Schema Files
Figure: Exported Schema Files

Using Referenced Structured Data Definition

Once the file connection is established, the referenced structured data definition can be referred in another model. Note that the structured types from the referenced model are read only. You cannot edit the referenced structured types. To refer the structure data in the referencing model:

In the referencing model, drag and drop the structure data from the Outline view > External Model Information > File Connection

Drag Referenced Structured Data
Figure: Drag Referenced Structured Data

Double-click on the dragged structured data in the diagram canvas. The structured data properties get displayed.

Click on the Structured Data Definition. The declared types are displayed. If you select the check box Display Imported Model Elements as Groups then the references for the declared types are also displayed.

Referenced Declared Type
Figure: Referenced Declared Type

Structure Data Storage

Process data of structured type are stored in the tables in the Stardust Audit Trail Database. The storage layout is optimized for efficient access in queries.

See details about structured data storage in the chapter Structured Data Storage of the Operation Guide.