Create a Relational Dataset

Function Description

Used to create a relational dataset within a data source, managing the association between two dataset objects. For example, Dataset A stores real estate unit (parcel) information (real estate unit number, land use, area) within a certain administrative region, while Dataset B stores information about real estate right 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," you can instantly associate and retrieve all information about the right holders corresponding to a specific parcel when browsing or querying Dataset A.

Before using this function, please note the following limitations:

  • Supported dataset types: 2D point/line/region datasets, 3D point/line/region datasets, CAD datasets, text datasets, and attribute datasets.
  • Quantity limit: A dataset can only create one relational dataset. If Dataset A has already created a relational dataset with Dataset B, neither Dataset A nor B can create another relational dataset with Dataset C.
  • Type restrictions: The primary key and foreign key types must be consistent, but binary and date types are not supported. Once a relationship is created, the fields cannot be modified; otherwise, the relationship will become invalid.
  • Data source types: Only PostGIS and UDBX data sources are supported. Other data sources and EMS data sources 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 data source where the two datasets to be related are located. By default, it is the selected data source in the Workspace Manager and can be modified.

Datasource

Source Dataset

Sets the dataset to establish a relationship with the relation dataset.

For example, Dataset A in the above example.

String
Relation

Sets the dataset to establish a relationship with the source dataset.

For example, Dataset B in the above example.

String
Type of Relationship

Sets the association behavior between two dataset objects, offering weak association and strong association.

  • Weak Association (default): Deleting a source object will set the key field value of the referenced object to null but will not delete the referenced object. The current version does not support cascade deletion.
  • Strong Association: Deleting a source object will synchronously delete the referenced object. The current version does not support cascade deletion.
String
Relational Model

Sets the logical model for the association between 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 relation dataset, and a record in the relation dataset can only correspond to one record in the source dataset.
  • One-to-Many: A record in the source dataset can correspond to multiple records in the relation dataset, but a record in the relation 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 relation dataset.
  • Many-to-Many: A record in the source dataset can correspond to multiple records in the relation dataset, and a record in the relation dataset can also correspond to multiple records in the source dataset.
RelationshipCardinalityType
Message Direction

Sets the message propagation direction to determine the notification scope of related operations. For example, with a forward direction (from source to relation) and a strong relationship type: If object A in the source dataset is deleted, the system will send a deletion notification to the relation dataset and automatically delete the related objects in it. However, deleting an object in the relation dataset will not send a notification to the source dataset or trigger any operations on it.

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

The following options are available:

  • Forward (from source to relation): Messages are only sent from the source dataset to the relation dataset.
  • Reverse (from relation to source): Messages are only sent from the relation dataset to the source dataset.
  • Bidirectional: Operations performed on either the source dataset or the relation dataset will send messages to the other.
  • None (default): No messages are sent.
NotificationType
Forward Relationship Label Sets the relationship description when associating from the source dataset to the relation dataset. Once set, it can be viewed in the object properties panel. String
Reverse Relationship Label Sets the relationship description when associating from the relation dataset to the source dataset. Once set, it can be viewed in the object properties panel. String
Relation Dataset

Sets the name of the generated relational dataset. The default is "SourceDatasetName_RelationDatasetName." Its naming rules are consistent with those of ordinary datasets.

String
Relationship Attribute

Specifies whether the relational dataset has attributes, i.e., whether it is necessary to edit the relational dataset properties table to specifically define the association between the two dataset objects.

  • Selected: The relational dataset has attributes.
  • Not Selected (default): The relational dataset does not have attributes.
Boolean
Source Primary Key

In non-attribute-based one-to-one and one-to-many relationships, the source primary key is the field in the source dataset associated with the relation dataset. In attribute-based or many-to-many relationships, the source primary key is the field in the source dataset associated with the relational dataset.

By default, it is 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.

String
Source Foreign Key

In non-attribute-based one-to-one and one-to-many relationships, the source foreign key is the field in the relation dataset associated with the source dataset. For example, the "real estate unit number" field in Dataset B.

In attribute-based or many-to-many relationships, the source foreign key is the field in the relational dataset associated with the source dataset. This field must be manually entered and should comply with the field naming rules, such as not containing illegal characters and not starting with two consecutive letters "sm."

String
Associate the Primary Key In attribute-based or many-to-many relationships, the associate primary key is the field in the relation dataset associated with the relational dataset. String
Associate Foreign Keys In attribute-based or many-to-many relationships, the associate foreign keys are the fields in the relational dataset associated with the relation dataset. This field must be manually entered and should comply with the field naming rules, such as not containing illegal characters and not starting with two consecutive letters "sm." String

Output Result

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