Home » Archived » M2M (model-to-model transformation) » [ATL] problem with programmatically transformation output model
[ATL] problem with programmatically transformation output model [message #42255] |
Mon, 28 May 2007 13:41 |
Eclipse User |
|
|
|
Originally posted by: MIMINNO.it.ibm.com
Hi all,
I'm trying to perform an ATL transformation programmatically, but the
method:
AtlLauncher.getDefault().launch(transformation, libs, models, params);
returns an ASMEMFModel with no modelElements. This is driving me crazy,
I'll be very thankful with the one who is able to help me!
exquisitus
|
|
|
Re: [ATL] problem with programmatically transformation output model [message #42426 is a reply to message #42255] |
Mon, 28 May 2007 14:38 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hello,
Firstly, The target models are passed as entries of the models argument.
There are not "returned" by the launch method, which returns the value
of a query (and nothing for transformation modules).
Secondly, if you still have a problem: are there any execution errors?
If not, you could try to add calls to OclAny.debug(message : String) :
OclAny in your code (e.g., in rule guards, even if they have none: use
true.debug('matching')) to see if rules are matched.
If rules are not matched, then it may mean that you have not passed a
source model conforming to your source metamodel.
This can happen if you have loaded your metamodel twice, and do not pass
as argument to launch() the metamodel that was used when loading the
model. Another issue, with EMF, is if you override the package registry
entry by loading another (or the same) metamodel with the same nsURI.
Best regards,
Frédéric Jouault
exquisitus wrote:
> Hi all,
>
> I'm trying to perform an ATL transformation programmatically, but the
> method:
>
> AtlLauncher.getDefault().launch(transformation, libs, models, params);
>
>
>
> returns an ASMEMFModel with no modelElements. This is driving me crazy,
> I'll be very thankful with the one who is able to help me!
>
> exquisitus
>
>
>
>
|
|
|
Re: [ATL] problem with programmatically transformation output model [message #42498 is a reply to message #42426] |
Mon, 28 May 2007 15:02 |
Eclipse User |
|
|
|
Originally posted by: MIMINNO.it.ibm.com
Hi,
if I let run the java project with the ATL transformation, I get
thefollowing error message:
Exception in thread "main" java.lang.NullPointerException
at
org.atl.engine.repositories.emf4atl.ASMEMFModel.getElementsB yType(ASMEMFModel.java:178)
at org.atl.engine.vm.nativelib.ASMModel.getElementsByType(ASMMo del.java:53)
at org.atl.engine.extractors.xml.XMLExtractor.extract(XMLExtrac tor.java:45)
at org.atl.engine.extractors.xml.XMLExtractor.extract(XMLExtrac tor.java:32)
at atl.ATLTransformations.extractXMLModelToFile(ATLTransformati ons.java:361)
at atl.ATLTransformations.transformOnetoOther(ATLTransformation s.java:629)
at atl.ATLTransformations.main(ATLTransformations.java:644)
this is my target metamodel (the transformation is UML2WIKI):
<?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="WIKI"
nsURI="/UML2WikiText/src/atl/metamodels/WIKI/WIKI.ecore" nsPrefix="WIKI">
<eClassifiers xsi:type="ecore:EClass" name="Editable">
<eOperations name="print" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="includedSections"
upperBound="-1"
eType="#//Section"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="items"
upperBound="-1"
eType="#//Item"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Page" eSuperTypes="#//Editable">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="category"
upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Section"
eSuperTypes="#//Editable">
<eStructuralFeatures xsi:type="ecore:EReference" name="supersection"
eType="#//Section"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Item">
<eStructuralFeatures xsi:type="ecore:EReference" name="owner"
eType="#//Editable"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TextItem" eSuperTypes="#//Item">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="text"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TemplateItem"
eSuperTypes="#//Item">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="attributes"
upperBound="-1"
eType="#//TemplateAttribute"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="LinkItem" eSuperTypes="#//Item">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="label"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="locator"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="internal"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TemplateAttribute">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</ecore:EPackage>
.... and this are the ModelElements of the corrensponding loaded Metamodel:
{org.eclipse.emf.ecore.impl.EDataTypeImpl@fa5ff3 (name: EByteObject)
(instanceClassName: java.lang.Byte) (serializable: true)=WIKI!EByteObject,
org.eclipse.emf.ecore.impl.EDataTypeImpl@bbfa5c (name: EDoubleObject)
(instanceClassName: java.lang.Double) (serializable:
true)=WIKI!EDoubleObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@f449b8
(name: EBooleanObject) (instanceClassName: java.lang.Boolean) (serializable:
true)=WIKI!EBooleanObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@1362a63
(name: EInt) (instanceClassName: int) (serializable: true)=WIKI!EInt,
org.eclipse.emf.ecore.impl.EDataTypeImpl@fd1810 (name: EShortObject)
(instanceClassName: java.lang.Short) (serializable: true)=WIKI!EShortObject,
org.eclipse.emf.ecore.impl.EDataTypeImpl@11b86c7 (name: EResourceSet)
(instanceClassName: org.eclipse.emf.ecore.resource.ResourceSet)
(serializable: false)=WIKI!EResourceSet,
org.eclipse.emf.ecore.impl.EDataTypeImpl@16f70a4 (name: EJavaObject)
(instanceClassName: java.lang.Object) (serializable:
false)=WIKI!EJavaObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@10d95cd
(name: EEList) (instanceClassName: org.eclipse.emf.common.util.EList)
(serializable: false)=WIKI!EEList,
org.eclipse.emf.ecore.impl.EDataTypeImpl@1efe475 (name: EFloat)
(instanceClassName: float) (serializable: true)=WIKI!EFloat,
org.eclipse.emf.ecore.impl.EDataTypeImpl@eb7331 (name: EFeatureMapEntry)
(instanceClassName: org.eclipse.emf.ecore.util.FeatureMap$Entry)
(serializable: true)=WIKI!EFeatureMapEntry,
org.eclipse.emf.ecore.impl.EDataTypeImpl@f42160 (name: EFeatureMap)
(instanceClassName: org.eclipse.emf.ecore.util.FeatureMap) (serializable:
false)=WIKI!EFeatureMap, org.eclipse.emf.ecore.impl.EDataTypeImpl@8a52b6
(name: EMap) (instanceClassName: java.util.Map) (serializable:
false)=WIKI!EMap, org.eclipse.emf.ecore.impl.EDataTypeImpl@c0c8b5 (name:
EBigDecimal) (instanceClassName: java.math.BigDecimal) (serializable:
true)=WIKI!EBigDecimal, org.eclipse.emf.ecore.impl.EDataTypeImpl@1f8acdc
(name: ELong) (instanceClassName: long) (serializable: true)=WIKI!ELong,
org.eclipse.emf.ecore.impl.EDataTypeImpl@dc9065 (name: EFloatObject)
(instanceClassName: java.lang.Float) (serializable: true)=WIKI!EFloatObject,
org.eclipse.emf.ecore.impl.EcorePackageImpl@42f352 (name: ecore) (nsURI:
http://www.eclipse.org/emf/2002/Ecore, nsPrefix: ecore)=WIKI!ecore,
org.eclipse.emf.ecore.impl.EDataTypeImpl@c67a88 (name: EIntegerObject)
(instanceClassName: java.lang.Integer) (serializable:
true)=WIKI!EIntegerObject, org.eclipse.emf.ecore.impl.EPackageImpl@153b2cb
(name: WIKI) (nsURI: /UML2WikiText/src/atl/metamodels/WIKI/WIKI.ecore,
nsPrefix: WIKI)=WIKI!WIKI, org.eclipse.emf.ecore.impl.EDataTypeImpl@1f488f1
(name: EResource) (instanceClassName:
org.eclipse.emf.ecore.resource.Resource) (serializable:
false)=WIKI!EResource, org.eclipse.emf.ecore.impl.EDataTypeImpl@1fe4169
(name: EDouble) (instanceClassName: double) (serializable:
true)=WIKI!EDouble, org.eclipse.emf.ecore.impl.EDataTypeImpl@57ae58 (name:
EJavaClass) (instanceClassName: java.lang.Class) (serializable:
true)=WIKI!EJavaClass, org.eclipse.emf.ecore.impl.EDataTypeImpl@82674b
(name: EByteArray) (instanceClassName: byte[]) (serializable:
true)=WIKI!EByteArray, org.eclipse.emf.ecore.impl.EDataTypeImpl@578dfb
(name: ETreeIterator) (instanceClassName:
org.eclipse.emf.common.util.TreeIterator) (serializable:
false)=WIKI!ETreeIterator, org.eclipse.emf.ecore.impl.EDataTypeImpl@a415a3
(name: EString) (instanceClassName: java.lang.String) (serializable:
true)=WIKI!EString, org.eclipse.emf.ecore.impl.EDataTypeImpl@fdfc58 (name:
EBigInteger) (instanceClassName: java.math.BigInteger) (serializable:
true)=WIKI!EBigInteger, org.eclipse.emf.ecore.impl.EDataTypeImpl@1c794cc
(name: ECharacterObject) (instanceClassName: java.lang.Character)
(serializable: true)=WIKI!ECharacterObject,
org.eclipse.emf.ecore.impl.EDataTypeImpl@d647d8 (name: EShort)
(instanceClassName: short) (serializable: true)=WIKI!EShort,
org.eclipse.emf.ecore.impl.EDataTypeImpl@adf5be (name: EDate)
(instanceClassName: java.util.Date) (serializable: true)=WIKI!EDate,
org.eclipse.emf.ecore.impl.EDataTypeImpl@15b123b (name: EDiagnosticChain)
(instanceClassName: org.eclipse.emf.common.util.DiagnosticChain)
(serializable: false)=WIKI!EDiagnosticChain,
org.eclipse.emf.ecore.impl.EDataTypeImpl@1128f5a (name: EEnumerator)
(instanceClassName: org.eclipse.emf.common.util.Enumerator) (serializable:
false)=WIKI!EEnumerator, org.eclipse.emf.ecore.impl.EDataTypeImpl@160c4b0
(name: ELongObject) (instanceClassName: java.lang.Long) (serializable:
true)=WIKI!ELongObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@19855ed
(name: EChar) (instanceClassName: char) (serializable: true)=WIKI!EChar,
org.eclipse.emf.ecore.impl.EDataTypeImpl@1ed27e4 (name: EByte)
(instanceClassName: byte) (serializable: true)=WIKI!EByte,
org.eclipse.emf.ecore.impl.EDataTypeImpl@1629e71 (name: EBoolean)
(instanceClassName: boolean) (serializable: true)=WIKI!EBoolean}
Is that correct? I have doubts about the fact that among the ModelElements
don't appear the defined elements in my metamodel WIKI.ecore (like 'Section'
or 'LinkItem').
This happens also with the UML input model.
May this be the reason the transformation doesn't work? (I checked that I
pass as argument to launch() the metamodel that was used when loading the
model)
I thank you in advance,
exquisitus
"Fr
|
|
|
Re: [ATL] problem with programmatically transformation output model [message #42531 is a reply to message #42498] |
Mon, 28 May 2007 15:29 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hello,
It seems that you are trying to use the XML extractor, but that only
works if your target model is the XML metamodel:
http://www.eclipse.org/gmt/am3/zoos/atlanticZoo/#XML
Otherwise, you should simply save your model with the AtlEMFModelHandler
to XMI.
Best regards,
Frédéric Jouault
exquisitus wrote:
> Hi,
>
> if I let run the java project with the ATL transformation, I get
> thefollowing error message:
>
> Exception in thread "main" java.lang.NullPointerException
>
> at
> org.atl.engine.repositories.emf4atl.ASMEMFModel.getElementsB yType(ASMEMFModel.java:178)
>
> at org.atl.engine.vm.nativelib.ASMModel.getElementsByType(ASMMo del.java:53)
>
> at org.atl.engine.extractors.xml.XMLExtractor.extract(XMLExtrac tor.java:45)
>
> at org.atl.engine.extractors.xml.XMLExtractor.extract(XMLExtrac tor.java:32)
>
> at atl.ATLTransformations.extractXMLModelToFile(ATLTransformati ons.java:361)
>
> at atl.ATLTransformations.transformOnetoOther(ATLTransformation s.java:629)
>
> at atl.ATLTransformations.main(ATLTransformations.java:644)
>
>
>
>
> this is my target metamodel (the transformation is UML2WIKI):
> <?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="WIKI"
>
> nsURI="/UML2WikiText/src/atl/metamodels/WIKI/WIKI.ecore" nsPrefix="WIKI">
>
> <eClassifiers xsi:type="ecore:EClass" name="Editable">
>
> <eOperations name="print" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="includedSections"
> upperBound="-1"
>
> eType="#//Section"/>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="items"
> upperBound="-1"
>
> eType="#//Item"/>
>
> </eClassifiers>
>
> <eClassifiers xsi:type="ecore:EClass" name="Page" eSuperTypes="#//Editable">
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="category"
> upperBound="-1"
>
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> </eClassifiers>
>
> <eClassifiers xsi:type="ecore:EClass" name="Section"
> eSuperTypes="#//Editable">
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="supersection"
> eType="#//Section"/>
>
> </eClassifiers>
>
> <eClassifiers xsi:type="ecore:EClass" name="Item">
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="owner"
> eType="#//Editable"/>
>
> </eClassifiers>
>
> <eClassifiers xsi:type="ecore:EClass" name="TextItem" eSuperTypes="#//Item">
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="text"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> </eClassifiers>
>
> <eClassifiers xsi:type="ecore:EClass" name="TemplateItem"
> eSuperTypes="#//Item">
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="attributes"
> upperBound="-1"
>
> eType="#//TemplateAttribute"/>
>
> </eClassifiers>
>
> <eClassifiers xsi:type="ecore:EClass" name="LinkItem" eSuperTypes="#//Item">
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="label"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="locator"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="internal"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
>
> </eClassifiers>
>
> <eClassifiers xsi:type="ecore:EClass" name="TemplateAttribute">
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> </eClassifiers>
>
> </ecore:EPackage>
>
>
>
>
>
>
>
> .... and this are the ModelElements of the corrensponding loaded Metamodel:
> {org.eclipse.emf.ecore.impl.EDataTypeImpl@fa5ff3 (name: EByteObject)
> (instanceClassName: java.lang.Byte) (serializable: true)=WIKI!EByteObject,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@bbfa5c (name: EDoubleObject)
> (instanceClassName: java.lang.Double) (serializable:
> true)=WIKI!EDoubleObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@f449b8
> (name: EBooleanObject) (instanceClassName: java.lang.Boolean) (serializable:
> true)=WIKI!EBooleanObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@1362a63
> (name: EInt) (instanceClassName: int) (serializable: true)=WIKI!EInt,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@fd1810 (name: EShortObject)
> (instanceClassName: java.lang.Short) (serializable: true)=WIKI!EShortObject,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@11b86c7 (name: EResourceSet)
> (instanceClassName: org.eclipse.emf.ecore.resource.ResourceSet)
> (serializable: false)=WIKI!EResourceSet,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@16f70a4 (name: EJavaObject)
> (instanceClassName: java.lang.Object) (serializable:
> false)=WIKI!EJavaObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@10d95cd
> (name: EEList) (instanceClassName: org.eclipse.emf.common.util.EList)
> (serializable: false)=WIKI!EEList,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@1efe475 (name: EFloat)
> (instanceClassName: float) (serializable: true)=WIKI!EFloat,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@eb7331 (name: EFeatureMapEntry)
> (instanceClassName: org.eclipse.emf.ecore.util.FeatureMap$Entry)
> (serializable: true)=WIKI!EFeatureMapEntry,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@f42160 (name: EFeatureMap)
> (instanceClassName: org.eclipse.emf.ecore.util.FeatureMap) (serializable:
> false)=WIKI!EFeatureMap, org.eclipse.emf.ecore.impl.EDataTypeImpl@8a52b6
> (name: EMap) (instanceClassName: java.util.Map) (serializable:
> false)=WIKI!EMap, org.eclipse.emf.ecore.impl.EDataTypeImpl@c0c8b5 (name:
> EBigDecimal) (instanceClassName: java.math.BigDecimal) (serializable:
> true)=WIKI!EBigDecimal, org.eclipse.emf.ecore.impl.EDataTypeImpl@1f8acdc
> (name: ELong) (instanceClassName: long) (serializable: true)=WIKI!ELong,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@dc9065 (name: EFloatObject)
> (instanceClassName: java.lang.Float) (serializable: true)=WIKI!EFloatObject,
> org.eclipse.emf.ecore.impl.EcorePackageImpl@42f352 (name: ecore) (nsURI:
> http://www.eclipse.org/emf/2002/Ecore, nsPrefix: ecore)=WIKI!ecore,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@c67a88 (name: EIntegerObject)
> (instanceClassName: java.lang.Integer) (serializable:
> true)=WIKI!EIntegerObject, org.eclipse.emf.ecore.impl.EPackageImpl@153b2cb
> (name: WIKI) (nsURI: /UML2WikiText/src/atl/metamodels/WIKI/WIKI.ecore,
> nsPrefix: WIKI)=WIKI!WIKI, org.eclipse.emf.ecore.impl.EDataTypeImpl@1f488f1
> (name: EResource) (instanceClassName:
> org.eclipse.emf.ecore.resource.Resource) (serializable:
> false)=WIKI!EResource, org.eclipse.emf.ecore.impl.EDataTypeImpl@1fe4169
> (name: EDouble) (instanceClassName: double) (serializable:
> true)=WIKI!EDouble, org.eclipse.emf.ecore.impl.EDataTypeImpl@57ae58 (name:
> EJavaClass) (instanceClassName: java.lang.Class) (serializable:
> true)=WIKI!EJavaClass, org.eclipse.emf.ecore.impl.EDataTypeImpl@82674b
> (name: EByteArray) (instanceClassName: byte[]) (serializable:
> true)=WIKI!EByteArray, org.eclipse.emf.ecore.impl.EDataTypeImpl@578dfb
> (name: ETreeIterator) (instanceClassName:
> org.eclipse.emf.common.util.TreeIterator) (serializable:
> false)=WIKI!ETreeIterator, org.eclipse.emf.ecore.impl.EDataTypeImpl@a415a3
> (name: EString) (instanceClassName: java.lang.String) (serializable:
> true)=WIKI!EString, org.eclipse.emf.ecore.impl.EDataTypeImpl@fdfc58 (name:
> EBigInteger) (instanceClassName: java.math.BigInteger) (serializable:
> true)=WIKI!EBigInteger, org.eclipse.emf.ecore.impl.EDataTypeImpl@1c794cc
> (name: ECharacterObject) (instanceClassName: java.lang.Character)
> (serializable: true)=WIKI!ECharacterObject,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@d647d8 (name: EShort)
> (instanceClassName: short) (serializable: true)=WIKI!EShort,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@adf5be (name: EDate)
> (instanceClassName: java.util.Date) (serializable: true)=WIKI!EDate,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@15b123b (name: EDiagnosticChain)
> (instanceClassName: org.eclipse.emf.common.util.DiagnosticChain)
> (serializable: false)=WIKI!EDiagnosticChain,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@1128f5a (name: EEnumerator)
> (instanceClassName: org.eclipse.emf.common.util.Enumerator) (serializable:
> false)=WIKI!EEnumerator, org.eclipse.emf.ecore.impl.EDataTypeImpl@160c4b0
> (name: ELongObject) (instanceClassName: java.lang.Long) (serializable:
> true)=WIKI!ELongObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@19855ed
> (name: EChar) (instanceClassName: char) (serializable: true)=WIKI!EChar,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@1ed27e4 (name: EByte)
> (instanceClassName: byte) (serializable: true)=WIKI!EByte,
> org.eclipse.emf.ecore.impl.EDataTypeImpl@1629e71 (name: EBoolean)
> (instanceClassName: boolean) (serializable: true)=WIKI!EBoolean}
>
>
>
> Is that correct? I have doubts about the fact that among the ModelElements
> don't appear the defined elements in my metamodel WIKI.ecore (like 'Section'
> or 'LinkItem').
>
>
>
> This happens also with the UML input model.
>
> May this be the reason the transformation doesn't work? (I checked that I
> pass as argument to launch() the metamodel that was used when loading the
> model)
>
>
>
> I thank you in advance,
>
> exquisitus
>
>
>
>
>
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
> news:f3epi1$6gs$1@build.eclipse.org...
>> Hello,
>>
>> Firstly, The target models are passed as entries of the models argument.
>> There are not "returned" by the launch method, which returns the value of
>> a query (and nothing for transformation modules).
>>
>>
>> Secondly, if you still have a problem: are there any execution errors?
>>
>> If not, you could try to add calls to OclAny.debug(message : String) :
>> OclAny in your code (e.g., in rule guards, even if they have none: use
>> true.debug('matching')) to see if rules are matched.
>>
>> If rules are not matched, then it may mean that you have not passed a
>> source model conforming to your source metamodel.
>> This can happen if you have loaded your metamodel twice, and do not pass
>> as argument to launch() the metamodel that was used when loading the
>> model. Another issue, with EMF, is if you override the package registry
>> entry by loading another (or the same) metamodel with the same nsURI.
>>
>>
>> Best regards,
>>
>> Frédéric Jouault
>>
>>
>> exquisitus wrote:
>>> Hi all,
>>>
>>> I'm trying to perform an ATL transformation programmatically, but the
>>> method:
>>>
>>> AtlLauncher.getDefault().launch(transformation, libs, models, params);
>>>
>>>
>>>
>>> returns an ASMEMFModel with no modelElements. This is driving me crazy,
>>> I'll be very thankful with the one who is able to help me!
>>>
>>> exquisitus
>>>
>>>
>>>
>
|
|
| |
Re: [ATL] problem with programmatically transformation output model [message #42651 is a reply to message #42565] |
Mon, 28 May 2007 16:12 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hello,
The transformOneToOther method seems to transform an XML model/document
into an XML model/document. However, it seems that you do not use the
XML metamodel as target. Therefore, you should probably not use this
method, but use a more generic one that transforms XMI to XMI.
Milan can probably tell you more about this, because I do not know his
code ;-).
Best regards,
Frédéric Jouault
exquisitus wrote:
> Hi Frédéric,
> I'm using the java class ATLTransformation posted by Milan.
> In particular:
>
> public String transformOnetoOther(String InputOneFile, String
> OutputOtherFile) {
>
> // Check is input String well-formed (XML)
>
> if (!checkForWellFormedness(InputOneFile, true)) return new String("Document
> is not well-formed.");
>
>
> ASMModel xmlModel = injectXMLModelFromFile(InputOneFile); // One XML -> XML
> model
>
> ASMModel otherModel = getOtherMMFromOneMM(xmlModel); // One XML -> Other
>
> extractXMLModelToFile(otherModel, OutputOtherFile); // Other -> Other XML
>
> return new String("OK");
>
> } // -- end of transformOnetoOther
>
>
>
> Is it correct?
>
> bye,
>
> exquisitus
>
>
>
>
>
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
> news:f3esha$rs8$1@build.eclipse.org...
>> Hello,
>>
>> It seems that you are trying to use the XML extractor, but that only works
>> if your target model is the XML metamodel:
>> http://www.eclipse.org/gmt/am3/zoos/atlanticZoo/#XML
>>
>> Otherwise, you should simply save your model with the AtlEMFModelHandler
>> to XMI.
>>
>>
>> Best regards,
>>
>> Frédéric Jouault
>>
>>
>> exquisitus wrote:
>>> Hi,
>>>
>>> if I let run the java project with the ATL transformation, I get
>>> thefollowing error message:
>>>
>>> Exception in thread "main" java.lang.NullPointerException
>>>
>>> at
>>> org.atl.engine.repositories.emf4atl.ASMEMFModel.getElementsB yType(ASMEMFModel.java:178)
>>>
>>> at
>>> org.atl.engine.vm.nativelib.ASMModel.getElementsByType(ASMMo del.java:53)
>>>
>>> at
>>> org.atl.engine.extractors.xml.XMLExtractor.extract(XMLExtrac tor.java:45)
>>>
>>> at
>>> org.atl.engine.extractors.xml.XMLExtractor.extract(XMLExtrac tor.java:32)
>>>
>>> at
>>> atl.ATLTransformations.extractXMLModelToFile(ATLTransformati ons.java:361)
>>>
>>> at
>>> atl.ATLTransformations.transformOnetoOther(ATLTransformation s.java:629)
>>>
>>> at atl.ATLTransformations.main(ATLTransformations.java:644)
>>>
>>>
>>>
>>>
>>> this is my target metamodel (the transformation is UML2WIKI):
>>> <?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="WIKI"
>>>
>>> nsURI="/UML2WikiText/src/atl/metamodels/WIKI/WIKI.ecore" nsPrefix="WIKI">
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="Editable">
>>>
>>> <eOperations name="print" eType="ecore:EDataType
>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="includedSections"
>>> upperBound="-1"
>>>
>>> eType="#//Section"/>
>>>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="items"
>>> upperBound="-1"
>>>
>>> eType="#//Item"/>
>>>
>>> </eClassifiers>
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="Page"
>>> eSuperTypes="#//Editable">
>>>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="category"
>>> upperBound="-1"
>>>
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>
>>> </eClassifiers>
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="Section"
>>> eSuperTypes="#//Editable">
>>>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="supersection"
>>> eType="#//Section"/>
>>>
>>> </eClassifiers>
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="Item">
>>>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="owner"
>>> eType="#//Editable"/>
>>>
>>> </eClassifiers>
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="TextItem"
>>> eSuperTypes="#//Item">
>>>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="text"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>
>>> </eClassifiers>
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="TemplateItem"
>>> eSuperTypes="#//Item">
>>>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="attributes"
>>> upperBound="-1"
>>>
>>> eType="#//TemplateAttribute"/>
>>>
>>> </eClassifiers>
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="LinkItem"
>>> eSuperTypes="#//Item">
>>>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="label"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="locator"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="internal"
>>> eType="ecore:EDataType
>>> http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
>>>
>>> </eClassifiers>
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="TemplateAttribute">
>>>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>
>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
>>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>
>>> </eClassifiers>
>>>
>>> </ecore:EPackage>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> .... and this are the ModelElements of the corrensponding loaded
>>> Metamodel:
>>> {org.eclipse.emf.ecore.impl.EDataTypeImpl@fa5ff3 (name: EByteObject)
>>> (instanceClassName: java.lang.Byte) (serializable:
>>> true)=WIKI!EByteObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@bbfa5c
>>> (name: EDoubleObject) (instanceClassName: java.lang.Double)
>>> (serializable: true)=WIKI!EDoubleObject,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@f449b8 (name: EBooleanObject)
>>> (instanceClassName: java.lang.Boolean) (serializable:
>>> true)=WIKI!EBooleanObject,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1362a63 (name: EInt)
>>> (instanceClassName: int) (serializable: true)=WIKI!EInt,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@fd1810 (name: EShortObject)
>>> (instanceClassName: java.lang.Short) (serializable:
>>> true)=WIKI!EShortObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@11b86c7
>>> (name: EResourceSet) (instanceClassName:
>>> org.eclipse.emf.ecore.resource.ResourceSet) (serializable:
>>> false)=WIKI!EResourceSet,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@16f70a4 (name: EJavaObject)
>>> (instanceClassName: java.lang.Object) (serializable:
>>> false)=WIKI!EJavaObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@10d95cd
>>> (name: EEList) (instanceClassName: org.eclipse.emf.common.util.EList)
>>> (serializable: false)=WIKI!EEList,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1efe475 (name: EFloat)
>>> (instanceClassName: float) (serializable: true)=WIKI!EFloat,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@eb7331 (name: EFeatureMapEntry)
>>> (instanceClassName: org.eclipse.emf.ecore.util.FeatureMap$Entry)
>>> (serializable: true)=WIKI!EFeatureMapEntry,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@f42160 (name: EFeatureMap)
>>> (instanceClassName: org.eclipse.emf.ecore.util.FeatureMap) (serializable:
>>> false)=WIKI!EFeatureMap, org.eclipse.emf.ecore.impl.EDataTypeImpl@8a52b6
>>> (name: EMap) (instanceClassName: java.util.Map) (serializable:
>>> false)=WIKI!EMap, org.eclipse.emf.ecore.impl.EDataTypeImpl@c0c8b5 (name:
>>> EBigDecimal) (instanceClassName: java.math.BigDecimal) (serializable:
>>> true)=WIKI!EBigDecimal, org.eclipse.emf.ecore.impl.EDataTypeImpl@1f8acdc
>>> (name: ELong) (instanceClassName: long) (serializable: true)=WIKI!ELong,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@dc9065 (name: EFloatObject)
>>> (instanceClassName: java.lang.Float) (serializable:
>>> true)=WIKI!EFloatObject,
>>> org.eclipse.emf.ecore.impl.EcorePackageImpl@42f352 (name: ecore) (nsURI:
>>> http://www.eclipse.org/emf/2002/Ecore, nsPrefix: ecore)=WIKI!ecore,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@c67a88 (name: EIntegerObject)
>>> (instanceClassName: java.lang.Integer) (serializable:
>>> true)=WIKI!EIntegerObject,
>>> org.eclipse.emf.ecore.impl.EPackageImpl@153b2cb (name: WIKI) (nsURI:
>>> /UML2WikiText/src/atl/metamodels/WIKI/WIKI.ecore, nsPrefix:
>>> WIKI)=WIKI!WIKI, org.eclipse.emf.ecore.impl.EDataTypeImpl@1f488f1 (name:
>>> EResource) (instanceClassName: org.eclipse.emf.ecore.resource.Resource)
>>> (serializable: false)=WIKI!EResource,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1fe4169 (name: EDouble)
>>> (instanceClassName: double) (serializable: true)=WIKI!EDouble,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@57ae58 (name: EJavaClass)
>>> (instanceClassName: java.lang.Class) (serializable:
>>> true)=WIKI!EJavaClass, org.eclipse.emf.ecore.impl.EDataTypeImpl@82674b
>>> (name: EByteArray) (instanceClassName: byte[]) (serializable:
>>> true)=WIKI!EByteArray, org.eclipse.emf.ecore.impl.EDataTypeImpl@578dfb
>>> (name: ETreeIterator) (instanceClassName:
>>> org.eclipse.emf.common.util.TreeIterator) (serializable:
>>> false)=WIKI!ETreeIterator,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@a415a3 (name: EString)
>>> (instanceClassName: java.lang.String) (serializable: true)=WIKI!EString,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@fdfc58 (name: EBigInteger)
>>> (instanceClassName: java.math.BigInteger) (serializable:
>>> true)=WIKI!EBigInteger, org.eclipse.emf.ecore.impl.EDataTypeImpl@1c794cc
>>> (name: ECharacterObject) (instanceClassName: java.lang.Character)
>>> (serializable: true)=WIKI!ECharacterObject,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@d647d8 (name: EShort)
>>> (instanceClassName: short) (serializable: true)=WIKI!EShort,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@adf5be (name: EDate)
>>> (instanceClassName: java.util.Date) (serializable: true)=WIKI!EDate,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@15b123b (name: EDiagnosticChain)
>>> (instanceClassName: org.eclipse.emf.common.util.DiagnosticChain)
>>> (serializable: false)=WIKI!EDiagnosticChain,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1128f5a (name: EEnumerator)
>>> (instanceClassName: org.eclipse.emf.common.util.Enumerator)
>>> (serializable: false)=WIKI!EEnumerator,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@160c4b0 (name: ELongObject)
>>> (instanceClassName: java.lang.Long) (serializable:
>>> true)=WIKI!ELongObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@19855ed
>>> (name: EChar) (instanceClassName: char) (serializable: true)=WIKI!EChar,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1ed27e4 (name: EByte)
>>> (instanceClassName: byte) (serializable: true)=WIKI!EByte,
>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1629e71 (name: EBoolean)
>>> (instanceClassName: boolean) (serializable: true)=WIKI!EBoolean}
>>>
>>>
>>>
>>> Is that correct? I have doubts about the fact that among the
>>> ModelElements don't appear the defined elements in my metamodel
>>> WIKI.ecore (like 'Section' or 'LinkItem').
>>>
>>>
>>>
>>> This happens also with the UML input model.
>>>
>>> May this be the reason the transformation doesn't work? (I checked that I
>>> pass as argument to launch() the metamodel that was used when loading the
>>> model)
>>>
>>>
>>>
>>> I thank you in advance,
>>>
>>> exquisitus
>>>
>>>
>>>
>>>
>>>
>>> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
>>> news:f3epi1$6gs$1@build.eclipse.org...
>>>> Hello,
>>>>
>>>> Firstly, The target models are passed as entries of the models argument.
>>>> There are not "returned" by the launch method, which returns the value
>>>> of a query (and nothing for transformation modules).
>>>>
>>>>
>>>> Secondly, if you still have a problem: are there any execution errors?
>>>>
>>>> If not, you could try to add calls to OclAny.debug(message : String) :
>>>> OclAny in your code (e.g., in rule guards, even if they have none: use
>>>> true.debug('matching')) to see if rules are matched.
>>>>
>>>> If rules are not matched, then it may mean that you have not passed a
>>>> source model conforming to your source metamodel.
>>>> This can happen if you have loaded your metamodel twice, and do not pass
>>>> as argument to launch() the metamodel that was used when loading the
>>>> model. Another issue, with EMF, is if you override the package registry
>>>> entry by loading another (or the same) metamodel with the same nsURI.
>>>>
>>>>
>>>> Best regards,
>>>>
>>>> Frédéric Jouault
>>>>
>>>>
>>>> exquisitus wrote:
>>>>> Hi all,
>>>>>
>>>>> I'm trying to perform an ATL transformation programmatically, but the
>>>>> method:
>>>>>
>>>>> AtlLauncher.getDefault().launch(transformation, libs, models, params);
>>>>>
>>>>>
>>>>>
>>>>> returns an ASMEMFModel with no modelElements. This is driving me
>>>>> crazy, I'll be very thankful with the one who is able to help me!
>>>>>
>>>>> exquisitus
>>>>>
>>>>>
>>>>>
>
>
|
|
| |
Re: [ATL] problem with programmatically transformation output model [message #43726 is a reply to message #43363] |
Fri, 01 June 2007 10:01 |
Eclipse User |
|
|
|
Originally posted by: milan.milanovic.org
Hi,
well, this error is not related to my class ATLTransformations.
I far as I can see this is again related to versions of Ecore for
the UML 2 metamodel which you use in this case and when you have
created that metamodel.
--
Best regards, Milan Milanovic
exquisitus wrote:
> Hi Frédéric,
> I'm trying to do as you told me. I now use the method:
> public ASMModel loadEMFModelFromFile(String file) {
> // Initialize EMF
> initEMF();
> InputStream in = null;
> try {
> // Create input stream from file
> in = new FileInputStream(file);
> } catch(FileNotFoundException e) {
> System.out.println("Error: Input file is not found!");
> return null;
> }
> return emfamh.loadModel(file, oneMM_EMF, in);
> to load my input model (an UML model). But loading is not successful, the
> error trace is the following:
> java.lang.IllegalArgumentException: The class 'EModelElement' is not a valid
> classifier
> at
> org.eclipse.emf.ecore.impl.EcoreFactoryImpl.create(EcoreFact oryImpl.java:102)
> at org.eclipse.emf.ecore.impl.EFactoryImpl.create(EFactoryImpl. java:231)
> at
>
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.createObject(XM LHelperImpl.java:797)
> at
>
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.createObject(XM LHelperImpl.java:832)
> at
>
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFa ctory(XMLHandler.java:1933)
> at
>
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1168)
> at
>
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1239)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:877)
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:78)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:860)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:627)
> at
>
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
> Source)
> at
>
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator. startElement(Unknown
> Source)
> at
>
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
> Source)
> at
>
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerIm pl$ContentDispatcher.scanRootElementHook(Unknown
> Source)
> at
>
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
> at
>
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
> Source)
> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
> Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:179)
> at
>
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:179)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1094)
> at
>
org.atl.engine.repositories.emf4atl.ASMEMFModel.loadASMEMFMo del(ASMEMFModel.java:341)
> at
>
org.atl.eclipse.engine.AtlEMFModelHandler.loadModel(AtlEMFMo delHandler.java:110)
> at atl.ATLTransformations.loadEMFModelFromFile(ATLTransformatio ns.java:613)
> at
>
atl.ATLTransformations.directlyTransformOnetoOther(ATLTransf ormations.java:732)
> at atl.ATLTransformations.main(ATLTransformations.java:749)
> Exception in thread "main" java.lang.NullPointerException
> at org.netbeans.lib.jmi.xmi.WriterBase.findNamespaces(WriterBas e.java:284)
> at org.netbeans.lib.jmi.xmi.WriterBase.write(WriterBase.java:22 3)
> at org.netbeans.lib.jmi.xmi.WriterBase.write(WriterBase.java:19 5)
> at org.netbeans.lib.jmi.xmi.DelegatingWriter.write(DelegatingWr iter.java:45)
> at org.netbeans.api.xmi.XMIWriter.write(XMIWriter.java:77)
> at org.netbeans.lib.jmi.xmi.XMIWriterImpl.write(XMIWriterImpl.j ava:26)
> at atl.ATLTransformations.saveEMFModelToFile(ATLTransformations .java:635)
> at
>
atl.ATLTransformations.directlyTransformOnetoOther(ATLTransf ormations.java:734)
> at atl.ATLTransformations.main(ATLTransformations.java:749)
> Note that EModelElement is defined inside the metametamodel ecore.ecore.
> Can you tell me how can I load an input model directly, without any XML
> injector?
> thanks,
> exquisitus
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
> news:f3ev1m$9q3$1@build.eclipse.org...
>> Hello,
>>
>> The transformOneToOther method seems to transform an XML model/document
>> into an XML model/document. However, it seems that you do not use the XML
>> metamodel as target. Therefore, you should probably not use this method,
>> but use a more generic one that transforms XMI to XMI.
>>
>> Milan can probably tell you more about this, because I do not know his
>> code ;-).
>>
>>
>> Best regards,
>>
>> Frédéric Jouault
>>
>>
>> exquisitus wrote:
>>> Hi Frédéric,
>>> I'm using the java class ATLTransformation posted by Milan.
>>> In particular:
>>>
>>> public String transformOnetoOther(String InputOneFile, String
>>> OutputOtherFile) {
>>>
>>> // Check is input String well-formed (XML)
>>>
>>> if (!checkForWellFormedness(InputOneFile, true)) return new
>>> String("Document is not well-formed.");
>>>
>>>
>>> ASMModel xmlModel = injectXMLModelFromFile(InputOneFile); // One XML ->
>>> XML model
>>>
>>> ASMModel otherModel = getOtherMMFromOneMM(xmlModel); // One XML -> Other
>>>
>>> extractXMLModelToFile(otherModel, OutputOtherFile); // Other -> Other XML
>>>
>>> return new String("OK");
>>>
>>> } // -- end of transformOnetoOther
>>>
>>>
>>>
>>> Is it correct?
>>>
>>> bye,
>>>
>>> exquisitus
>>>
>>>
>>>
>>>
>>>
>>> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
>>> news:f3esha$rs8$1@build.eclipse.org...
>>>> Hello,
>>>>
>>>> It seems that you are trying to use the XML extractor, but that only
>>>> works if your target model is the XML metamodel:
>>>> http://www.eclipse.org/gmt/am3/zoos/atlanticZoo/#XML
>>>>
>>>> Otherwise, you should simply save your model with the AtlEMFModelHandler
>>>> to XMI.
>>>>
>>>>
>>>> Best regards,
>>>>
>>>> Frédéric Jouault
>>>>
>>>>
>>>> exquisitus wrote:
>>>>> Hi,
>>>>>
>>>>> if I let run the java project with the ATL transformation, I get
>>>>> thefollowing error message:
>>>>>
>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>
>>>>> at
>>>>>
org.atl.engine.repositories.emf4atl.ASMEMFModel.getElementsB yType(ASMEMFModel.java:178)
>>>>>
>>>>> at
>>>>> org.atl.engine.vm.nativelib.ASMModel.getElementsByType(ASMMo del.java:53)
>>>>>
>>>>> at
>>>>> org.atl.engine.extractors.xml.XMLExtractor.extract(XMLExtrac tor.java:45)
>>>>>
>>>>> at
>>>>> org.atl.engine.extractors.xml.XMLExtractor.extract(XMLExtrac tor.java:32)
>>>>>
>>>>> at
>>>>> atl.ATLTransformations.extractXMLModelToFile(ATLTransformati ons.java:361)
>>>>>
>>>>> at
>>>>> atl.ATLTransformations.transformOnetoOther(ATLTransformation s.java:629)
>>>>>
>>>>> at atl.ATLTransformations.main(ATLTransformations.java:644)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> this is my target metamodel (the transformation is UML2WIKI):
>>>>> <?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="WIKI"
>>>>>
>>>>> nsURI="/UML2WikiText/src/atl/metamodels/WIKI/WIKI.ecore"
>>>>> nsPrefix="WIKI">
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Editable">
>>>>>
>>>>> <eOperations name="print" eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference"
>>>>> name="includedSections" upperBound="-1"
>>>>>
>>>>> eType="#//Section"/>
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="items"
>>>>> upperBound="-1"
>>>>>
>>>>> eType="#//Item"/>
>>>>>
>>>>> </eClassifiers>
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Page"
>>>>> eSuperTypes="#//Editable">
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="category"
>>>>> upperBound="-1"
>>>>>
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>>
>>>>> </eClassifiers>
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Section"
>>>>> eSuperTypes="#//Editable">
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="supersection"
>>>>> eType="#//Section"/>
>>>>>
>>>>> </eClassifiers>
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="Item">
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="owner"
>>>>> eType="#//Editable"/>
>>>>>
>>>>> </eClassifiers>
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="TextItem"
>>>>> eSuperTypes="#//Item">
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="text"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>>
>>>>> </eClassifiers>
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="TemplateItem"
>>>>> eSuperTypes="#//Item">
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EReference" name="attributes"
>>>>> upperBound="-1"
>>>>>
>>>>> eType="#//TemplateAttribute"/>
>>>>>
>>>>> </eClassifiers>
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="LinkItem"
>>>>> eSuperTypes="#//Item">
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="label"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="locator"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="internal"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
>>>>>
>>>>> </eClassifiers>
>>>>>
>>>>> <eClassifiers xsi:type="ecore:EClass" name="TemplateAttribute">
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>>
>>>>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"
>>>>> eType="ecore:EDataType
>>>>> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>>>>>
>>>>> </eClassifiers>
>>>>>
>>>>> </ecore:EPackage>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> .... and this are the ModelElements of the corrensponding loaded
>>>>> Metamodel:
>>>>> {org.eclipse.emf.ecore.impl.EDataTypeImpl@fa5ff3 (name: EByteObject)
>>>>> (instanceClassName: java.lang.Byte) (serializable:
>>>>> true)=WIKI!EByteObject, org.eclipse.emf.ecore.impl.EDataTypeImpl@bbfa5c
>>>>> (name: EDoubleObject) (instanceClassName: java.lang.Double)
>>>>> (serializable: true)=WIKI!EDoubleObject,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@f449b8 (name: EBooleanObject)
>>>>> (instanceClassName: java.lang.Boolean) (serializable:
>>>>> true)=WIKI!EBooleanObject,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1362a63 (name: EInt)
>>>>> (instanceClassName: int) (serializable: true)=WIKI!EInt,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@fd1810 (name: EShortObject)
>>>>> (instanceClassName: java.lang.Short) (serializable:
>>>>> true)=WIKI!EShortObject,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@11b86c7 (name: EResourceSet)
>>>>> (instanceClassName: org.eclipse.emf.ecore.resource.ResourceSet)
>>>>> (serializable: false)=WIKI!EResourceSet,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@16f70a4 (name: EJavaObject)
>>>>> (instanceClassName: java.lang.Object) (serializable:
>>>>> false)=WIKI!EJavaObject,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@10d95cd (name: EEList)
>>>>> (instanceClassName: org.eclipse.emf.common.util.EList) (serializable:
>>>>> false)=WIKI!EEList, org.eclipse.emf.ecore.impl.EDataTypeImpl@1efe475
>>>>> (name: EFloat) (instanceClassName: float) (serializable:
>>>>> true)=WIKI!EFloat, org.eclipse.emf.ecore.impl.EDataTypeImpl@eb7331
>>>>> (name: EFeatureMapEntry) (instanceClassName:
>>>>> org.eclipse.emf.ecore.util.FeatureMap$Entry) (serializable:
>>>>> true)=WIKI!EFeatureMapEntry,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@f42160 (name: EFeatureMap)
>>>>> (instanceClassName: org.eclipse.emf.ecore.util.FeatureMap)
>>>>> (serializable: false)=WIKI!EFeatureMap,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@8a52b6 (name: EMap)
>>>>> (instanceClassName: java.util.Map) (serializable: false)=WIKI!EMap,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@c0c8b5 (name: EBigDecimal)
>>>>> (instanceClassName: java.math.BigDecimal) (serializable:
>>>>> true)=WIKI!EBigDecimal,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1f8acdc (name: ELong)
>>>>> (instanceClassName: long) (serializable: true)=WIKI!ELong,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@dc9065 (name: EFloatObject)
>>>>> (instanceClassName: java.lang.Float) (serializable:
>>>>> true)=WIKI!EFloatObject,
>>>>> org.eclipse.emf.ecore.impl.EcorePackageImpl@42f352 (name: ecore)
>>>>> (nsURI: http://www.eclipse.org/emf/2002/Ecore, nsPrefix:
>>>>> ecore)=WIKI!ecore, org.eclipse.emf.ecore.impl.EDataTypeImpl@c67a88
>>>>> (name: EIntegerObject) (instanceClassName: java.lang.Integer)
>>>>> (serializable: true)=WIKI!EIntegerObject,
>>>>> org.eclipse.emf.ecore.impl.EPackageImpl@153b2cb (name: WIKI) (nsURI:
>>>>> /UML2WikiText/src/atl/metamodels/WIKI/WIKI.ecore, nsPrefix:
>>>>> WIKI)=WIKI!WIKI, org.eclipse.emf.ecore.impl.EDataTypeImpl@1f488f1
>>>>> (name: EResource) (instanceClassName:
>>>>> org.eclipse.emf.ecore.resource.Resource) (serializable:
>>>>> false)=WIKI!EResource, org.eclipse.emf.ecore.impl.EDataTypeImpl@1fe4169
>>>>> (name: EDouble) (instanceClassName: double) (serializable:
>>>>> true)=WIKI!EDouble, org.eclipse.emf.ecore.impl.EDataTypeImpl@57ae58
>>>>> (name: EJavaClass) (instanceClassName: java.lang.Class) (serializable:
>>>>> true)=WIKI!EJavaClass, org.eclipse.emf.ecore.impl.EDataTypeImpl@82674b
>>>>> (name: EByteArray) (instanceClassName: byte[]) (serializable:
>>>>> true)=WIKI!EByteArray, org.eclipse.emf.ecore.impl.EDataTypeImpl@578dfb
>>>>> (name: ETreeIterator) (instanceClassName:
>>>>> org.eclipse.emf.common.util.TreeIterator) (serializable:
>>>>> false)=WIKI!ETreeIterator,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@a415a3 (name: EString)
>>>>> (instanceClassName: java.lang.String) (serializable:
>>>>> true)=WIKI!EString, org.eclipse.emf.ecore.impl.EDataTypeImpl@fdfc58
>>>>> (name: EBigInteger) (instanceClassName: java.math.BigInteger)
>>>>> (serializable: true)=WIKI!EBigInteger,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1c794cc (name:
>>>>> ECharacterObject) (instanceClassName: java.lang.Character)
>>>>> (serializable: true)=WIKI!ECharacterObject,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@d647d8 (name: EShort)
>>>>> (instanceClassName: short) (serializable: true)=WIKI!EShort,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@adf5be (name: EDate)
>>>>> (instanceClassName: java.util.Date) (serializable: true)=WIKI!EDate,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@15b123b (name:
>>>>> EDiagnosticChain) (instanceClassName:
>>>>> org.eclipse.emf.common.util.DiagnosticChain) (serializable:
>>>>> false)=WIKI!EDiagnosticChain,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1128f5a (name: EEnumerator)
>>>>> (instanceClassName: org.eclipse.emf.common.util.Enumerator)
>>>>> (serializable: false)=WIKI!EEnumerator,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@160c4b0 (name: ELongObject)
>>>>> (instanceClassName: java.lang.Long) (serializable:
>>>>> true)=WIKI!ELongObject,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@19855ed (name: EChar)
>>>>> (instanceClassName: char) (serializable: true)=WIKI!EChar,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1ed27e4 (name: EByte)
>>>>> (instanceClassName: byte) (serializable: true)=WIKI!EByte,
>>>>> org.eclipse.emf.ecore.impl.EDataTypeImpl@1629e71 (name: EBoolean)
>>>>> (instanceClassName: boolean) (serializable: true)=WIKI!EBoolean}
>>>>>
>>>>>
>>>>>
>>>>> Is that correct? I have doubts about the fact that among the
>>>>> ModelElements don't appear the defined elements in my metamodel
>>>>> WIKI.ecore (like 'Section' or 'LinkItem').
>>>>>
>>>>>
>>>>>
>>>>> This happens also with the UML input model.
>>>>>
>>>>> May this be the reason the transformation doesn't work? (I checked that
>>>>> I pass as argument to launch() the metamodel that was used when loading
>>>>> the model)
>>>>>
>>>>>
>>>>>
>>>>> I thank you in advance,
>>>>>
>>>>> exquisitus
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
>>>>> news:f3epi1$6gs$1@build.eclipse.org...
>>>>>> Hello,
>>>>>>
>>>>>> Firstly, The target models are passed as entries of the models
>>>>>> argument.
>>>>>> There are not "returned" by the launch method, which returns the value
>>>>>> of a query (and nothing for transformation modules).
>>>>>>
>>>>>>
>>>>>> Secondly, if you still have a problem: are there any execution errors?
>>>>>>
>>>>>> If not, you could try to add calls to OclAny.debug(message : String) :
>>>>>> OclAny in your code (e.g., in rule guards, even if they have none: use
>>>>>> true.debug('matching')) to see if rules are matched.
>>>>>>
>>>>>> If rules are not matched, then it may mean that you have not passed a
>>>>>> source model conforming to your source metamodel.
>>>>>> This can happen if you have loaded your metamodel twice, and do not
>>>>>> pass as argument to launch() the metamodel that was used when loading
>>>>>> the model. Another issue, with EMF, is if you override the package
>>>>>> registry entry by loading another (or the same) metamodel with the
>>>>>> same nsURI.
>>>>>>
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Frédéric Jouault
>>>>>>
>>>>>>
>>>>>> exquisitus wrote:
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I'm trying to perform an ATL transformation programmatically, but the
>>>>>>> method:
>>>>>>>
>>>>>>> AtlLauncher.getDefault().launch(transformation, libs, models,
>>>>>>> params);
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> returns an ASMEMFModel with no modelElements. This is driving me
>>>>>>> crazy, I'll be very thankful with the one who is able to help me!
>>>>>>>
>>>>>>> exquisitus
>>>>>>>
>>>>>>>
>>>>>>>
>>>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 08:50:40 GMT 2024
Powered by FUDForum. Page generated in 0.03971 seconds
|