Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [check]
[check] [message #534576] Wed, 19 May 2010 15:11 Go to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member


Hi,
im little bit confused im working on a problem for 2 days and wasnt able to resolve it:

Quote:

EvaluationException : Couldn't find property 'type' for type :Services::Operation



the Operation inheritate from a Datatype that contained the element type. i had the same problem with ATL and i solve it by using :

Quote:

out.eSet(out.eClass().getEStructuralFeature('type'),
String);


any ideas why i get this comportement

mahmoud

Re: [check] [message #534582 is a reply to message #534576] Wed, 19 May 2010 15:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
Hello,

I want to reproduce your problem but i don't know how to. can u tell more about your metamodel? the Operation EClass, it's hierarchy? Can you post your ecore? And your check statement?

~Christian

[Updated on: Wed, 19 May 2010 15:39]

Report message to a moderator

Re: [check] [message #534612 is a reply to message #534582] Wed, 19 May 2010 16:06 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member
Quote:

<eClassifiers xsi:type="ecore:EClass" name="GeneralTypedElement" abstract="true"
eSuperTypes="#//Entities/TypedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="#//Entities/GeneralType"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Operation" eSuperTypes="#//Entities/Feature #//Entities/GeneralTypedElement">
<eClassifiers xsi:type="ecore:EClass" name="Operation" eSuperTypes="#//Entities/Feature #//Entities/GeneralTypedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="class" eType="#//Entities/Class"
eOpposite="#//Entities/Class/ownedOperation"/>
</eClassifiers>



its worked before with this MM but when i make it a subpackege i mean some thing like:
Quote:

<ecore:EPackage xmi:version="2.0"
name="DSLMetaModel"
<eSubpackages name="Entities" nsURI="www.netfective.com/Entities" nsPrefix="Entities">
......


it got
Quote:
EvaluationException : Couldn't find property 'type'


context Entities::Attribute ERROR 'an attribute must have a type':
this.type.name!= null;

thanks in advance
mahmoud
Re: [check] [message #534648 is a reply to message #534612] Wed, 19 May 2010 17:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
hello, some of the things you posted don't fit together - can you try to give me a reduced runnable sample? just a complete ecore file and a check

[Updated on: Wed, 19 May 2010 18:00]

Report message to a moderator

Re: [check] [message #534764 is a reply to message #534648] Thu, 20 May 2010 09:37 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member
Hi,

Quote:

<?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="myMM"
nsURI="http://www.eclipse.org/myMM" nsPrefix="myMM">
<eClassifiers xsi:type="ecore:EClass" name="Project" eSuperTypes="#//Entities/NamedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="namespace" upperBound="-1"
eType="#//Namespace" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="qualifiedName" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Namespace" abstract="true" eSuperTypes="#//Entities/NamedElement"/>
<eClassifiers xsi:type="ecore:EClass" name="NamespaceEntities" eSuperTypes="#//Namespace">
<eStructuralFeatures xsi:type="ecore:EReference" name="ownedPackage" upperBound="-1"
eType="#//Entities/Package" containment="true" eOpposite="#//Entities/Package/namespace"/>
</eClassifiers>
<eSubpackages name="Entities" nsURI="www.netfective.com/Entities" nsPrefix="Entities">
<eClassifiers xsi:type="ecore:EClass" name="Package" eSuperTypes="#//Entities/NamedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="namespace" unique="false"
lowerBound="1" eType="#//NamespaceEntities" eOpposite="#//NamespaceEntities/ownedPackage"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ownedMainElement" upperBound="-1"
eType="#//Entities/MainElement" containment="true" eOpposite="#//Entities/MainElement/package"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MainElement" abstract="true" eSuperTypes="#//Entities/NamedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="package" unique="false"
lowerBound="1" eType="#//Entities/Package" eOpposite="#//Entities/Package/ownedMainElement"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Feature" abstract="true" eSuperTypes="#//Entities/NamedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isStatic" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TypedElement" abstract="true" eSuperTypes="#//Entities/NamedElement"/>
<eClassifiers xsi:type="ecore:EClass" name="GeneralTypedElement" abstract="true"
eSuperTypes="#//Entities/TypedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="#//Entities/GeneralType"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DataTypedElement" abstract="true"
eSuperTypes="#//Entities/TypedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="#//Entities/DataType"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GeneralType" abstract="true"/>
<eClassifiers xsi:type="ecore:EClass" name="DataType" eSuperTypes="#//Entities/GeneralType">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1"
eType="#//Entities/EnumDataType"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Property" abstract="true" eSuperTypes="#//Entities/Feature">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="default" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Operation" eSuperTypes="#//Entities/Feature #//Entities/GeneralTypedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="class" eType="#//Entities/Class"
eOpposite="#//Entities/Class/ownedOperation"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="setter" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="getter" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Attribute" eSuperTypes="#//Entities/Property #//Entities/DataTypedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="identifier" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="userid" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Class" eSuperTypes="#//Entities/MainElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="ownedOperation" upperBound="-1"
eType="#//Entities/Operation" containment="true" eOpposite="#//Entities/Operation/class"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ownedAttribute" upperBound="-1"
eType="#//Entities/Attribute" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="EnumDataType">
<eLiterals name="Blob"/>
<eLiterals name="URI"/>
<eLiterals name="URI_T"/>
<eLiterals name="URL"/>
<eLiterals name="URL_T"/>
<eLiterals name="P_void"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="NamedElement" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>



the validation was working when ihadnt an a subpackage with just
Quote:

context DSLMetaModel::Attribute ERROR 'an attribute must have a type': this.type.name!= null;


but when i add a subpackage entity with this validation it shows me an error like the type as reference couldnt be found
Quote:

context Entity::Attribute ERROR 'an attribute must have a type': this.type.name!= null;



thnaks
mahmoud
Re: [check] [message #534787 is a reply to message #534764] Thu, 20 May 2010 10:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
Hello,

I can reproduce the problem using a "default" workflow.
Could you please file a Bug for it. Don't know if it is a Bug or a Feature (Dynamic EMF Registration of the Reader), but we'll see.

You can get it running anyway when you modifying the stuff (workflow) like this:

(snippets from good old oaw 4.3.1)

	<bean class="org.eclipse.mwe.emf.StandaloneSetup" >
		<platformUri value=".."/>
		<registerEcoreFile value="src/metamodel/metamodel.ecore" />
	</bean>

[Updated on: Thu, 20 May 2010 10:53]

Report message to a moderator

Re: [check] [message #534792 is a reply to message #534787] Thu, 20 May 2010 11:10 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member


Hi Christian,

thanks for your help but im working with :

org.eclipse.xtend.typesystem.emf Sad , and not a oaw project so i dont have the workflow stuff. is there any other solution?

mahmoud

Re: [check] [message #534793 is a reply to message #534792] Thu, 20 May 2010 11:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
Isn't org.eclipse.xtend.typesystem.emf just a renaming from oaw?! Wink

Retestet with a 1.0.0M6 Sample and it works anyway (without my modifications)

How do you then start / invoke the checks?

[Updated on: Thu, 20 May 2010 11:32]

Report message to a moderator

Re: [check] [message #534817 is a reply to message #534793] Thu, 20 May 2010 12:53 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member

Hi,
by doing so,
Quote:

<extension
point="org.eclipse.xtend.typesystem.emf.checks">
<metaModel
nsURI="http://www.eclipse.org/DSLMetaModel"
override="false">
<checkFile
path="checks/checks_Entities.chk">
</checkFile>
</metaModel>
</extension>


and in the new eclipse instance i click on validate, so i dont have an workflow stuff.
i hope that its a the right answer

thanks Christian.
Re: [check] [message #534822 is a reply to message #534817] Thu, 20 May 2010 13:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
What about registering your subpackages here too?
Re: [check] [message #534832 is a reply to message #534822] Thu, 20 May 2010 13:16 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member


I did so, it was just a part, all the element validation are working fine, excepet for type, that shows an error, its a little bit confusing.
Re: [check] [message #534833 is a reply to message #534832] Thu, 20 May 2010 13:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
and what do i need to configure to see the error? which version of mwe do you use?

Update: Got it: CheckRegistry.getInstance();

[Updated on: Thu, 20 May 2010 13:33]

Report message to a moderator

Re: [check] [message #534841 is a reply to message #534833] Thu, 20 May 2010 13:33 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member

Hi, my hole work was based on the sample you gave me once : http://drop.io/oaw15003. i hope you rember it Smile
Re: [check] [message #534853 is a reply to message #534841] Thu, 20 May 2010 13:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
I remember Wink But still cannot reproduce the problem the following works perfect for me (using one of the latest xtend 1.0.0 Milestones):

context Entities::Attribute
	ERROR 'an attribute must have a type'
	: 
	this.type.name != null
;


   <extension
         point="org.eclipse.xtend.typesystem.emf.checks">
      <metaModel
            nsURI="www.netfective.com/Entities">
         <checkFile
               path="model/Checks.chk">
         </checkFile>
      </metaModel>
   </extension>


i get as i expect the validation error:

Description	Resource	Path	Location	Type
an attribute must have a type	My.mymm	/test	Unknown	EMF Problem
Re: [check] [message #534865 is a reply to message #534853] Thu, 20 May 2010 14:17 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member


Hi,

perhaps its due to the fact that i have xtend 0.7.2, where can i find xtend 1.0.0 Milestones so i can update mine. in the eclipse site there is just the 0.7.2 version.

thanks for all
mahmoud
Re: [check] [message #534867 is a reply to message #534865] Thu, 20 May 2010 14:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
Hi,

its a RC1 now and should be shipped with the itemis xtext distibutions that can be found here: http://xtext.itemis.com/xtext/language=en/23947/downloads

Regards, Christian
Re: [check] [message #535208 is a reply to message #534867] Fri, 21 May 2010 15:04 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member

Hi Christian,

I couldnt find some plugins when i update xtend; like org.eclipse.xtend.util.stdlib and org.eclipse.xtend.typesystem.emf, are they taken into considération in the last version?

Re: [check] [message #535247 is a reply to message #535208] Fri, 21 May 2010 17:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
Hello,

downloaded the RC1 distribution and found the plugins:
- org.eclipse.xtend.util.stdlib 1.0.0.v201005180835
- org.eclipse.xtend.typesystem.emf 1.0.0.v201005180835
So I cannot reproduce your problem.

Regards
Christian
Re: [check] [message #535623 is a reply to message #535247] Mon, 24 May 2010 23:14 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member

Hi Christian,

plz it would help me so much if i could de something like:

context Entity::Attribute ERROR 'an attribute must have a type':
this.eClass().getEStructuralFeature('type').name!=null;


java programing insteadof Ocl.

thanks in advance

mahmoud
Re: [check] [message #535667 is a reply to message #535623] Tue, 25 May 2010 08:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
So why don't you call a java extension then?
but

context Entity::Attribute ERROR 'an attribute must have a type':
this.type.name!=null;


should work anyway.
Re: [check] [message #536147 is a reply to message #535667] Thu, 27 May 2010 09:22 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member

Hi

Quote:

public static boolean val (EClass e)
{
return e.eClass().getEStructuralFeature("type")!=null;
}


in my extension file i did :

[QUOTE
boolean referencetype(EClass p):
JAVA com.sms.Messages.val(org.eclipse.emf.ecore.EClass)
;
QUOTE]

but in my check file, it displays an error : that it cannot cast from Entities::Attribute to ecore::EClass

Quote:

context Entities::Attribute ERROR msg('test.0'):
pins((EClass)this)
;


and the Entities::Attribute refering to the MM is an Eclass
Quote:

<eClassifiers xsi:type="ecore:EClass" name="Attribute" eSuperTypes="#//Entities/Property #//Entities/DataTypedElement">



how can i solve this please
mahmoud
Re: [check] [message #536185 is a reply to message #536147] Thu, 27 May 2010 10:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
Hi,

you are mixing MetaMetaModel, MetaModel and Model:

(1) public static boolean val (EClass e)

Here you are working on MetaMetaModel level

(2) context Entities::Attribute ERROR msg('test.0'):
pins((EClass)this)
;

here you define a check rule for a MetaClass = element of the MetaModel
thereby this is a Instance of this MetaClass which is an EObject in Ecore case

~Christian

Re: [check] [message #536195 is a reply to message #536185] Thu, 27 May 2010 11:06 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member

Hi,

i see the mistake, but how can i cast from and emf ecore(MMM) and my metamodel?
Re: [check] [message #536207 is a reply to message #536195] Thu, 27 May 2010 11:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
Hello,

Don't really understand. You can ask an EObject for it's EClass.
can you please tell what you want to solve? can you post a sample (incorrect) model (just as pseudo-code)

Regards, Christian

[Updated on: Thu, 27 May 2010 11:39]

Report message to a moderator

Re: [check] [message #536220 is a reply to message #536207] Thu, 27 May 2010 12:28 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member

hi, thanks for the reply
i want to verify if an attribute got a type by using a java extension like i posted before

this is an example for my model:
Quote:

<?xml version="1.0" encoding="UTF-8"?>
<myMM:NamespaceEntities xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:myMM="http://www.eclipse.org/myMM" xmlns:Entities="www.eclipse.com/Entities">
<ownedPackage>
<ownedMainElement xsi:type="Entities:Class">
<ownedAttribute>
<type name="String"/>
</ownedAttribute>
</ownedMainElement>
</ownedPackage>
</DSLMetaModel:NamespaceEntities>



mahmoud
Re: [check] [message #536222 is a reply to message #536220] Thu, 27 May 2010 12:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6315
Registered: July 2009
Senior Member
So cast your attribute to and eobject and ask it for its eclass.
But i Still don't understand why you need java at all !
Re: [check] [message #536230 is a reply to message #536222] Thu, 27 May 2010 13:03 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member

Hi,
i couldn make it work Sad

because im workin with xtend 0.7.2(i couldnt find the 1.0.0 for ganymed) and i cant get through type(reference).
displaying the error :
Quote:

EvaluationException : Couldn't find property 'type' for type Entities::Attribute


so i decide to force the access to the element type diffrently
Re: [check] [message #536437 is a reply to message #536230] Fri, 28 May 2010 09:03 Go to previous message
Elhamlaoui Mahmoud is currently offline Elhamlaoui Mahmoud
Messages: 260
Registered: March 2010
Senior Member

hi Christian,
soory for disturbing you, ive notice the same problem with all my Ereference element, its look like they are nit registred, ive checked in the java code and element are created.

any ideas?

mahmoud


Previous Topic:[Acceleo] match/drop Special chars
Next Topic:[JET] How to Dynamically call JET transform api through a plugin?
Goto Forum:
  


Current Time: Tue Sep 23 06:40:14 GMT 2014

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

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