Add and Update Entities in the Object Model
Add and update entities
The entities in the Object Model are the C3 AI Types that make up your application's data model. Each entity defines a category of data your application stores and operates on — its fields, its relationships to other entities, and the methods that act on it. Adding an entity extends your data model with a new Type so that you can integrate, store, relate, and analyze a kind of data that the model does not yet describe.
You typically add an entity when you need to:
- Model a part of your business domain that has no Type yet, such as
Customer,Order, orAsset. - Create a target for integrated data. Before you can map and load a source (a database table, a streaming source, or an uploaded file) into the platform, a Type must exist to receive the records. The new entity becomes that destination in a Data Integration pipeline.
- Establish relationships. Once the entity exists in the Object Model, you can connect it to other entities through primary and foreign keys, which is what the ERD visualizes.
- Enable platform behaviors such as normalized time series or machine learning features by mixing in the appropriate template (described below).
When you add an entity, Data Fusion writes a new C3 AI Type into the root package of your application. The Type becomes part of the live data model immediately: it appears as a node in the Object Model (grid, list, and Diagram views), it is available as a mapping target in Data Integration, and you can define fields, relationships, and methods on it or preview its data from the Type Detail panel. Like edits to an existing entity, a new entity persists in the running application until someone upgrades it; to keep it at the package level, push your changes to GitHub.
Your application must be in development or trial mode to add or edit entities. Production and test applications are read-only in Data Fusion, which protects deployed data models from accidental schema changes. The code editor is also read-only when a Type is marked final or belongs to a dependency package that cannot be remixed.
To add an entity, select Add new entity to open the code editor, which shows the Select an entity template screen. Choose a template to start from a Type that already includes the behavior you need, or select Create entity from scratch when none of the templates fit. The available templates are:
| Template | Description | Mixes |
|---|---|---|
| Simple Relational | A simple relational type with string and double fields. | — |
| Simple Calc | An entity with simple calc fields. | — |
| Timeseries header | An entity with a time series header representing a collection of time series. | IntervalDataHeader |
| Simple Timeseries consisting of IntervalDataPoints | An entity with a time series made of interval data points. | IntervalDataPoint |
| Sample Time Series Complex Partitioning | An entity with a time series that uses complex partitioning. | FeatureEvaluatable |
| Entity with Feature Evaluatable | An entity used to derive features for machine learning. | FeatureEvaluatable |
| Timed Interval Relation | A relation between two entities with a start and end timestamp. | TimedIntervalValue |
See each mixed-in Type's documentation for what it provides and why you would use it. The exact set of templates can vary with the packages installed in your application.
Edit an existing entity
To edit an existing entity, right-click the entity in the Diagram view and select View or Modify Code. After editing the entity, select Save to update the entity in your application. Changes persist until someone upgrades the application. To save at the package level, push your changes to GitHub. For more information, see Version Control with GitHub.
You can update entities only within the root package of your application. If you modify entities from dependency packages, the edits save to a new remixed entity in your root package.
Delete an entity
To delete an entity, right-click it in the Diagram view and select Delete. Data Fusion removes the Type from your application's root package.
Delete is available only for editable Types in your root package. It is disabled for Types that belong to a dependency package and for Types marked final; in those cases the menu item shows the tooltip "Cannot delete types outside the root package or final types." As with other schema changes, your application must be in development or trial mode, and the deletion persists in the running application until someone upgrades it. To remove the entity at the package level, push your changes to GitHub.