Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » KM3 model (how to create a KM3 model for the following rule?)
KM3 model [message #559033] Wed, 15 September 2010 11:33 Go to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
I need ATL transformation to transform user requirements into following rules. Hence, the plan is creating a KM3 model for requirements, and KM3 model for the following rule, and convert them to .ecore models and use ATL transformation.

Could someone tell me how can i model the following rule as a KM3 model? Is there any other approach available?

<rules xsi:schemaLocation=" clix.xsd"
version="1.1" xmlns=""

<rule id="rule-1">

<report>Cost: %@=$service/Cost%
Currency: %@=$service/Currency%

<forall var="service" in="/Context/Service">
<equal op1="$service/Currency" op2="'GBP'"/>
<lessOrEqual op1="$service/Cost" op2="'0.2'"/>
<equal op1="$service/Currency" op2="'Euro'"/>
<lessOrEqual op1="$service/Cost" op2="'0.3'"/>


Re: KM3 model [message #559065 is a reply to message #559033] Wed, 15 September 2010 13:45 Go to previous message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
at the moment, I have the followings,

Requirements KM3:

package Requirement{
class Requirement{
attribute Context : String;
attribute compOperator : String;
attribute Value : String;
package PrimitiveTypes{
datatype String;

Constraints KM3:

package Constraint{
class Constraint{
attribute compOperator:String;
attribute op1 : String;
attribute op2 : String;

package PrimitiveTypes{
datatype String;


module Requirement2Constraint; -- Module Template
create OUT : Constraint from IN : Requirement;

rule Requirement{
a : Requirement!Requirement
b : Constraint!Constraint(
compOperator <- a.compOperator,
op1 <- a.Context,
op2 <- a.Value

Input in.ecore:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="" xmlns="Requirement">

<Requirement Context="$service/Cost" compOperator="lessThan" Value="'0.5'"/>
<Requirement Context="$service/Currency" compOperator="equal" Value="'USD'"/>


and finally i get output out.ecore:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="" xmlns="Constraint">
<Constraint compOperator="lessThan" op1="$service/Cost" op2="'0.5'"/>
<Constraint compOperator="equal" op1="$service/Currency" op2="'USD'"/>

I want this out.ecore file to be same as the rule defined in the previous post. Here only op1, op2 are same.

your help is appriciated.
Previous Topic:[TCS] Immediate Composite Operation?
Next Topic:[ATL] Model Handler
Goto Forum:

Current Time: Sat Jun 06 09:09:32 GMT 2020

Powered by FUDForum. Page generated in 0.01744 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top