Skip to content

Template

cognite.neat._session._template.TemplateAPI #

Create a template for a new data model.

enterprise_model(data_model_id, org_name='CopyOf', dummy_property='GUID') #

Creates a template for an enterprise model based on the current data model in the session. An enterprise data model is a model that is used for read and write of instances. In addition, it is governed by the organization. The basis for an enterprise data model should be a Cognite Data Model.

Parameters:

Name Type Description Default
data_model_id DataModelIdentifier

The enterprise data model id that is being created

required
org_name str

Organization name to use for the views in the enterprise data model.

'CopyOf'
dummy_property str

The dummy property to use as placeholder for the views in the new data model.

'GUID'

What does this function do? 1. It creates a new view for each view in the current data model that implements the view it is based on. 2. If dummy_property is set, it will create a container with one property for each view and connect the view to the container. 3. It will repeat all connection properties in the new views and update the ValueTypes to match the new views.

Enterprise Data Model Creation

Always create an enterprise data model from a Cognite Data Model as this will assure all the Cognite Data Fusion applications to run smoothly, such as - Search - Atlas AI - Infield - Canvas - Maintain - Charts

solution_model(data_model_id, direct_property='enterprise', view_prefix='Enterprise') #

Creates a template for a solution model based on the current data model in the session. A solution data model is for read and write of instances. The basis for a solution data model should be an enterprise data model.

Parameters:

Name Type Description Default
data_model_id DataModelIdentifier

The solution data model id that is being created.

required
direct_property str

The property to use for the direct connection between the views in the solution data model and the enterprise data model.

'enterprise'
view_prefix str

The prefix to use for the views in the enterprise data model.

'Enterprise'

What does this function do? 1. It will create two new views for each view in the current data model. The first view will be read-only and prefixed with the 'view_prefix'. The second view will be writable and have one property that connects to the read-only view named 'direct_property'. 2. It will repeat all connection properties in the new views and update the ValueTypes to match the new views. 3. Each writable view will have a container with the single property that connects to the read-only view.

Solution Data Model Mode

The read-only solution model will only be able to read from the existing containers from the enterprise data model, therefore the solution data model will not have containers in the solution data model space. Meaning the solution data model views will be read-only.

The write mode will have additional containers in the solution data model space, allowing in addition to read through the solution model views, also writing to the containers in the solution data model space.

data_product_model(data_model_id, include='same-space') #

Creates a template for a data product model based on the current data model in the session. A data product model is only used for reading of instances. It can be based on any data model, but typically it is based on an enterprise or solution data model.

A data product model is a data model that ONLY maps to containers and do not use implements. This is typically used for defining the data in a data product.

What does this function do? 1. It creates a new view for each view in the current data model. The new views uses the same filter as the view it is based on. 2. It will repeat all connection properties in the new views and update the ValueTypes to match the new views.

Parameters:

Name Type Description Default
data_model_id DataModelIdentifier

The data product data model id that is being created.

required
include Literal['same-space', 'all']

The views to include in the data product data model. Can be either "same-space" or "all". If you set same-space, only the properties of the views in the same space as the data model will be included.

'same-space'

conceptual_model(io) #

This method will create a template for a conceptual data modeling

Parameters:

Name Type Description Default
io Any

file path to the Excel sheet

required

expand(io, output=None, dummy_property='GUID') #

Creates a template for an extension of a Cognite model by expanding properties from CDM.

The input is a spreadsheet of a conceptual model in which the concepts are defined and marked with the Cognite concept they are extending. For example, if you have a pump in the Classes sheet you will see

Class: Pump
Implements: cdf_cdm:CogniteAsset(version=v1)
The output will be a spreadsheet in which all the properties from the Cognite concept model is added to the spreadsheet. In the example above, the pump concept will have all the properties it inherits from the CogniteAsset concept added to the Properties spreadsheet.

Parameters:

Name Type Description Default
io Any

The input spreadsheet.

required
output str | Path | None

The output spreadsheet. If None, the output will be the same as the input with _extension added to the name.

None
dummy_property str

The dummy property to use as placeholder for user-defined properties for each user-defined concept, and to alleviate need for usage of filters in physical data model. When converting a data model, it is recommended to have at least one property for each concept. This ensures that you follow that recommendation.

'GUID'