Skip to main content
Answer

Establishing Relationships Between Domain Data Models and Asset

  • July 10, 2025
  • 4 replies
  • 35 views

Andre Alves
MVP
Forum|alt.badge.img+14

If I want to establish a relationship between a specific data model (not the core or enterprise model) and assets like a "function location," Do I  necessarily need to bring all the views from the core or enterprise models into your domain data model?

The goal is not to extend the core model but to create a reference from my domain data model to the asset, possibly using node_reference.

For instance, if I have an inventory and want to relate materials to a local storage (which is represented as an asset in the enterprise data model), could I define a property in my domain model that references the enterprise asset.

Example:

graphql

type StorageLocation {
location: String
plant: CogniteAsset # Reference to the asset in the enterprise model
}

 

In this case, I am just creating a link between my domain model and the asset without needing to extend the enterprise model or bring its full view into my domain model , works?


 

Best answer by Anders Albert

It is hard to answer without al the details. I would try to avoid duplicating data if you can. You can model it as a direct relation without setting the source in the view. This is essentially a foreign key were you put no expectations on what the key links to. I think that is the solution I would go for.

4 replies

Anders  Albert
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • July 11, 2025

It is possible if you use the underlying DMS API (using tools such as for example Neat), however, you will get invalid GraphQL if you do it.


Andre Alves
MVP
Forum|alt.badge.img+14
  • Author
  • MVP
  • July 14, 2025

Thanks, ​@Anders Albert  So this isn’t quite common to do, right?

We worked with a client where there were several domain data models, and this kind of relationship wasn’t made. Instead, engineers created a view inside each domain data model, duplicating the asset information both in the enterprise model and in the domain model that needed the relationship.

Do you think it’s better to solve this at the application layer instead, using an asset foreign key to look it up in the enterprise or classic one?


Anders  Albert
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • Answer
  • July 15, 2025

It is hard to answer without al the details. I would try to avoid duplicating data if you can. You can model it as a direct relation without setting the source in the view. This is essentially a foreign key were you put no expectations on what the key links to. I think that is the solution I would go for.


Andre Alves
MVP
Forum|alt.badge.img+14
  • Author
  • MVP
  • July 16, 2025

Thanks again, ​@Anders Albert .
We created the direct relation without setting the source in the view, as you suggested.