|
Re: OCL in Ecore using 3.6M6 [message #526446 is a reply to message #526400] |
Sun, 11 April 2010 06:09 |
Ed Willink Messages: 7678 Registered: July 2009 |
Senior Member |
|
|
Hi Florian
It is always helpful to be clearer about what doesn't work You have no
problems but what did you do to make you expect one?
Without the OCLinEcore editor (that I'm struggling hard to get ready for
M7) you get no semantic validation of your OCL.
not name.oclIsUndefined() and <> ''
is not valid. I suspect you meant
not name.oclIsUndefined() and name <> ''
More seriously:
value="not name.oclIsUndefined() and <> ''"
is not valid XML, so I presume you have been editing your XML with a
text editor, rather than an XML editor or the Sample Ecore editor that
will correctly serialise it as
value="not name.oclIsUndefined() and <> ''"
So, you should see somewhere, perhaps the Error Log, that your ecore
file failed to load.
Once you get past that, you should get a run-time error creating the
invalid OCL expression.
Regards
Ed Willink
On 10/04/2010 13:01, Florian wrote:
> Hi there!
>
> This new annotation way of describing OCL constraints sounds very
> interesting (http://wiki.eclipse.org/MDT/OCLinEcore). I'm a beginner,
> but i thought it could still be possible to implement these stuff x)
> Well thought but now i'm stuck now :(
>
> I can validate my ecore ... even generate a gmf based diagram of it, but
> the constrants i set up seems not to be working (0 problems in the view).
> I'm using the 3.6M6 modeling incubation eclipse.
>
> Would be nice to get a helping hint!
>
> Florian
>
> Here is my ecore (annotation's are in cEventRelation and cOE):
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="MakeUpArts"
> nsURI="MakeUpArts" nsPrefix="MakeUpArts">
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
> <details key="invocationDelegates"
> value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
> <details key="settingDelegates"
> value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
> <details key="validationDelegates"
> value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
> </eAnnotations>
> <eClassifiers xsi:type="ecore:EClass" name="DocumentRoot">
> <eStructuralFeatures xsi:type="ecore:EReference" name="allDiagrams"
> upperBound="-2"
> eType="#//AllDiagrams" volatile="true" transient="true" derived="true"
> containment="true"
> resolveProxies="false"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="AllDiagrams">
> <eStructuralFeatures xsi:type="ecore:EReference" name="relations"
> upperBound="-1"
> eType="#//cEventRelation" containment="true" resolveProxies="false"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="aes"
> upperBound="-1" eType="#//cAE"
> containment="true" resolveProxies="false"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="tes"
> upperBound="-1" eType="#//cTE"
> containment="true" resolveProxies="false"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="oes"
> upperBound="-1" eType="#//cOE"
> containment="true" resolveProxies="false"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="qes"
> upperBound="-1" eType="#//cQE"
> containment="true" resolveProxies="false"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Event" abstract="true">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="Incomming"
> upperBound="-1"
> eType="#//cEventRelation" eOpposite="#//cEventRelation/destination"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="Outgoing"
> upperBound="-1"
> eType="#//cEventRelation" eOpposite="#//cEventRelation/source"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cEventRelation">
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
> <details key="constraints" value="isNoSelfRefference"/>
> </eAnnotations>
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL">
> <details key="isNoSelfRefference" value="self.source <> self.destination"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EReference" name="source"
> eType="#//Event"
> eOpposite="#//Event/Outgoing"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="destination"
> eType="#//Event"
> eOpposite="#//Event/Incomming"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cOE" eSuperTypes="#//Event">
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
> <details key="constraints" value="mustHaveName"/>
> </eAnnotations>
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL">
> <details key="mustHaveName" value="not name.oclIsUndefined() and <> ''"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"
> eType="#//Action"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cAE" eSuperTypes="#//Event">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"
> eType="#//Action"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cTE" eSuperTypes="#//Event">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"
> eType="#//Action"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cQE" eSuperTypes="#//Event"/>
> <eClassifiers xsi:type="ecore:EEnum" name="Action">
> <eLiterals name="Unknown"/>
> <eLiterals name="Add" value="1"/>
> <eLiterals name="Delete" value="2"/>
> <eLiterals name="Observe" value="3"/>
> </eClassifiers>
> </ecore:EPackage>
>
|
|
|
Re: OCL in Ecore using 3.6M6 [message #526471 is a reply to message #526446] |
Sun, 11 April 2010 15:21 |
Florian Messages: 6 Registered: April 2010 |
Junior Member |
|
|
Hi Ed,
first of all thank you for your help!
My actually goal is seeing this constraints working as a kind of live validation on my later generated GMF diagram.
I changed now the wrong OCL statement into "not name.oclIsUndefined() and name <> ''" by using the Properties view in eclipse.
After building/generating the whole project i took a look into the Error Log and Problems view of both eclipse sessions (the one i'm developing in and the one on that the GMF diagram runs in) and could find only one message "Both 't42l-alpha' and 'MakeUpArts2' register a package for 't42l'".
In the later generated .gmfgen i changed also the following attributes in some kind of hope it could be helping:
Live Validation UI Feadback -> true
Validation Decorators -> true
Validation Enabled -> true
Validation Decorator Provider Priority -> High
In the generated diagram i can still make all the things i don't want to make while no Message in the Error Log, Problems or in the console of the lunching eclipse environment comes.
I made also a search for some kind of validate button, but i found nothing like that.
Just to be sure, the OCL statements i write are checked so that i could receive some message i changed my valid OCL statement into "i like cease :)". Well actually the result was the same as above with no messages (All t42l-alpha related projects i closed before)
I checked the file named MakeUpArtsValidator.java which was correct created containing my statement:
protected static final String COE__MUST_HAVE_NAME__EEXPRESSION = "i like cease :)";
It seems to me, that the OCL statements i made in my ecore are ignored and don't come to use. What am i doing wrong?
Edward Willink wrote on Sun, 11 April 2010 02:09 | Hi Florian
It is always helpful to be clearer about what doesn't work You have no
problems but what did you do to make you expect one?
Without the OCLinEcore editor (that I'm struggling hard to get ready for
M7) you get no semantic validation of your OCL.
not name.oclIsUndefined() and <> ''
is not valid. I suspect you meant
not name.oclIsUndefined() and name <> ''
More seriously:
value="not name.oclIsUndefined() and <> ''"
is not valid XML, so I presume you have been editing your XML with a
text editor, rather than an XML editor or the Sample Ecore editor that
will correctly serialise it as
value="not name.oclIsUndefined() and <> ''"
So, you should see somewhere, perhaps the Error Log, that your ecore
file failed to load.
Once you get past that, you should get a run-time error creating the
invalid OCL expression.
Regards
Ed Willink
On 10/04/2010 13:01, Florian wrote:
> Hi there!
>
> This new annotation way of describing OCL constraints sounds very
> interesting (http://wiki.eclipse.org/MDT/OCLinEcore). I'm a beginner,
> but i thought it could still be possible to implement these stuff x)
> Well thought but now i'm stuck now
>
> I can validate my ecore ... even generate a gmf based diagram of it, but
> the constrants i set up seems not to be working (0 problems in the view).
> I'm using the 3.6M6 modeling incubation eclipse.
>
> Would be nice to get a helping hint!
>
> Florian
>
> Here is my ecore (annotation's are in cEventRelation and cOE):
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="MakeUpArts"
> nsURI="MakeUpArts" nsPrefix="MakeUpArts">
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
> <details key="invocationDelegates"
> value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
> <details key="settingDelegates"
> value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
> <details key="validationDelegates"
> value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
> </eAnnotations>
> <eClassifiers xsi:type="ecore:EClass" name="DocumentRoot">
> <eStructuralFeatures xsi:type="ecore:EReference" name="allDiagrams"
> upperBound="-2"
> eType="#//AllDiagrams" volatile="true" transient="true" derived="true"
> containment="true"
> resolveProxies="false"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="AllDiagrams">
> <eStructuralFeatures xsi:type="ecore:EReference" name="relations"
> upperBound="-1"
> eType="#//cEventRelation" containment="true" resolveProxies="false"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="aes"
> upperBound="-1" eType="#//cAE"
> containment="true" resolveProxies="false"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="tes"
> upperBound="-1" eType="#//cTE"
> containment="true" resolveProxies="false"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="oes"
> upperBound="-1" eType="#//cOE"
> containment="true" resolveProxies="false"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="qes"
> upperBound="-1" eType="#//cQE"
> containment="true" resolveProxies="false"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Event" abstract="true">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="Incomming"
> upperBound="-1"
> eType="#//cEventRelation" eOpposite="#//cEventRelation/destination"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="Outgoing"
> upperBound="-1"
> eType="#//cEventRelation" eOpposite="#//cEventRelation/source"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cEventRelation">
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
> <details key="constraints" value="isNoSelfRefference"/>
> </eAnnotations>
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL">
> <details key="isNoSelfRefference" value="self.source <> self.destination"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EReference" name="source"
> eType="#//Event"
> eOpposite="#//Event/Outgoing"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="destination"
> eType="#//Event"
> eOpposite="#//Event/Incomming"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cOE" eSuperTypes="#//Event">
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
> <details key="constraints" value="mustHaveName"/>
> </eAnnotations>
> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL">
> <details key="mustHaveName" value="not name.oclIsUndefined() and <> ''"/>
> </eAnnotations>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"
> eType="#//Action"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cAE" eSuperTypes="#//Event">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"
> eType="#//Action"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cTE" eSuperTypes="#//Event">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"
> eType="#//Action"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="cQE" eSuperTypes="#//Event"/>
> <eClassifiers xsi:type="ecore:EEnum" name="Action">
> <eLiterals name="Unknown"/>
> <eLiterals name="Add" value="1"/>
> <eLiterals name="Delete" value="2"/>
> <eLiterals name="Observe" value="3"/>
> </eClassifiers>
> </ecore:EPackage>
>
|
|
|
|
Re: OCL in Ecore using 3.6M6 [message #526477 is a reply to message #526471] |
Sun, 11 April 2010 16:01 |
Ed Willink Messages: 7678 Registered: July 2009 |
Senior Member |
|
|
Hi Florian
> It seems to me, that the OCL statements i made in my ecore are ignored
> and don't come to use. What am i doing wrong?
Quite possibly. I am afraid I am totally unable to follow your
discussion. It comes nowhere near a repro.
Please provide files that demonstrate a failure in as simple a way as
possible, preferably attached to a Bugzilla.
Problems within GMF should be reported to GMF.
Problems that you can reproduce in the Sample Reflective Ecore Editor or
in the OCL Interpreter I can investigate.
Regards
Ed Willink
On 11/04/2010 16:21, Florian wrote:
> Hi Ed,
>
> first of all thank you for your help!
>
> My actually goal is seeing this constraints working as a kind of live
> validation on my later generated GMF diagram.
>
> I changed now the wrong OCL statement into "not name.oclIsUndefined()
> and name <> ''" by using the Properties view in eclipse.
>
> After building/generating the whole project i took a look into the Error
> Log and Problems view of both eclipse sessions (the one i'm developing
> in and the one on that the GMF diagram runs in) and could find only one
> message "Both 't42l-alpha' and 'MakeUpArts2' register a package for
> 't42l'".
>
> In the later generated .gmfgen i changed also the following attributes
> in some kind of hope it could be helping:
> Live Validation UI Feadback -> true
> Validation Decorators -> true
> Validation Enabled -> true
> Validation Decorator Provider Priority -> High
>
> In the generated diagram i can still make all the things i don't want to
> make while no Message in the Error Log, Problems or in the console of
> the lunching eclipse environment comes.
> I made also a search for some kind of validate button, but i found
> nothing like that.
>
>
> Just to be sure, the OCL statements i write are checked so that i could
> receive some message i changed my valid OCL statement into "i like cease
> :)". Well actually the result was the same as above with no messages
> (All t42l-alpha related projects i closed before) :(
> I checked the file named MakeUpArtsValidator.java which was correct
> created containing my statement: protected static final String
> COE__MUST_HAVE_NAME__EEXPRESSION = "i like cease :)";
>
> It seems to me, that the OCL statements i made in my ecore are ignored
> and don't come to use. What am i doing wrong?
>
>
>
> Edward Willink wrote on Sun, 11 April 2010 02:09
>> Hi Florian
>>
>> It is always helpful to be clearer about what doesn't work You have no
>> problems but what did you do to make you expect one?
>>
>> Without the OCLinEcore editor (that I'm struggling hard to get ready
>> for M7) you get no semantic validation of your OCL.
>>
>> not name.oclIsUndefined() and <> ''
>>
>> is not valid. I suspect you meant
>>
>> not name.oclIsUndefined() and name <> ''
>>
>> More seriously:
>>
>> value="not name.oclIsUndefined() and <> ''"
>>
>> is not valid XML, so I presume you have been editing your XML with a
>> text editor, rather than an XML editor or the Sample Ecore editor that
>> will correctly serialise it as
>>
>> value="not name.oclIsUndefined() and <> ''"
>>
>> So, you should see somewhere, perhaps the Error Log, that your ecore
>> file failed to load.
>>
>> Once you get past that, you should get a run-time error creating the
>> invalid OCL expression.
>>
>> Regards
>>
>> Ed Willink
>>
>>
>> On 10/04/2010 13:01, Florian wrote:
>> > Hi there!
>> >
>> > This new annotation way of describing OCL constraints sounds very
>> > interesting (http://wiki.eclipse.org/MDT/OCLinEcore). I'm a beginner,
>> > but i thought it could still be possible to implement these stuff x)
>> > Well thought but now i'm stuck now :(
>> >
>> > I can validate my ecore ... even generate a gmf based diagram of it,
>> but
>> > the constrants i set up seems not to be working (0 problems in the
>> view).
>> > I'm using the 3.6M6 modeling incubation eclipse.
>> >
>> > Would be nice to get a helping hint!
>> >
>> > Florian
>> >
>> > Here is my ecore (annotation's are in cEventRelation and cOE):
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <ecore:EPackage xmi:version="2.0"
>> > xmlns:xmi="http://www.omg.org/XMI"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="MakeUpArts"
>> > nsURI="MakeUpArts" nsPrefix="MakeUpArts">
>> > <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
>> > <details key="invocationDelegates"
>> > value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
>> > <details key="settingDelegates"
>> > value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
>> > <details key="validationDelegates"
>> > value="http://www.eclipse.org/emf/2002/Ecore/OCL"/>
>> > </eAnnotations>
>> > <eClassifiers xsi:type="ecore:EClass" name="DocumentRoot">
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="allDiagrams"
>> > upperBound="-2"
>> > eType="#//AllDiagrams" volatile="true" transient="true" derived="true"
>> > containment="true"
>> > resolveProxies="false"/>
>> > </eClassifiers>
>> > <eClassifiers xsi:type="ecore:EClass" name="AllDiagrams">
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="relations"
>> > upperBound="-1"
>> > eType="#//cEventRelation" containment="true" resolveProxies="false"/>
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="aes"
>> > upperBound="-1" eType="#//cAE"
>> > containment="true" resolveProxies="false"/>
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="tes"
>> > upperBound="-1" eType="#//cTE"
>> > containment="true" resolveProxies="false"/>
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="oes"
>> > upperBound="-1" eType="#//cOE"
>> > containment="true" resolveProxies="false"/>
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="qes"
>> > upperBound="-1" eType="#//cQE"
>> > containment="true" resolveProxies="false"/>
>> > </eClassifiers>
>> > <eClassifiers xsi:type="ecore:EClass" name="Event" abstract="true">
>> > <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>> > eType="ecore:EDataType
>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="Incomming"
>> > upperBound="-1"
>> > eType="#//cEventRelation" eOpposite="#//cEventRelation/destination"/>
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="Outgoing"
>> > upperBound="-1"
>> > eType="#//cEventRelation" eOpposite="#//cEventRelation/source"/>
>> > </eClassifiers>
>> > <eClassifiers xsi:type="ecore:EClass" name="cEventRelation">
>> > <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
>> > <details key="constraints" value="isNoSelfRefference"/>
>> > </eAnnotations>
>> > <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL">
>> > <details key="isNoSelfRefference" value="self.source <>
>> self.destination"/>
>> > </eAnnotations>
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="source"
>> > eType="#//Event"
>> > eOpposite="#//Event/Outgoing"/>
>> > <eStructuralFeatures xsi:type="ecore:EReference" name="destination"
>> > eType="#//Event"
>> > eOpposite="#//Event/Incomming"/>
>> > </eClassifiers>
>> > <eClassifiers xsi:type="ecore:EClass" name="cOE"
>> eSuperTypes="#//Event">
>> > <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
>> > <details key="constraints" value="mustHaveName"/>
>> > </eAnnotations>
>> > <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL">
>> > <details key="mustHaveName" value="not name.oclIsUndefined() and <>
>> ''"/>
>> > </eAnnotations>
>> > <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"
>> > eType="#//Action"/>
>> > </eClassifiers>
>> > <eClassifiers xsi:type="ecore:EClass" name="cAE"
>> eSuperTypes="#//Event">
>> > <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"
>> > eType="#//Action"/>
>> > </eClassifiers>
>> > <eClassifiers xsi:type="ecore:EClass" name="cTE"
>> eSuperTypes="#//Event">
>> > <eStructuralFeatures xsi:type="ecore:EAttribute" name="action"
>> > eType="#//Action"/>
>> > </eClassifiers>
>> > <eClassifiers xsi:type="ecore:EClass" name="cQE"
>> eSuperTypes="#//Event"/>
>> > <eClassifiers xsi:type="ecore:EEnum" name="Action">
>> > <eLiterals name="Unknown"/>
>> > <eLiterals name="Add" value="1"/>
>> > <eLiterals name="Delete" value="2"/>
>> > <eLiterals name="Observe" value="3"/>
>> > </eClassifiers>
>> > </ecore:EPackage>
>> >
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03349 seconds