Types inheritance

#1

Hello,

I have two different timeseries for weather: normal weather and the measured weather
The type definition is the same, even the format of the source files

What is the most efficient way for defining the types structure? In OO programming you would typically have inheritance (Weather with 2 subclasses). How to handle this in C3TypeSystem?

The trivial way is to copy-paste one definition and change the naming :slight_smile:

Thanks,
Dimitri

0 Likes

#2

Using “sub-classes” is likely the correct solution here too. Something like

type WeatherFields {
temperature: ExactDimension
// More fields here
}

entity type MeasuredWeather mixes WeatherFields
entity type NormalWeather mixes WeatherFields

Now, given all that, i question your requirement :). Why do you have 2 types with exactly the same fields!? You could also, e.g. make a type like:

entity type Weather {
temperature: ExactDimension
weatherKind: string enum (‘Normal’, ‘Measured’)
}

as well as many other options. I also recommend you check out the Observation and WeatherStation types before going too far down this road.

0 Likes

#3

Thank a lot Riley, that answers my question !

On my requirement, I don’t have two types , I only have two timeseries of data, but indeed I see one can upload them separately for the same type and define a differentiator such as weatherKind as you suggest

0 Likes