Skip to main content
Question

How to Import CogniteCore datamodel to further extend in a new datamodel space

  • April 17, 2026
  • 3 replies
  • 20 views

Forum|alt.badge.img+5

I am new to extending CogniteCore data model to further extend. How to Import CogniteCore datamodel to further extend in a new datamodel space. 

3 replies

Ali Tahir
Committed ⭐️⭐️⭐️
Forum|alt.badge.img+5
  • Committed ⭐️⭐️⭐️
  • April 17, 2026

If I understood your question, you don't import CogniteCore. It already exists in the `cdf_core` space, so you just reference it.

To extend it:

1. Create your own space
2. Create a view that implements the CogniteCore type (e.g `cdf_core.CogniteAsset`)
3. Add your custom properties

In Data Modeling UI:
- New view → Implements → select the CogniteCore type
- Add your properties

It's like inheritance, CogniteCore is the base, your model adds what's specific to your use case.


Forum|alt.badge.img+5
  • Author
  • Seasoned ⭐️
  • April 18, 2026

Thanks for the quick response. I coudn’t see the option new view in Data Modeling UI. I followed the approach provided in link Building an asset hierarchy - Cognite Docs

my model

type LiftStation implements CogniteAsset @view(rawFilter: {prefix : {property : ["node", "externalId"], value : "lift_station"}}) {

  "Direct relation to an Object3D instance representing the 3D resource"

  object3D: Cognite3DObject @mapping(space: "cdf_cdm", container: "CogniteVisualizable")

  "Name of the instance"

  name: String @mapping(space: "cdf_cdm", container: "CogniteDescribable")

  "Description of the instance"

  description: String @mapping(space: "cdf_cdm", container: "CogniteDescribable")

  "Text based labels for generic use, limited to 1000"

  tags: [String] @mapping(space: "cdf_cdm", container: "CogniteDescribable")

  "Alternative names for the node"

  aliases: [String] @mapping(space: "cdf_cdm", container: "CogniteDescribable")

  "Identifier from the source system"

  sourceId: String @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set."

  sourceContext: String @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "Direct relation to a source system"

  source: CogniteSourceSystem @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "When the instance was created in source system (if available)"

  sourceCreatedTime: Timestamp @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "When the instance was last updated in the source system (if available)"

  sourceUpdatedTime: Timestamp @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF"

  sourceCreatedUser: String @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF"

  sourceUpdatedUser: String @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  """

  The parent of the asset.

  @name Parent

  """

  parent: CogniteAsset @mapping(space: "cdf_cdm", container: "CogniteAsset", property: "assetHierarchy_parent")

  """

  An automatically updated reference to the top-level asset of the hierarchy.

  @name Root

  """

  root: CogniteAsset @mapping(space: "cdf_cdm", container: "CogniteAsset", property: "assetHierarchy_root")

  """

  An automatically updated ordered list of this asset's ancestors, starting with the root asset. Enables subtree filtering to find all assets under a parent.

  @name Path

  """

  path: [CogniteAsset] @mapping(space: "cdf_cdm", container: "CogniteAsset", property: "assetHierarchy_path") @directRelation @limits(maxListSize: 100)

  """

  The last time the path was updated for this asset.

  @name Path last updated time

  """

  pathLastUpdatedTime: Timestamp @mapping(space: "cdf_cdm", container: "CogniteAsset", property: "assetHierarchy_path_last_updated_time")

  """

  Specifies the class of the asset. It's a direct relation to CogniteAssetClass.

  @name Asset class

  """

  assetClass: CogniteAssetClass @mapping(space: "cdf_cdm", container: "CogniteAsset")

  """

  Specifies the type of the asset. It's a direct relation to CogniteAssetType.

  @name Asset type

  """

  type: CogniteAssetType @mapping(space: "cdf_cdm", container: "CogniteAsset")

  """

  An automatically updated list of files related to the asset.

  @name Files

  """

  files: [CogniteFile] @reverseDirectRelation(throughProperty: "assets")

  """

  An automatically updated list of assets with this asset as their parent.

  @name Children

  """

  children: [CogniteAsset] @reverseDirectRelation(throughProperty: "parent")

  """

  An automatically updated list of equipment related to the asset.

  @name Equipment

  """

  equipment: [CogniteEquipment] @reverseDirectRelation(throughProperty: "asset")

  """

  An automatically updated list of activities related to the asset.

  @name Activities

  """

  activities: [CogniteActivity] @reverseDirectRelation(throughProperty: "assets")

  """

  An automatically updated list of time series related to the asset.

  @name Time series

  """

  timeSeries: [CogniteTimeSeries] @reverseDirectRelation(throughProperty: "assets")

}

 

type Pump implements CogniteAsset @container(constraints: [{identifier : "requiredAsset", constraintType : REQUIRES, require : {space : "cdf_cdm", externalId : "CogniteAsset"}}]) {

  "Direct relation to an Object3D instance representing the 3D resource"

  object3D: Cognite3DObject @mapping(space: "cdf_cdm", container: "CogniteVisualizable")

  "Name of the instance"

  name: String @mapping(space: "cdf_cdm", container: "CogniteDescribable")

  "Description of the instance"

  description: String @mapping(space: "cdf_cdm", container: "CogniteDescribable")

  "Text based labels for generic use, limited to 1000"

  tags: [String] @mapping(space: "cdf_cdm", container: "CogniteDescribable")

  "Alternative names for the node"

  aliases: [String] @mapping(space: "cdf_cdm", container: "CogniteDescribable")

  "Identifier from the source system"

  sourceId: String @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set."

  sourceContext: String @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "Direct relation to a source system"

  source: CogniteSourceSystem @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "When the instance was created in source system (if available)"

  sourceCreatedTime: Timestamp @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "When the instance was last updated in the source system (if available)"

  sourceUpdatedTime: Timestamp @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF"

  sourceCreatedUser: String @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  "User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF"

  sourceUpdatedUser: String @mapping(space: "cdf_cdm", container: "CogniteSourceable")

  """

  The parent of the asset.

  @name Parent

  """

  parent: CogniteAsset @mapping(space: "cdf_cdm", container: "CogniteAsset", property: "assetHierarchy_parent")

  """

  An automatically updated reference to the top-level asset of the hierarchy.

  @name Root

  """

  root: CogniteAsset @mapping(space: "cdf_cdm", container: "CogniteAsset", property: "assetHierarchy_root")

  """

  An automatically updated ordered list of this asset's ancestors, starting with the root asset. Enables subtree filtering to find all assets under a parent.

  @name Path

  """

  path: [CogniteAsset] @mapping(space: "cdf_cdm", container: "CogniteAsset", property: "assetHierarchy_path") @directRelation @limits(maxListSize: 100)

  """

  The last time the path was updated for this asset.

  @name Path last updated time

  """

  pathLastUpdatedTime: Timestamp @mapping(space: "cdf_cdm", container: "CogniteAsset", property: "assetHierarchy_path_last_updated_time")

  """

  Specifies the class of the asset. It's a direct relation to CogniteAssetClass.

  @name Asset class

  """

  assetClass: CogniteAssetClass @mapping(space: "cdf_cdm", container: "CogniteAsset")

  """

  Specifies the type of the asset. It's a direct relation to CogniteAssetType.

  @name Asset type

  """

  type: CogniteAssetType @mapping(space: "cdf_cdm", container: "CogniteAsset")

  """

  An automatically updated list of files related to the asset.

  @name Files

  """

  files: [CogniteFile] @reverseDirectRelation(throughProperty: "assets")

  """

  An automatically updated list of assets with this asset as their parent.

  @name Children

  """

  children: [CogniteAsset] @reverseDirectRelation(throughProperty: "parent")

  """

  An automatically updated list of equipment related to the asset.

  @name Equipment

  """

  equipment: [CogniteEquipment] @reverseDirectRelation(throughProperty: "asset")

  """

  An automatically updated list of activities related to the asset.

  @name Activities

  """

  activities: [CogniteActivity] @reverseDirectRelation(throughProperty: "assets")

  """

  An automatically updated list of time series related to the asset.

  @name Time series

  """

  timeSeries: [CogniteTimeSeries] @reverseDirectRelation(throughProperty: "assets")

  DesignPointFlowGPM: Float

  DesignPointHeadFT: Float

  LowHeadFT: Float

  LowHeadFlowGPM: Float

}

I populated the data into the model using SQL transformation. When I query the data using GraphQL it gives below error

query {
  listPump {
    items {
      externalId
      name
      description
      root
      path
    }
  }
}

error -- seems like its due to root and parent are of type [CogniteAsset]

{
  "errors": [
    {
      "message": "Field 'root' referencing a type that is not part of the data model cannot be queried for",
      "locations": [
        {
          "line": 7,
          "column": 7
        }
      ],
      "extensions": {
        "classification": "ValidationError"
      }
    }
  ],
  "extensions": {
    "dmsQuery": {},
    "dmsDebug": {}
  }
}

How to see the asset hierarchy using GraphQL


Ali Tahir
Committed ⭐️⭐️⭐️
Forum|alt.badge.img+5
  • Committed ⭐️⭐️⭐️
  • April 18, 2026

Ah, the error is because you're querying `root` and `path` which reference `CogniteAsset`, but that view isn't included in your data model.

 

When you implement CogniteAsset in your types, you get the properties, but to actually query relationship fields in GraphQL, the referenced view needs to be explicitly part of your data model definition.

 

Quick fix can be - add CogniteAsset to your model:

 

In your data model definition, include:

```yaml

views:

  - space: your_space

    externalId: LiftStation

    version: "1"

  - space: your_space 

    externalId: Pump

    version: "1"

  - space: cdf_cdm

    externalId: CogniteAsset

    version: "v1"

 

After that, your GraphQL query with root and path should work. For now, you can query without those fields:

 

query {

  listPump {

    items {

      externalId

      name

      description

      DesignPointFlowGPM

      DesignPointHeadFT

    }

  }

}

To see the hierarchy, once you add CogniteAsset to the model you can query:

query {

  listPump {

    items {

      externalId

      name

      parent { externalId name }

      path { externalId name }

    }

  }

}

 

I think it will work. but Let me know if you hit any other issues.