-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding properties inline #823
Comments
I like that change. I think that would make the DSL very powerful because information models would have a way to specialize abstract and re-usable functionblocks in an inline way to further refine the model. |
Do I understand correctly that by this I can no longer rely on that a functionblock always contains a well defined (and versioned) contract but that it depends on the context? What is the point of a functionblock then if I cannot rely that it is the same when used in different infomodels? |
I fully agree with the doubts brought up by @thjaeckle and would rather propose to enable these kinds of adaptions using inheritance between Functionblocks, so that a Functionblock can be inherited from another and then apply some "overrides". Thus the second Functionblock is still fully reference-able, named, versioned and both variants can be used in different information models. |
It depends on your information model (IM) which is the base for all Vorto models. The Vorto framework currently only uses the generated Ecore classes as they are. This should change in the future to enable the inheritance feature of a functionblock (see #796). As a user of the Vorto framework you need not to care about any extensions of a functionblock. In the future there will be a extended Ecore model which can be used by the generators.
The benefit is that you can change or extend specific parts like the anonymous class concept known from programming languages. The point of a functionblock stays the same you have a common base for development. Maybe we can align how you use the Vorto DSL. Have you a scenario in mind where this language feature could be a problem? |
Yes, I have scenarios in mind where this is a problem :) Coming from the "digital twin" (Eclipse Ditto) side where the information models and functionblocks come to live with concrete instances assume you have:
With the discussed overriding properties inline the "cargo-container:2.0.0" could now choose that the longitude and latitude of the "locatable:1.0.0" functionblock are no longer doubles but Strings instead. So an instance of a car would look in JSON like: {
...
"locatable": {
"longitude": -73.989308,
"latitude": 40.712775
}
...
} An instance of a cargo-container however would look in JSON like: {
...
"locatable": {
"longitude": "-73.989308 long",
"latitude": "40.712775 lat"
}
...
} So both infomodels contain the same functionblock in the same version but they do not share the same structure. In Ditto we want to provide search queries like:
Do you see that this no longer makes any sense if the contract of a functionblock is no contract any more but totally dynamic and dependent on the context (infomodel)? I am not interested in the Vorto DSL - I am "only" interested in using functionblocks with a given namespace, name and version as contract that I can rely on that the structure is always the same, no matter in which infomodels it may be used. |
Hi @thjaeckle @geglock |
See your point! Like in OOP-languages it should not possible to change the type of a property. Only the with, constraints, and description block can be altered. Additionally new properties can be introduced. The same goes for the From my point of view your feature would not be affected. Are you agree? Currently a property is described as:
|
@Ebolon @thjaeckle @geglock
Having said that and I totally agree to the concerns brought up, that the basic definition must not be broken by the extension. |
Hi @Ebolon |
So you can change the constraints which are defined in a functionblock to other constraints? If the
May the informationmodel define:
Or may it only restrict existing constraints further? |
@thjaeckle |
Ok, great. Then we agree :) |
@thjaeckle |
If only the infomodels contain "the whole truth" about the actual structure, Ditto should probably only look at them and forget about the functionblocks. |
I still don't see a benefit to allow these overrides to be done "inline" while linking a function block into an information model. It would be much more transparent to define a derived function block "MyTemperature" that refines the general IPSO "Temperature". Then all the versioning, re-use, management mechanisms would still be in-place and at the same time the DSL/meta model would stay simple but still providing all those override capabilities. |
@geglock |
My understanding on this topic is that there are:
If this feature is integrated, no such thing like "description" will exist any more. The application has to merge the info model with the function block to find the function block complete description. To me, it'll break the main goal of Vorto: clear models. To compare with OOP, the subsclass should not change the contract from the base class - Liskov substitution principle |
For me this topic looks like "anonymous inner classes" in Java - despite the discussion about breaking or not breaking the contracts. But then major difference is that in Java these anonymous classes are only/exclusively used by the implementation in the same area where the anonymous class was defined. But in Vorto we are doing something completely different: we are "exporting" these anonymous definitions the externals. Even more, Vorto is mainly there for exporting definitions. And so anonymous definitions would contradict the whole idea. Regarding the comment about "MyTemperature". Of course this would effect that there are a plenty of different function block flavors. But therefore we have namespaces and - hopefully in the future - also different repositories (e.g. private repositories). So I would vote for reverting this "inline" approach but refactor it to an "extend" functionality between Functionblocks. |
The descriptions in function blocks and datatypes remain so that will not break. what we additionally adding here with this inline "extend" is that it provides a way to define information model specific properties and constraints , in addition to the one's that the function block defines and the information model adheres to. Currently there is no convenient way in Vorto to define device (information model) specific properties. But where would this information be otherwise defined in your opinion @e-grigorov ? IMO, it cannot be Function blocks, because they represent abstract definitions independent of the device. @geglock : We do support "extend" between function blocks as of today. The question is should this be used to also express device specific functionality as well compared to putting this info into information models themselves. This extension cannot be compared to anonymous classes as they both fulfil different purposes. The purpose here is to express a way to further "annotate" function blocks with device specific information. |
In general, the device itself can be a function block. Usually, the device representation contains properties like:
This device can be defined as:
I have the feeling that you are talking about another use case here. It seems that you would like to specify device specific property values. For example: model - XYZ, firmwareVendor - companyXYZ:
@aedelmann, is it correct? |
Hey @thjaeckle, @geglock, @e-grigorov, thank you very much for your input! I had a call with @aedelmann and we agree that for now the benefit is to small (syntactic sugar) to introduce new complexity to the model. I will focus now on the |
Like discussed in #822 it should be possible to override some attributes inline in a functionblock/entity.
Here some examples:
Example1:
Information model using the IPSO model and overriding it:
Example2:
The text was updated successfully, but these errors were encountered: