Entity Types And Relationship Types
An entity type defines the nodes in a graph, while a relationship type defines the semantic edges that connect them. Both types support properties and constraints, forming the structure of the ontology. This structure determines the model's semantic expressiveness and data structure. This document describes how to create and manage entity types and relationship types.
Permissions
Workspace administrators and modelers can create and manage entity types and relationship types.
Limits
You can create a maximum of 200 entity types and 500 relationship types in each workspace.
Each entity or relationship type can have a maximum of 100 properties.
Create an entity type
In the top navigation bar of the Dataphin homepage, choose Knowledge Graph > Model Design.
In the top navigation bar, select a workspace. The model for the selected workspace is displayed, and you can modify it.
In the model configuration library on the left, click the
icon next to Entity Type. In the Entity Type Configuration: New pane, configure the following parameters.Parameter
Description
Entity type name
The display name of the entity type. It must be unique within the workspace, be 2 to 50 characters long, and can contain any character.
Entity type code
The unique identifier for the entity type. It must be unique within the workspace, start with an uppercase letter, and be 2 to 64 characters long. It can contain uppercase letters, lowercase letters, and digits.
Entity type description (Optional)
A brief description of the entity type. It can contain any character.
Icon
Select an icon for the entity type. The system provides a selection of built-in icons.
Primary key mode
Business primary key: A business-defined key used to uniquely identify an entity. If you select this option, you must designate one property as the business primary key.
System-generated primary key: The system automatically generates a unique identifier (UUID) for each entity. If you select this option, a read-only system primary key named
_sys_idis automatically created.
Entity type properties
The properties for the current entity type. Click Add Property to add a row for a new property. Click the Delete icon to remove the corresponding property.
Property name: The display name of the property. It must be unique within the entity type, be 2 to 50 characters long, and can contain any character.
Property code: The unique code for the property. It must be unique within the entity type, start with a lowercase letter, be 1 to 64 characters long, and contain only lowercase letters, digits, and underscores (_).
Data type: The data type of the property. The following types are supported.
Basic data types: String, Integer, Float, Boolean, Date, Timestamp, List
Advanced data types: Decimal, BigInteger, RegexString, Enum, Duration, DateTimeRang, Email, URL
Spatial and complex types: GeoPoint, GeoPolygon, GeoLineString, JSON, BLOB, Embedded
Special types: Unknown, Array, Map<K,V>
Default value (Optional): The default value for the property. It can contain any character.
Property description (Optional): A brief description of the property.
Constraints: Constraints for the property. You can configure whether it is required, a primary key, has an index, is a display name, or is enabled for semantic search or full-text search. You must designate one property as the primary key.
Only properties of the String type can be enabled for semantic search. When enabled, a vector index is created for the property when the model is published. During data ingestion, an embedding vector is automatically generated to support semantic similarity searches. Enabling an index allows for exact queries, fuzzy matching, and property filtering. These two constraints are configured independently. If a property has both an index and semantic search enabled, a standard index and a vector index are created when the model is published.
Action
Delete: Properties designated as a system primary key or enabled for semantic search cannot be deleted. Deleting other properties is an irreversible action. Proceed with caution.
Click OK to create the entity type.
An entity type cannot be created if it does not have a primary key property.
Create a relationship type
In the model configuration library on the left, click the
icon next to Relationship Type. In the Add Relationship Type pane, configure the following parameters.Parameter
Description
Relationship type name
The display name of the relationship type. It must be unique within the workspace, be 2 to 50 characters long, and can contain any character.
Code
The unique identifier for the relationship type. It must be unique within the workspace, start with an uppercase letter, and be 2 to 64 characters long. It can contain uppercase letters, digits, and underscores (_).
Source entity
Select a source entity and a target entity for the relationship. The source entity and target entity can be the same. Multiple relationship types can exist between the same pair of entity types.
Target entity
Directed
Specifies whether the relationship has a direction. If enabled, the relationship is displayed on the canvas with an arrow pointing from the source entity to the target entity.
Cardinality constraint
Specify whether the relationship between the source and target entities is 1:1, 1:N, or N:M.
Relationship type description (Optional)
A brief description of the relationship type. It can contain any character.
Relationship properties (Optional)
The properties for the current relationship type. The configuration of Property Name/Code, Data Type/Default Value, Property Description, and Constraints is the same as for entity type properties, with the exception that the display name constraint is not supported. For more information, see Entity type properties. Click Add Property to add a row for a new property. Click the Delete icon to remove the corresponding property.
Click OK to create the relationship type.
A relationship type cannot be created if a source or target entity is not specified.
Change operations
When you edit an existing entity type, you cannot modify its code or property codes. When you edit an existing relationship type, you cannot modify its code, source and target entities, or property codes. Other information can be changed, but different actions may have varying impacts. When a model publication includes a breaking change, the system automatically backfills default values, discards property values, or converts data types.
Change type | Actions | Impact |
Non-breaking | Add an optional property | The new property is set to its default value on existing nodes. If no default is specified, the value is null. |
Modify a property's display name | This is a metadata-only change. | |
Add an index | The index is built asynchronously after publishing and does not affect existing data. | |
Remove semantic search | The vector index is removed, and semantic search capabilities are disabled. | |
Compatible | Widen a property's data type (for example, from Integer to Float) | Existing data is converted automatically. You must confirm the impact of any precision changes. |
Add a required property that has a default value | The system automatically backfills the default value for all nodes where it is missing. | |
Delete an optional property | The values for this property are lost on all relevant nodes, but this does not block publishing. | |
Remove an index | Query performance may be degraded. | |
Add semantic search | A vector index is built asynchronously after publishing. You must run an embedding backfill task for existing data. | |
Breaking | Narrow a property's data type (for example, from String to Integer) | May cause data incompatibility, requiring data conversion or deletion. |
Delete a required property | The values for this property are lost on all relevant nodes. | |
Add a required property that has no default value | You must provide a backfill value when publishing. After publishing, this property must be backfilled for all relevant nodes. | |
Modify a primary key property (includes switching the primary key mode of an existing entity type) | May cause node uniqueness conflicts. | |
Delete an entity or relationship type | When you delete an entity type, all associated relationship types are also deleted. |