Hi,
Yes, indexing properties in the containers reflects on the views mapping those properties.
Hi, thanks for the response.
Say if Equipment Manufacturer container has the following:
id | name |
---|
1 | manufacturer1 |
2 | manufacturer2 |
And Pump container has the following:
id | name | maxPressure |
---|
x | pump1 | p1 |
y | pump2 | p2 |
z | pump3 | p3 |
And the Basic Pump container maps manufacturer as producer from Equipment, and maxPressure from Pump, and additionally has some extra information, like purchase date, so the model is like below:
id | producer | pumpId | maxPressure | purchaseDate |
---|
A | manufacturer1 | x | p1 | date1 |
B | manufacturer1 | y | p2 | date2 |
C | manufacturer2 | z | p3 | date3 |
How is the Basic Pump container created under the hood? Is new data created for producer and maxPressure, or does it simply point to Equipment and Pump containers for the attributes that are mapped (producer and maxPressure), and writes new data for attributes that are not mapped (pumpId, purchaseDate)?
Hi,
Containers can't be mapped from each other and each container has its own properties. The mapping is done inside the views where one view can map properties from one or more containers.
If you want to add a new property (purchaseDate) to your Basic Pump View, then you should either add that property to one of the exiting containers (Pump or Equipment), or create a new container with that new property and map it from inside the Basic Pump view. The instances (the data) that are gathered from the properties from different containers are connected by their externalId. E.g
Container: Equipment
externalId | id | name |
---|
ex1 | 1 | manufacturer1 |
ex2 | 2 | manufacturer2 |
ex3 | 3 | manufacturer3 |
Container: Pump
externalId | id | name | maxPressure |
---|
ex1 | x | pump1 | p1 |
ex2 | y | pump2 | p2 |
ex3 | z | pump3 | p3 |
Container: Extra Container (to hold extra properties)
externalId | purchaseDate |
---|
ex1 | date1 |
ex2 | date2 |
VIEW: Basic Pump with default filter (hasData)
externalId | producer | pumpId | maxPressure | purchaseDate |
---|
ex1 | manufacturer1 | x | p1 | date1 |
ex2 | manufacturer1 | y | p2 | date2 |
Regarding the data, if there is data in the existing containers that matches the filter you set on the Basic Pump View, the data will show up in that view. The data from purchaseDate will be also retrieved once you start writing data in it and that data matches the view filter you specified.
If you don’t define a view filter, a default filter (hasData) will be applied. That filter lets the view fetches data only in case all the container has data in the required properties (the externalId in our case here). Therefore, if you don’t define a new filter, and you add a new property (purchaseDate) to the view, the default hasData filter will prevent retrieving data unless you write data to the new property where the externalId matches new/existing externalIds in the other mapped containers. E,g, you can see in the Basic Pump above that only 2 instances are available in it. That’s because only ex1 and ex2 externalIds are created in the new containers (Extra Container)
You can read more about hasData filter on the below link:
https://docs.cognite.com/cdf/dm/dm_concepts/dm_querying/
Hi @Haaland,
We are following up to see whether you're satisfied with the responses you've received?
Hi @Haaland,
I hope that the issue has been resolved to your satisfaction. At this time, I am closing this topic. If you have any further questions or concerns, please do not hesitate to create a new post.