Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EVL: Checking the existence of a relationship between two classifier
EVL: Checking the existence of a relationship between two classifier [message #1717385] Sat, 12 December 2015 15:05 Go to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
Messages: 148
Registered: December 2015
Senior Member
Hi,

I like to check the existence of a relationship like an association between two classifiers in a UML model. For example, if a model had two classes named c1 and c2 which must be related by an association relationship, how to check this relationship in the EVL code?

I write the associates operation just as follows but its function is not correct!

operation Classifier associates (c: Classifier) : Boolean {
	return self.ownedElements.exists(a: Association | a.associationEnds.includes(c));
}

[Updated on: Wed, 20 January 2016 16:53]

Report message to a moderator

Re: EVL: Checking the existence of a relationship between two classifier [message #1717415 is a reply to message #1717385] Sun, 13 December 2015 11:03 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alireza,

I wouldn't expect to find any Associations under Classifier.ownedElements.

Cheers,
Dimitris
Re: EVL: Checking the existence of a relationship between two classifier [message #1717416 is a reply to message #1717415] Sun, 13 December 2015 11:06 Go to previous messageGo to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
Messages: 148
Registered: December 2015
Senior Member
Hi Dimitris,

How can I check such a relationship in the EVL language?
Re: EVL: Checking the existence of a relationship between two classifier [message #1717417 is a reply to message #1717416] Sun, 13 December 2015 11:09 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alireza,

I'd suggest opening a sample UML model with Exeed so that you can see exactly what's there and how elements are linked to each other.

Cheers,
Dimitris

[1] http://www.eclipse.org/epsilon/doc/articles/inspect-models-exeed/
Re: EVL: Checking the existence of a relationship between two classifier [message #1717418 is a reply to message #1717417] Sun, 13 December 2015 11:12 Go to previous messageGo to next message
Alireza Rouhi is currently offline Alireza RouhiFriend
Messages: 148
Registered: December 2015
Senior Member
Dear Dimitris,

Thank you very much.

Kind regards,
Alireza
Re: EVL: Checking the existence of a relationship between two classifier [message #1720700 is a reply to message #1717417] Wed, 20 January 2016 10:46 Go to previous messageGo to next message
Leandro Alexandre is currently offline Leandro AlexandreFriend
Messages: 5
Registered: January 2016
Junior Member
Hi Dimitris, good morning,

I have a similar problem: I need check if two nodes of model, M1 level, are connected. Can you help me?
Re: EVL: Checking the existence of a relationship between two classifier [message #1720737 is a reply to message #1720700] Wed, 20 January 2016 15:08 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Leandro,

Could you please share a copy of your metamodel and say a few more words about what exactly it is that you need to check?

Cheers,
Dimitris
Re: EVL: Checking the existence of a relationship between two classifier [message #1720766 is a reply to message #1720737] Wed, 20 January 2016 19:38 Go to previous messageGo to next message
Leandro Alexandre is currently offline Leandro AlexandreFriend
Messages: 5
Registered: January 2016
Junior Member
Hi Dimitius! Off course! Smile

@namespace(uri="twosml", prefix="twosml")
package Twosml;

@gmf.diagram
class ControlSchema {
val SmartSpace[1] csSmartSpace;
val UbiquitousApplication[*] csUbiApplication;
val UserRole[*] csUserRole;
val BehavioralPolicy[*] csPolicy;
val SmartObject[*] csSmartObject;
val Feature[*] csFeature;
val BehavioralAction[*] csBehAction;
val BehavioralCondition[*] csBehCondition;
val BehavioralEvent[*] csBehEvent;
val Service[*] csService;
val ModelingPolicy[*] csBehPolicy;
val ModelingEvent[*] csModEvent;
val ModelingCondition[*] csModCondition;
val ModelingAction[*] csModAction;
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/smartSpace.svg", size="100,100")
class SmartSpace {
attr String name = "";
val HostsUserRole[*] hUR_SS;
val HasBehPolSS[*] hpBehPo_SS;
val HostsSmartObject[*] hSO_SS;
val HostsService[*] hSer_SS;
val HostsUbiApp[*] hUA_SS;
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/ubiApp.svg", size="70,70")
class UbiquitousApplication {
attr String name;
attr String progLanguage;
val HasBehPolUbiApp[*] hpBehPo_UbiApp;
attr String category;
attr String superType;
attr String operatingSystem;
transient attr String ubiAppFeatures;
val HasModPolUbiApp[*] hpModPo_UbiApp;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="solid")
class CanUseUbiApp {
ref UbiquitousApplication[*] fromUR_UA;
ref UserRole source;
ref UbiquitousApplication target;
attr Multiplicity ubiAppMult;
attr Multiplicity uRoleMult;
attr String name="canUse";
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/userRole.svg", size="70,70")
class UserRole {
attr String name;
val HasBehPolUserRole[*] hpBehPo_UR;
val CanUseSO[*] cuSO_UR;
val CanUseUbiApp[*] cuUA_UR;
val CanUseService[*] cuSe_UR;
attr String superType;
val HasModPolUserRole[*] hpModPo_UR;
val IsOwnerOfSO[*] isoSO_UR;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="solid")
class HostsUserRole {
ref UserRole[*] fromSS_UR;
ref SmartSpace source;
ref UserRole target;
attr Multiplicity uRoleMult;
attr Multiplicity sSpaceMult;
attr String name="hosts";
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/behPolicy.svg", size="70,70")
class BehavioralPolicy {
attr String name;
val HasBehAct[*] hasBehAct_Po;
val HasBehCond[*] hasBehCon_Po;
val HasBehEv[*] hasPol_BehEv;
attr boolean overwrite;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="dot")
class HasBehPolSS {
ref BehavioralPolicy[*] fromSS_BehPol;
ref SmartSpace source;
ref BehavioralPolicy target;
attr String name="has";
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/smartObject.svg", size="90,90")
class SmartObject {
attr String name;
val CanUseOtherSO[*] cuSO_SO;
val IsComposedOf[*] icoFeat_SO;
val HasBehPolSO[*] hpBehPo_SO;
attr String superType;
val HasModPolSO[*] hpModPo_SO;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="solid")
class HostsSmartObject {
ref SmartObject[*] fromSS_SO;
ref SmartSpace source;
ref SmartObject target;
attr Multiplicity sObjectMult;
attr Multiplicity sSpaceMult;
attr String name="hosts";
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/service.svg", size="70,70")
class Service {
attr String name;
val HasBehPolSer[*] hpPo_Ser;
attr String superType = "";
transient attr String serviceFeatures;
val HasModPolSer[*] hpModPol_Ser;
}

class CanUseService {
ref Service[*] fromUR_Se;
attr Multiplicity serMult;
attr Multiplicity userRole;
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/feature.svg", size="40,40")
class Feature {
attr String name;
attr FeatureCategory featureCategory;
attr FeatureType featureType;
attr String featureDescription;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="filledrhomb", style="dash")
class IsComposedOf {
ref Feature[*] fromSO_Feat;
ref SmartObject source;
ref Feature target;
attr Multiplicity sObjectMult;
attr Multiplicity featureMult;
attr String name="isComposedOf";
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="solid")
class CanUseOtherSO {
ref SmartObject[*] fromSO_SO;
ref SmartObject source;
ref SmartObject target;
attr Multiplicity sObjectMult1;
attr Multiplicity sObjectMult2;
attr String name="canUse";
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/behPolicyEvent.svg", size="50,50")
class BehavioralEvent {
attr String name;
attr String description;
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/behPolicyAction.svg", size="50,50")
class BehavioralAction {
attr String name;
attr String description;
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/behPolicyCondition.svg", size="50,50")
class BehavioralCondition {
attr String name;
attr String description;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="dot")
class HasBehAct {
ref BehavioralAction[*] fromPol_BehAct;
ref BehavioralPolicy source;
ref BehavioralAction target;
attr String name="has";
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="dot")
class HasBehCond {
ref BehavioralCondition[*] fromPol_BehCon;
ref BehavioralPolicy source;
ref BehavioralCondition target;
attr String name="has";
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="dot")
class HasBehEv {
ref BehavioralEvent[*] fromPol_BehEv;
ref BehavioralPolicy source;
ref BehavioralEvent target;
attr String name="has";
}

class HasBehPolSer {
ref BehavioralPolicy[*] fromSer_Pol;
}

class HasBehPolUbiApp {
ref BehavioralPolicy[*] fromUbiApp_BehPol;
}

class HasBehPolUserRole {
ref BehavioralPolicy[*] fromUR_BehPol;
}

class HasBehPolSO {
ref BehavioralPolicy[*] fromSO_BehPol;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="solid")
class CanUseSO {
ref SmartObject[*] fromUR_SO_CU;
ref UserRole source;
ref SmartObject target;
attr Multiplicity uRoleMult;
attr Multiplicity sObjectMult;
attr String name="canUse";
}

enum FeatureType {
SOFTWARE = 0;
HARDWARE = 1;
}

enum FeatureCategory {
IO_RESOURCE = 0;
SENSOR = 1;
ACTUATOR = 2;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="solid")
class HostsService {
ref Service[*] fromSS_Ser;
ref SmartSpace source;
ref Service target;
attr Multiplicity sSpaceMult;
attr Multiplicity serMult;
attr String name="hosts";
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="solid")
class HostsUbiApp {
ref UbiquitousApplication[*] fromUA_SS;
ref SmartSpace source;
ref UbiquitousApplication target;
attr Multiplicity ubiAppMult;
attr Multiplicity sSpaceMult;
attr String name="hosts";
}

enum Multiplicity {
ZERO = 0;
ONE = 1;
TWO = 2;
THREE = 3;
FOUR = 4;
FIVE = 5;
TEN = 10;
TWENTY_FIVE = 25;
FIFTY = 50;
HUNDRED = 100;
FIVE_HUNDRED = 500;
THOUSAND = 1000;
ASTERISK = 10000;
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/modPolicy.svg", size="70,70")
class ModelingPolicy {
attr String name;
attr Boolean overwrite;
val HasModAct[*] hasModAct_Po;
val HasModCond[*] hasModCond_Po;
val HasModEv[*] hasModEv_Po;
}

class HasModPolSer {
ref ModelingPolicy[*] fromSer_ModPol;
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/modPolicyCondition.svg", size="50,50")
class ModelingCondition {
attr String name;
attr String description;
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/modPolicyEvent.svg", size="50,50")
class ModelingEvent {
attr String name;
attr String description;
}

@gmf.node(figure="svg", label.icon="false", label="name", label.pattern="{0}", label.placement="external",
svg.uri="platform:/plugin/Language/icons/modPolicyAction.svg", size="50,50")
class ModelingAction {
attr String name;
attr String description;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="dot")
class HasModCond {
ref ModelingCondition[*] fromPol_ModCond;
ref ModelingPolicy source;
ref ModelingCondition target;
attr String name="has";
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="dot")
class HasModEv {
ref ModelingEvent[*] fromPol_ModEv;
ref ModelingPolicy source;
ref ModelingEvent target;
attr String name="has";
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="dot")
class HasModAct {
ref ModelingAction[*] fromPol_ModAct;
ref ModelingPolicy source;
ref ModelingAction target;
attr String name="has";
}

class HasModPolUbiApp {
ref ModelingPolicy[*] fromUbiApp_ModPol;
}

class HasModPolSO {
ref ModelingPolicy[*] fromSO_ModPol;
}

class HasModPolUserRole {
ref ModelingPolicy[*] fromUR_ModPol;
}

@gmf.link(source="source", target="target", label="name", label.readOnly="true",
target.decoration="arrow", source.decoration="none", style="solid")
class IsOwnerOfSO {
ref SmartObject[*] fromUR_SO_ISO;
ref UserRole source;
ref SmartObject target;
attr Multiplicity uRoleMultiplicity;
attr Multiplicity sObject;
attr String name="isOwnerOf";
}

  • Attachment: twosml.emf
    (Size: 11.27KB, Downloaded 70 times)
Re: EVL: Checking the existence of a relationship between two classifier [message #1720767 is a reply to message #1720766] Wed, 20 January 2016 19:42 Go to previous messageGo to next message
Leandro Alexandre is currently offline Leandro AlexandreFriend
Messages: 5
Registered: January 2016
Junior Member
Dimitrius,

I need to check whether a UserRole, for example, "father" (M1 level), is associated with a set of SmartObjects, for example, "smartphone", "tablet", and "smartTV" (level M1). In other works, I want to force the UserRole "father" to associate the "smartphone", "tablet", and "smartTV".

[Updated on: Wed, 20 January 2016 19:44]

Report message to a moderator

Re: EVL: Checking the existence of a relationship between two classifier [message #1720822 is a reply to message #1720767] Thu, 21 January 2016 09:28 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Leandro,

The following constraint would check that all instances of UserRole have at least one SmartObject:

context UserRole {
  constraint HasSmartObject {
    check : self.isoSO_UR.exists(i | not i.from_UR_SO_ISO.isEmpty())
  }
}


Does this help?

Cheers,
Dimitris

[Updated on: Thu, 21 January 2016 09:29]

Report message to a moderator

Re: EVL: Checking the existence of a relationship between two classifier [message #1720841 is a reply to message #1720822] Thu, 21 January 2016 11:10 Go to previous messageGo to next message
Leandro Alexandre is currently offline Leandro AlexandreFriend
Messages: 5
Registered: January 2016
Junior Member
Hi Dimitris, good morning,

Actually, I want to check if particular UserRole is associated with a particular SmartObject. For example, I want to force the UserRole "father" to associate to the SmartObject "samsungTV" and "galaxy". I sent a picture for you in attached.
  • Attachment: Dimitris.png
    (Size: 163.76KB, Downloaded 158 times)
Re: EVL: Checking the existence of a relationship between two classifier [message #1720854 is a reply to message #1720841] Thu, 21 January 2016 13:00 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Leandro,

In this case, you'd need a constraint like the one below.

context UserRole {
  constraint FatherHasParticularSmartObjects {
  	
    guard : self.name = "father"

    check {
    	var samsungTv = SmartObject.all.selectOne(o|o.name = "samsungTV");
    	var galaxy = ...;
    	var smartObjects = Sequence{samsungTv, galaxy};

    	return self.isoSO_UR.from_UR_SO_ISO.flatten().includesAll(smartObjects);
    }
  }
}


Cheers,
Dimitris
Re: EVL: Checking the existence of a relationship between two classifier [message #1720872 is a reply to message #1720854] Thu, 21 January 2016 15:22 Go to previous message
Leandro Alexandre is currently offline Leandro AlexandreFriend
Messages: 5
Registered: January 2016
Junior Member
Perfect! Thank you very much, Dimitris!

Cheers,
Leandro
Previous Topic:[EOL/ETL] Need to determine a type of an attribute
Next Topic:EVL: How to change a property type
Goto Forum:
  


Current Time: Sat Apr 20 02:41:52 GMT 2024

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

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

Back to the top