Hello,
I created a simple Ecore-based metamodel.
Then I created a simple model from it.
Now I'm trying to implement a simple workflow which just checks the model.
Running the workflow results in EvaluationException in CheckComponent:
Here is my simple Ecore-based metamodel stored in data.ecore file:
<?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="data"
nsURI="http://www.soptim.de/datamodel" nsPrefix="data">
<eClassifiers xsi:type="ecore:EClass" name="DataModel">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="entity" upperBound="-1"
eType="#//Entity" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Entity">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Something that has a distinct, separate existence."/>
</eAnnotations>
<eAnnotations source="http://www.eclipse.org/2007/OCL">
<details key="derive" value="let topics : Set(mindmap::Topic) = self.elements->select(oclIsKindOf(mindmap::Topic))->collect(oclAsType(mindmap::Topic))->asSet() in topics->symmetricDifference(topics.subtopics->
asSet())"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="attribute" lowerBound="1"
upperBound="-1" eType="#//Attribute" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="reference" upperBound="-1"
eType="#//EntityReference" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Attribute">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="EntityReference">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="toMany" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" lowerBound="1"
eType="#//Entity"/>
</eClassifiers>
</ecore:EPackage>
Here is the model stored in booklib.data file:
<?xml version="1.0" encoding="UTF-8"?>
<data:DataModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:data="http://www.soptim.de/datamodel">
<entity name="Author">
<attribute name="firstName" type="String"/>
<attribute name="secondName" type="String"/>
</entity>
<entity name="Book">
<attribute name="title" type="String"/>
<reference name="authors" toMany="true" target="//@entity.0"/>
</entity>
</data:DataModel>
Here is the Check file stored in file booklib.chk:
import data;
context Entity ERROR
"Names have to be more than 3 characters long." :
name.length > 3;
And here is the workflow stored in file workflow.mwe:
<workflow>
<property file="workflow.properties"/>
<component id="xmiParser" class="org.eclipse.xtend.typesystem.emf.XmiReader">
<modelFile value="${modelFile}"/>
<metaModelPackage value="data.DataPackage"/>
<outputSlot value="model"/>
<firstElementOnly value="true"/>
</component>
<component class="org.eclipse.xtend.check.CheckComponent">
<metaModel id="model" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel"/>
<checkFile value="booklib" /> <!-- Without .chk extension -->
<emfAllChildrenSlot value="model" />
</component>
</workflow>
The workflow.properties file contains:
modelFile=booklib.data
srcGenPath=src-gen
fileEncoding=ISO-8859-1
Here is the output of the workflow:
04.03.2010 22:58:12 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: --------------------------------------------------------------------------------------
04.03.2010 22:58:12 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: EMF Modeling Workflow Engine 0.7.2, Build v200908120417
04.03.2010 22:58:12 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: (c) 2005-2009 openarchitectureware.org and contributors
04.03.2010 22:58:12 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: --------------------------------------------------------------------------------------
04.03.2010 22:58:12 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: running workflow: D:/eclipse-modeling-workspace/de.soptim.datamodel.generator/src/workflow.mwe
04.03.2010 22:58:12 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO:
04.03.2010 22:58:13 org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: XmiReader(xmiParser): file 'booklib.data' => slot 'model'
04.03.2010 22:58:13 org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: CheckComponent: slot model check file(s): booklib
04.03.2010 22:58:13 org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowComponent invokeInternal
SCHWERWIEGEND: Error in Component of type org.eclipse.xtend.check.CheckComponent:
EvaluationException : Type not found : Entity
booklib.chk[249,94] on line 9 'Entity "Names have to be more than 10 characters long."'
04.03.2010 22:58:13 org.eclipse.emf.mwe.core.WorkflowRunner executeWorkflow
SCHWERWIEGEND: Workflow interrupted. Reason: Type not found : Entity
I assume, there are some issues with importing of the metamodel or visibility of the metamodel within workflow.
Please, give me a hint.