Book a Demo

Author Topic: How to get collection of inherited elements  (Read 4077 times)

sspvirgo

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
How to get collection of inherited elements
« on: August 06, 2011, 12:45:15 am »
Hi,

Is there a way through which we can find out the elements that are inherited.

Just looking at an element i want to get information about it super type/super classes and sub type/sub classes.

Thanks,

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to get collection of inherited elements
« Reply #1 on: August 08, 2011, 05:24:54 pm »
There is Element.BaseClasses to go upwards.
If you want to go down (all elements that inherit from this element) then you'll have to check the Element.Connectors for all connectors of type Generalization/Realization

Geert

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: How to get collection of inherited elements
« Reply #2 on: August 09, 2011, 09:27:05 am »
Maybe also look at using Element.GetRelationSet to get all incoming or outgoing generalizations, realizations, etc and pass the result to Repository.GetElementSet.

sspvirgo

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: How to get collection of inherited elements
« Reply #3 on: August 13, 2011, 08:13:05 am »
Hi Geert,

This gives information about one level up and one level down.
If we need to find the root (parent of parent) of a leaf node i.e. element at the lowest level in the generalization how would we go about doing that. Also EA does support multiple inheritance so there might me multiple root elements.

I believe first we need to find the inheritance levels that exists in the diagram, not sure how to get that information but i am working on it.

Thanks,

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to get collection of inherited elements
« Reply #4 on: August 13, 2011, 02:30:35 pm »
Ok, lets put in in another perspective.

Your goal is to reach rung 10 of a ladder, but you only have an method to go up one rung.
So how would you go about to reach that 10th rung?

Seriously, just recurse up untill you can't go up any further

Geert