How to reduce the size of a model? [message #516752] |
Thu, 25 February 2010 00:07 |
Eclipse User |
|
|
|
Originally posted by: alain.vouffo.gmx.net
We are facing the following problem and would appreciate any hint or
solution:
We have an EMF model M1 resulting from automated transformation from
another model M0. Now M1 is quite big because it does not only now
contains all the elements present in M0 but also new elements we added.
But M1 actually reuses only a tiny part of M0. Therefore we are thinking
of a way to remove M1 all the parts that were imported from M0, but are
not referenced by M1.
How could this be achieved? Is there any tool/plugin with which the
unused elements could be filtered out and deleted to reduce the size of M1 ?
Best regards,
A. Vouffo
|
|
|
|
Re: How to reduce the size of a model? [message #516852 is a reply to message #516752] |
Thu, 25 February 2010 06:28 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------050105000805040009080808
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Alain,
No doubt eContents() and eCrossReferences() are useful to solve this
type of problem. For example, the following (untested) code should,
given a list of objects to visit (i.e., important objects you know you
want to keep), should return a set of all the objects that can be
reached from these starting objects.
Set<EObject> visited = new HashSet<EObject>();
Set<EObject> reached = new HashSet<EObject>();
// Populate initial objects to visit in "reached"
while (!reached.isEmpty())
{
Iterator<EObject> iterator = reached.iterator();
EObject visiting = iterator.next();
iterator.remove();
visited.add(visiting);
for (EObject content : visiting.eContents())
{
if (!visited.contains(content))
{
reached.add(content);
}
}
for (EObject crossReference : visiting.eCrossReferences())
{
if (!visited.contains(crossReference))
{
reached.add(crossReference);
}
}
}
Then again, maybe you should start from scratch, i.e., throw all your
EMF models away, switch to using UML for everything, and then buy some
commercial tools to support your efforts. :-P
Alain Vouffo wrote:
> We are facing the following problem and would appreciate any hint or
> solution:
> We have an EMF model M1 resulting from automated transformation from
> another model M0. Now M1 is quite big because it does not only now
> contains all the elements present in M0 but also new elements we
> added. But M1 actually reuses only a tiny part of M0. Therefore we are
> thinking of a way to remove M1 all the parts that were imported from
> M0, but are not referenced by M1.
> How could this be achieved? Is there any tool/plugin with which the
> unused elements could be filtered out and deleted to reduce the size
> of M1 ?
>
> Best regards,
> A. Vouffo
--------------050105000805040009080808
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Alain,<br>
<br>
No doubt eContents() and eCrossReferences() are useful to solve this
type of problem.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.01251 seconds