Create a Relational Dataset

Function Description

Used to create a relational dataset within a data source to manage the associative relationships between two dataset objects. For example, Dataset A stores information about real estate units (parcels) within an administrative region (real estate unit number, land use, area), while Dataset B stores information about real estate rights holders (name, ID number, real estate unit number). By creating a one-to-many relationship between Dataset A and Dataset B based on the key field "real estate unit number," when browsing or querying a specific parcel in Dataset A, all the information of the corresponding rights holder for that parcel can be instantly associated and retrieved.

Before using this feature, you need to be aware of the following constraints:

  • Supported dataset types: 2D point/line/region datasets, 3D point/line/region datasets, CAD datasets, text datasets, and attribute datasets. The source dataset and the target dataset must both be in either a versioned or non-versioned state.
  • Quantity limit: A dataset can only be used to create one relationship class dataset. If a relational dataset has already been created between Dataset A and Dataset B, then neither Dataset A nor B can create a relational dataset with Dataset C.
  • Type restriction description:
    • Binary and date types are prohibited for primary key and foreign key fields.
    • When 'Attribute the Relationship' is not checked:
      • In one-to-one and one-to-many relationships, the source primary key and source foreign key types must be the same.
      • In many-to-many relationships, the source primary key and associated primary key types must be the same.
    • When 'Attribute the Relationship' is checked: The source primary key and associated primary key fields must be the same.
    • Once a relationship is created, the fields cannot be modified, otherwise, the relationship will become invalid.
  • Datasource type: Only PostGIS and UDBX datasources are supported. Other datasources and EMS datasources are not supported.

Function Entry

  • Workspace Manager -> Data Source Context Menu -> New Dataset -> Relation Dataset.
  • Start Tab -> New Dataset Group -> Relation Dataset.
  • Toolbox -> Data Management -> Relation Dataset -> Create a Relational Dataset.

Parameter Description

Parameter Name Parameter Interpretation Parameter Type
Data Source Sets the datasource where the two datasets to be related reside. Defaults to the selected datasource in the Workspace Manager and can be modified. Datasource

Source Dataset

Sets the dataset for which a relationship will be established with the association dataset.

For example, Dataset A in the aforementioned example.

String
Association Dataset Sets the dataset that will establish a relationship with the source dataset.

For example, Dataset B in the aforementioned example.

String
Type of Relationship Sets the association behavior between the two dataset objects, offering two types: weak association and strong association.
  • Weak association (default): Deleting a source object will set the key field value of the referenced object to null; it will not delete the referenced object. The current version does not yet support cascading delete.
  • Strong association: Deleting a source object will also delete the referenced object. The current version does not yet support cascading delete.
String
Relational Model Sets the logical model of the association between the two dataset objects, including one-to-one (1:1), one-to-many (1:N), and many-to-many (M:N).
  • One-to-one (default): A record in the source dataset can only correspond to one record in the association dataset, and vice versa.
  • One-to-many: A record in the source dataset can correspond to multiple records in the association dataset, but a record in the association dataset can only correspond to one record in the source dataset. In this relational model, the "one" must point to the source dataset, and the "many" must point to the "association dataset".
  • Many-to-many: A record in the source dataset can correspond to multiple records in the association dataset, and a record in the association dataset can also correspond to multiple records in the source dataset.
RelationshipCardinalityType
Message Direction Sets the direction of message propagation, which determines the notification scope for associative operations. Taking forward direction (from source to association) with a strong relationship type as an example: If object A in the source dataset is deleted, the system will send a delete notification to the association dataset and automatically delete the related objects within it. However, deleting an object in the association dataset will not send a notification to the source dataset nor trigger any operation on the source dataset.

The current version does not yet support related operations; only creating relationships is supported.

The following options are provided:

  • Forward (from source to association): Messages are only sent from the source dataset to the association dataset.
  • Reverse (from associated to source): Messages are only sent from the association dataset to the source dataset.
  • Bidirectional: Operations performed on either the source dataset or the association dataset will send a message to the other.
  • None (default): No messages are sent.
NotificationType
Forward Relationship Label Sets the description of the relationship when associating from the source dataset to the association dataset. Once set, it can be viewed through the object properties panel. String
Reverse Relationship Label Sets the description of the relationship when associating from the association dataset to the source dataset. Once set, it can be viewed through the object properties panel. String
Relationship Dataset Sets the name of the generated relationship dataset. The default is "source dataset name_association dataset name". Its naming rules are consistent with those of ordinary datasets. String
Attribute the Relationship Specifies whether the relationship dataset has attributes, i.e., whether it is necessary to specifically define the association between two dataset objects by editing the relationship dataset's attribute table.
  • Checked: The relationship dataset has attributes.
  • Unchecked (default): The relationship dataset does not have attributes.
Boolean
Source Primary Key In non-attributed one-to-one and one-to-many relationships, the source primary key is the field in the source dataset that relates to the association dataset. In attributed relationships or many-to-many relationships, the source primary key is the field in the source dataset that relates to the relationship dataset.

Defaults to the first field of the source dataset and can be selected from the dropdown menu.

For example, the "real estate unit number" field in Dataset A from the earlier example.

String
Source Foreign Key In non-attributed one-to-one and one-to-many relationships, the source foreign key is the field in the association dataset that relates to the source dataset. For example, the "real estate unit number" field in Dataset B from the earlier example.

In attributed relationships or many-to-many relationships, the source foreign key is the field in the relationship dataset that relates to the source dataset. This field needs to be entered manually and should comply with field naming rules during editing, such as not containing illegal characters, not starting with two consecutive letters "sm", etc.

String
Associated Primary Key In attributed relationships or many-to-many relationships, the associated primary key is the field in the association dataset that relates to the relationship dataset. String
Associated Foreign Key In attributed relationships or many-to-many relationships, the associated foreign key is the field in the relationship dataset that relates to the association dataset. This field needs to be entered manually and should comply with field naming rules during editing, such as not containing illegal characters, not starting with two consecutive letters "sm", etc. String

Output Result

A new relationship dataset is added under the data source node.