[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-user] Match depending on the number of edges

Hi,

one feature that might be useful to implement this are Aggregations. Aggregations can be used to count a number of references of a certain type, just as required in the example: http://www.ckrause.org/2015/11/aggregations-in-henshin.html

However, it might not be possible to implement the full desired behavior in only one rule: the result of counting is only available after the multi-rule used for counting has been matched (which happens chronologically after the matching of the kernel rule, where you already need the count).

You could still implement the behavior by storing the count for each Class1 and later using it for matching. This can be achieved by two rules: The first one counts for each Class1 the number of its Class2 references, and stores that number into an auxiliary object (e.g. a UML annotation, or a Trace object from Henshin's built-in generic Trace meta-model [1]). There should be one such auxiliary object created for each Class1. The second rule takes the desired number of Class2 references as an input parameter, and matches it against the numbers stored in the auxiliary objects.

It's certainly a verbose way to do it. Having counting as a language feature would be an interesting research topic of its own.

[1] https://wiki.eclipse.org/Henshin_Trace_Model

Best regards,
Daniel

Am 26.10.2017 um 17:28 schrieb Zschaler, Steffen:

I see. You may need a higher-order transformation for this, generating the specific rules you want to match. I donât think you can get this out of the box.

Â

Steffen

Â

Dr. rer. nat. Steffen Zschaler AHEA

Senior Lecturer

Â

King's College London

Department of Informatics

Â

Email szschaler@xxxxxxx

Phone +44 (020) 7848 1513

WWWÂÂ http://www.steffen-zschaler.de/

Â

From: henshin-user-bounces@xxxxxxxxxxx [mailto:henshin-user-bounces@xxxxxxxxxxx] On Behalf Of Juergen Freund
Sent: 26 October 2017 13:54
To: henshin-user@xxxxxxxxxxx
Subject: Re: [henshin-user] Match depending on the number of edges

Â

Thank you for your immediate answer.

Â

Â

I see, I did not declare my matter clearly. Sorry for that.

Â

Sure I can match that by explicitly define a rule where Class1 is connected to exactly 2 Class2.

Â

What I had in my was more in the direction by making it some kind of generic with for example attribute conditions and input parameters.

Â

Sorry for the inconvenience. I hope now it's clearer what I meant.

Â

Â

Best,

JÃrgen

Â

--Â

Dipl.-Ing. JÃrgen Freund

Arbeitsgruppe Ãhnlichkeitsmechanik

Â

Telefon: +49 (0)711 685 69530

Â

Postadresse:

UniversitÃt Stuttgart

Institut fÃr Statik und Dynamik der Luft- und Raumfahrtkonstruktionen

Pfaffenwaldring 27 - Zimmer 01.002

70569 Stuttgart

Â

On Thu, 2017-10-26 at 12:34 +0000, Zschaler, Steffen wrote:

Thatâs exactly what Graph Rules are for. You can just write down exactly the situation that you are after.

Â

Steffen

Â

Dr. rer. nat. Steffen Zschaler AHEA

Senior Lecturer

Â

King's College London

Department of Informatics

Â

Email szschaler@xxxxxxx

Phone +44 (020) 7848 1513

WWWÂÂ http://www.steffen-zschaler.de/

Â

From: henshin-user-bounces@xxxxxxxxxxx [mailto:henshin-user-bounces@xxxxxxxxxxx] On Behalf Of Juergen Freund
Sent: 26 October 2017 13:19
To: Henshin Project user discussions <henshin-user@xxxxxxxxxxx>
Subject: [henshin-user] Match depending on the number of edges

Â

Hello Henshin users and developers,

Â

Â

I just wanted to ask if it possible to construct matching rules which match certain patterns dependent on their number of connected edges?

Â

As example:

Â

My class diagram:

Â

Class1 -- [*] Class2

Â

My input model:

Â

Class1 connected to 3 Class2.

Class1 -- [3] Class2

Â

Class1 connected to 2 Class2.

Class1 -- [2] Class2

Â

Â

Now I want my rules only to match the pattern where Class1 only has 2 Class2 members.

Â

Â

Best,

JÃrgen

Â

Â

-- 

Dipl.-Ing. JÃrgen Freund

Arbeitsgruppe Ãhnlichkeitsmechanik

Â

Telefon: +49 (0)711 685 69530

Â

Postadresse:

UniversitÃt Stuttgart

Institut fÃr Statik und Dynamik der Luft- und Raumfahrtkonstruktionen

Pfaffenwaldring 27 - Zimmer 01.002

70569 Stuttgart

_______________________________________________
henshin-user mailing list
henshin-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-user


_______________________________________________
henshin-user mailing list
henshin-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-user