Author Topic: Metaclass Generalization isSubstitutable  (Read 3719 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Metaclass Generalization isSubstitutable
« on: April 02, 2020, 08:40:17 pm »
What's this attribute meant to do?

It's true by default. Setting it to false has no effect on a metaconstraint definition; the Substitution menu item appears in the quick linker regardless.

15.1.1527.
My theories are always correct, just apply them to the right reality.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8066
  • Karma: +118/-20
    • View Profile
Re: Metaclass Generalization isSubstitutable
« Reply #1 on: April 03, 2020, 08:07:39 am »
I suspect EA doesn't use it at all. Which means that the only thing it will do is export a different value to XMI.

I don't think it's related to the substitution connector.

The isSubstitutable property may be used to indicate whether the specific Classifier can be used in every circumstance that the general Classifier can be used.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8599
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Metaclass Generalization isSubstitutable
« Reply #2 on: April 03, 2020, 09:18:35 am »
I suspect EA doesn't use it at all. Which means that the only thing it will do is export a different value to XMI.

I don't think it's related to the substitution connector.

The isSubstitutable property may be used to indicate whether the specific Classifier can be used in every circumstance that the general Classifier can be used.
It's probably related to:

"The Liskov Substitution Principle (LSP, lsp) is a concept in Object Oriented Programming that states: Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it."

From the mists of time.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8066
  • Karma: +118/-20
    • View Profile
Re: Metaclass Generalization isSubstitutable
« Reply #3 on: April 03, 2020, 11:13:33 am »
The rest of the paragraph I quoted (but didn't read the whole thing) explains it with an example.

Quote
If one Classifier (the parent) generalizes another (the child) it is not necessarily the case that instances of the child are substitutable for instances of the parent under every possible circumstance. For example, Circle may be defined as a specialization of Ellipse, and its instances would be substitutable in every circumstance involving accessing the properties of an Ellipse. However, if Ellipse were to define a stretch behavior that modifies the length of its major axis only, then a Circle object would be unable to implement such a behavior.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8599
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Metaclass Generalization isSubstitutable
« Reply #4 on: April 03, 2020, 11:22:54 am »
The rest of the paragraph I quoted (but didn't read the whole thing) explains it with an example.

Quote
If one Classifier (the parent) generalizes another (the child) it is not necessarily the case that instances of the child are substitutable for instances of the parent under every possible circumstance. For example, Circle may be defined as a specialization of Ellipse, and its instances would be substitutable in every circumstance involving accessing the properties of an Ellipse. However, if Ellipse were to define a stretch behavior that modifies the length of its major axis only, then a Circle object would be unable to implement such a behavior.
OK, so that way I understand it now; the isSubstitutable attribute with value "true" confirms that the descendant adheres to the LSP.  In the example you give isSubstitutable=false. Yes?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8066
  • Karma: +118/-20
    • View Profile
Re: Metaclass Generalization isSubstitutable
« Reply #5 on: April 03, 2020, 01:53:49 pm »
Yes, in that example from the UML specification isSubstitutable=false.

Yes I agree that it's the same basic concept as the LSP. But I'd prefer the definition on wikipedia.

Quote
if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e. an object of type T may be substituted with any object of a subtype S) without altering any of the desirable properties of the program (correctness, task performed, etc.). More formally, the Liskov substitution principle (LSP) is a particular definition of a subtyping relation, called (strong) behavioral subtyping

What's interesting is that the UML 2.5.1 specification doesn't specify it for its own generalizations. Which because of the default value of true would imply that you should be able to use a ComponentRealization in any place where you would use a dependency. Which is clearly false.

HLidstrom

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: Metaclass Generalization isSubstitutable
« Reply #6 on: May 08, 2020, 09:46:57 pm »
Regardless of the deeper meaning, is there a way to manipulate the Substitutable property with a script?

I am working on a repeatable XMI import script and comparing my result to what Sparx built in import of the same XMI file produces.
I notice that Sparx import results in Generalization connectors with Substitutable = False (blank checkbox) and my script produces Generalization connectors with Substitutable = True (checked checkbox). How can I set the checkbox to blank?

There is no Substitutable attribute for the Connector class. (How could it be?). But I can't find a Generalization class in the object model. What to do? Can it even be done?

Thanks!
- Hakan Lidstrom

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13295
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Metaclass Generalization isSubstitutable
« Reply #7 on: May 08, 2020, 10:15:09 pm »
Hakan,

Without having looked at it in detail, there are indeed a number of properties that are not exposed in the API.
The only workaround to editing those is to use the undocumented and unsupported method Repository.Execute() to execute an SQL update query.

So what I do in such a case is look up which field in the database contains this information (use a profiler if needed) and then write an SQL update query to manipulate that field directly in the database.
If you still want to continue with the API object in memory it might be a good idea to reload it from he database, as saving your object might undo the changes you did in the database.

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8066
  • Karma: +118/-20
    • View Profile
Re: Metaclass Generalization isSubstitutable
« Reply #8 on: May 11, 2020, 09:37:04 am »
It should be in Connector.CustomProperties.