Author Topic: Access Generalization Sets via Automatation?  (Read 7102 times)

Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Access Generalization Sets via Automatation?
« on: October 09, 2011, 12:05:35 am »
Dear all,
I need to read out information about generalization sets via script, but I seem unable to figure out how. I've tried connector attributes "Properties" and "CustomProperties" so far. Can it be done in EA9?

(I need to collect all classes which are elements of the same powertype to put them into a diagram.)

Thanx
Michael
« Last Edit: October 11, 2011, 04:20:28 am by hafnerm »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Access Generalzation Sets via Automatation?
« Reply #1 on: October 10, 2011, 08:10:38 am »
Read element.Connectors
For each connector check if the Type == "Generalization"
Figure out the opposite from conn.ClientID and .SupplierID (the one which is not element.ElementID)

q.

Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Re: Access Generalization Sets via Automatation?
« Reply #2 on: October 11, 2011, 04:39:10 am »
Dear q,
thanks for your reply, but I think, there is a misunderstanding - my problem is not the identification of connectors of the type "Generalization".

You can (via the EA-client) assign to a Generalization one or more Generalization Sets (right click, "Advanced...", "Generalization Set").
A Generalization Set groups together a set of subclasses according to some criterion, e.g. a dimension or principium divisionis. (For the subclasses "Blue", "Green", "Red" of "Ball", the generalization set would be something like "Color"). Associated to a generalization set is (or may be (should be)) one Powertype, the instances of which are the members of the generalization set.

And it is information about this powertype I need to read out. I think, the information is stored in Table t_xref, but I don't know how to obtain it via the API.

Best,
Michael




« Last Edit: October 11, 2011, 06:06:09 am by hafnerm »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Access Generalization Sets via Automatation?
« Reply #3 on: October 11, 2011, 06:30:06 pm »
Wow, I had never heard about these generalization sets before.
Is that a known concept in UML? I don't understand what it is used for... :-[

Anyway, since this is a pretty exotic feature it probably isn't exposed in the API. What I usually do in these cases is use Repository.SQLQuery() to get the information I need directly from the database.

Geert
« Last Edit: October 11, 2011, 06:30:21 pm by Geert.Bellekens »

Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Re: Access Generalization Sets via Automatation?
« Reply #4 on: October 12, 2011, 02:44:17 am »
Thanks, Geert - that's precisely what I needed! I, for my part, hadn't looked into the Repository class deeply enough to know about the SQL-Function. That's great information (I really love EA :-))!

- Yes, the Generalization Set is a UML concept. You can look it up in
http://www.omg.org/spec/UML/2.2/Superstructure/PDF, page 72f.
It may sound arcane, but if you are working with ontologies where you can't avoid multiple generalization, it comes in handy.

UML's example is about Persons being specialized by gender (Subclasses Male/Female) as opposed to specialization by employment status.

I use it for things like MediaObjects, where you need quadruple specialization with powertypes for, say, SignalType (Analog/Digital), Mode (Audio/Video...), Genre (Music/Speech...), and MediaType (Carrier/File...) to end up with the Analog_Audio_Music_Carrier, the Digital_Audio_Music_Carrier etc. Generalization sets help you to group together the associated relationships (resp. subclasses).

Thank-you very much indeed for pointing out this function to me!
Michael












« Last Edit: October 12, 2011, 02:46:04 am by hafnerm »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Access Generalization Sets via Automatation?
« Reply #5 on: October 12, 2011, 06:18:38 pm »
I just skimmed the part about GeneralizationSet in the superstructure, and oh boy, am I glad we don't use that :o (and I'm even happier I don't have to explain that concept in a training)
I'm really having difficulties seeing how an object can be both a "Male Person" as an "Employee".
Are there programming languages that allow an object to be of two types at the same time?

Geert



Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Re: Access Generalization Sets via Automatation?
« Reply #6 on: October 12, 2011, 07:53:33 pm »
Well... - I think, the underlying concept is easy; we do this all the time on an everyday basis. "This Brunello is wonderful, but it's to expensive for me." - So obviously there are pricing levels as well as quality aspects to consider:

Generalization Set Price_Level { Expensive_Wine, Cheap_Wine }
Generalization Set Wine_Quality { Wonderful_Wine, Awful_Wine }

I think, multiple inheritance is indispensible in models dealing with semantics. And it might be practical for analytic models, even if you do have to resolve the multi-hierarchy into a mono-hierarchy during design. A matter of taste, I guess. It resembles de-normalization: After having normalized everthing by the book, you decide which tables you actually do need (and how many you can afford in terms of performane etc.).

I, for my part, do not really see the necessity to distinguish between powertype and generalization set. Outside UML (and programming), the terms "class" and "set" are often used more or less synonymously (not counting stuff like "ultimate classes"). Inside UML, a class isn't a set, but a descriptor for a set (outside: a UML::Class would be a specification of the class or set). So if sets go by their classes in UML - why suddenly use the set (generalization set) and the class (powertype) instead of just assigning a powertype?

Thanks again, M.
« Last Edit: October 12, 2011, 11:22:30 pm by hafnerm »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Access Generalization Sets via Automatation?
« Reply #7 on: October 13, 2011, 08:38:26 am »
t depends if you want the difference specified in the class model or object model. I think in general people deal with it more naturally in the object model by use of instantiating an association/property. In your wine example to two enumerations.

Instantiating an object model is more flexible, especially in terms of changing those properties dynamically. (eg. Your Brunello is on an amazing sale.) but there's no reason why you wouldn't want to use both. (sparkling/not, red/white plus the associations mentioned)


mrks

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Access Generalization Sets via Automatation?
« Reply #8 on: October 15, 2011, 07:37:50 pm »
Quote
Repository.SQLQuery()

... can you give an example on this? - cheers


mrks

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Access Generalization Sets via Automatation?
« Reply #10 on: October 15, 2011, 08:25:01 pm »
Hi Geert - that looks pretty cool, ...

I have never heard about the add in framework before - it is currently confusing me a bit, can you please clearify... is this an extension or alternative to using the templates?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller

mrks

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Access Generalization Sets via Automatation?
« Reply #12 on: October 19, 2011, 05:21:56 am »
Thanks! your blogs seem to be very useful!

I will give it a try later. for now I hope to find a more easy solution to read the link Source property - cheers!