Trigger new rule after creating cross reference [message #1407030] |
Mon, 11 August 2014 14:02  |
Eclipse User |
|
|
|
I'm new with Xtext, and I've been working in a small DSL that uses an ecore model.
In my DSL, I have a RoleType with attributes and operations like this.
RoleType returns crom::RoleType:
{crom::RoleType}
'role' name=EString (Extends tr_extends=[crom::RoleType])?
'{'
(attributes+=Attribute | operations+=Operation)*
'}';
When I define a new role I have to do something like this:
compartment myCompartment {
rolemodel:
role A {
}
role B {
}
constraints:
total A -> B;
}
And later on I can create contraints between roles
Constraint returns crom::Constraint:
(RoleConstraint | RelationshipConstraints | ComplexConstraint) ';'?;
RoleConstraint returns crom::RoleConstraint:
RoleImplication | RoleEquivalence | RoleProhibition;
RoleImplication returns crom::RoleImplication:
(first=[crom::RoleType|QualifiedName] ('implies' | '->' | '>') second=[crom::RoleType|QualifiedName] |
second=[crom::RoleType|QualifiedName] ('<-' | '<') first=[crom::RoleType|QualifiedName]) ';';
But the thing is, when I create a new Role and define a new Constraint I should create a RoleTypeInheritance rule.
RoleTypeInheritance returns crom::RoleInheritance:
{crom::RoleInheritance}
super=[crom::RoleType|QualifiedName] sub=[crom::RoleType|QualifiedName];
I'm not sure if I made myself clear. In conclusion I want to create an instance of RoleTypeInheritance when I create a new Constraint.
Thanks in advance,
Rodrigo.
|
|
|
|
|
Re: Trigger new rule after creating cross reference [message #1407071 is a reply to message #1407064] |
Mon, 11 August 2014 16:24   |
Eclipse User |
|
|
|
OK, sorry, I will try to reformulate my question.
When I define a contraint using my DSL I am using the role I created called RoleImplication. But I want to use underneath the role RoleTypeInheritance. Because we have different types of Contraints like RoleImplication, RoleEquivalence, RoleProhibition, but in the end all contraints are RoleTypeInheritance from two differents RoleType in my Constraint.
Try in a different way.
Here I define my roles using the rule RoleType.
rolemodel:
role A {
}
role B {
}
And latter on I use the rules that I created to define contraints between them.
The rule is called constraint and it uses the RoleTypes I defined before.
Since I have different types of constraints I should declare a rule for each type.
(RoleImplication, RoleEquivalence, RoleProhibition)
But, the a constraint, in my case, define a relationship between two roles and this relationship is represented by RoleTypeInheritance.
My question is, having a constraint A->B (RoleImplication) how can I link them using the role RoleTypeInheritance? I think it should be done probably at the linking phase, but I don't know how. Any Ideas?
Thanks.
|
|
|
|
Re: Trigger new rule after creating cross reference [message #1407323 is a reply to message #1407079] |
Tue, 12 August 2014 06:27   |
Eclipse User |
|
|
|
It doesn't fulfill my needs.
Because, I can have different types: DataType, NaturalType, CompartmentType, RoleType and so on.
And I have different Constraints: RoleImplication, RoleEquivalence, RoleProhibition and so on.
If I have just types without constraints they are only types. But if I define a constraint between them (e.g. A -> B), so they become members of CompartmentTypeInheritance, only if I define the constraint. Got it?
I was trying to manipulate the resource class in my generator, but I don't know if this is a valid approach.
Thanks for your help.
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10329 seconds