Entity types and relationship types

Updated at:

An entity type defines the nodes in a knowledge graph, and a relationship type defines the semantic edges connecting them. Both support properties and constraints, forming the core structure of your graph's ontology. These types determine the model's semantic capabilities and data structure. This topic explains how to create and manage entity types and relationship types.

Permissions

Workspace administrators and modelers can create and manage entity types and relationship types.

Limitations

  • You can create a maximum of 200 entity types and 500 relationship types in each workspace.

  • You can create a maximum of 100 properties for each entity type or relationship type.

Create an entity type

  1. On the Dataphin homepage, choose Knowledge Graph > Model Design from the top menu bar.

  2. Select a workspace from the top menu bar. This displays the models for the selected workspace, which you can then modify.

  3. In the model configuration library on the left, click the image icon next to Entity type. In the Create entity type panel, configure the following parameters.

    Parameter

    Description

    Entity type name

    The display name for the entity type. It must be unique within the workspace and can contain 2 to 50 characters of any type.

    Entity type code

    The unique identifier for the entity type. It must be unique within the workspace. It can contain 2 to 64 characters, including uppercase and lowercase letters, and digits. It must start with an uppercase letter.

    Entity type description (Optional)

    A brief description of the entity type. All character types are supported.

    Icon

    Select an icon for the entity type. The system provides a selection of common icons.

    Primary key mode

    • Business primary key: A business-defined key that uniquely identifies an entity. If you select this option, you must designate one of the properties as the primary key.

    • System-generated primary key: The system generates a unique identifier (UUID) for each entity. If you select this option, a read-only system primary key named _sys_id is automatically created.

    Entity type properties

    The properties of the entity type. Click Add Property to add a new empty property row. Click the Delete icon to remove the corresponding property.

    • Property name: The display name for the property. It must be unique within the entity type and can contain 2 to 50 characters of any type.

    • Property code: The unique identifier for the property. It must be unique within the entity type. It can contain 1 to 64 characters, including lowercase letters, digits, and underscores (_). It must start with a lowercase letter.

    • Data type: The data type for the property. Supported types include:

      • 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. All character types are supported.

    • Property description (Optional): A brief description of the property.

    • Constraints (Required, Primary key, Index, Display name, Semantic search): Select one or more constraints for the property.

      The Semantic search option is available only for the String data type. When enabled, a vector index is created for this property upon publishing. When data is written, an embedding vector is automatically generated to enable semantic similarity searches. The Index option enables exact queries, wildcard matching, and property filtering. These two options are configured independently. If a property has both Index and Semantic Search enabled, the system creates both a standard index and a vector index when the model is published.

  4. Click OK to create the entity type.

    You must define a primary key property to create an entity type.

Create a relationship type

  1. In the model configuration library on the left, click the image icon next to Relationship type. In the Add relationship type panel, configure the following parameters.

    Parameter

    Description

    Relationship type name

    The display name for the relationship type. It must be unique within the workspace and can contain 2 to 50 characters of any type.

    Code

    The unique identifier for the relationship type. It must be unique within the workspace. It can contain 2 to 64 characters, including uppercase letters, digits, and underscores (_). It must start with an uppercase letter.

    Source entity

    Select the source and target entities for the relationship. The source and target entities can be the same. A single pair of entity types can have multiple relationship types.

    Target entity

    Directed

    If enabled, the canvas displays an arrow from the source to the target entity.

    Cardinality constraint

    Sets the cardinality constraint between the source and target entities to 1:1, 1:N, or N:M.

    Relationship type description (Optional)

    A brief description of the relationship type. All character types are supported.

    Relationship properties (Optional)

    The properties of the relationship type. The configuration for Property name/code, Data type/Default value, Property description, and Constraints (Display name is not supported) is the same as for entity type properties. For more information, see Entity type properties. Click Add Property to add a new empty property row. Click the Delete icon to remove the corresponding property.

  2. Click OK to create the relationship type.

    You cannot create a relationship type without specifying a valid source or target entity.

Schema changes

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 operations can have varying impacts. When a model publication includes a breaking change, data handling, such as default value backfilling, property value discarding, and data type conversions, requires careful management.

Change type

Actions

Impact

Non-breaking

Add an optional property

For existing nodes, the new property is set to its default value, or to null if no default is defined.

Change 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 become unavailable.

Compatible

Widen a property's data type (for example, Integer to Float)

Existing data is converted automatically. You should assess the impact of any changes in precision.

Add a required property with a default value

The system automatically backfills the default value for all nodes where the property is missing.

Delete an optional property

The property and its values are removed from all relevant nodes. This change does not block publishing.

Remove an index

Query performance may decrease.

Add semantic search

A vector index is built asynchronously after publishing. You must run an embedding backfill task to generate vectors for existing data.

Breaking

Narrow a property's data type (for example, String to Integer)

This can cause data incompatibility, potentially requiring you to convert or clear existing data.

Delete a required property

The property value is lost for all relevant nodes.

Add a required property without a default value

During publishing, you must provide a backfill value. The system then backfills this property for all relevant nodes.

Modify a primary key property (including switching the primary key mode of an existing entity type)

This can cause node uniqueness conflicts.

Delete an entity type or relationship type

When you delete an entity type, the system also deletes all associated relationship types.