Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Workflow Problem
Workflow Problem [message #51242] Sun, 14 June 2009 12:21 Go to next message
Eclipse UserFriend
Hello,

I am relatively new to xText and began with the oAW release, and have
migrated my code to tmf now. My grammar seems fine but when I generate a
concrete model I get a workflow error.

What could be the problem? Thanks in advance for any tips.

My grammar:

grammar org.xtext.example.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/MyDsl"


//Our ORM2 Model
Model:
(elements+=Element)*;

//Elements can be Objects or Predicates
Element:
Object_Type | Predicate;

//Objects are Entities or Values
Object_Type:
Entity_Type | Value_Type (IsPrimitive?="subtype"
supertype=[Object_Type])?;

//Entities
Entity_Type:
"entity" name=ID (IsPrimitive?="subtype" supertype=[Object_Type])? "{"
(IsNested?="nests" Predicate=[Predicate])?
("definition" def=STRING)?
("subconstr" sub=STRING)?
("role" role=STRING Predicate=[Predicate])*
"}";

//Value is a DataType or not
Value_Type:
("value" type=[DataType|ID] name=ID) | DataType (IsPrimitive?="subtype")?;

//DataTypes includes Integer, String, Boolean...
DataType:
"datatype" name=ID;


//Predicate
Predicate:
"predicate" name=ID "{"
"part" (Participants+=Participant)+
(Arity=Arity ";")?
(IsDerived?="derived" ";")?
"}";

//Participants in the predicate
Participant:
type=[Object_Type];

//Arity
Arity:
"arity" name=INT;


My test model:

entity student{}

entity person{}

entity professor{
nests teaches
definition "he teaches"
subconst "alot"
}

entity teacher subtype person{}

predicate teaches {
part professor student
arity 3;
derived;
}


I get the error:

2016 [main] ERROR org.eclipse.xpand2.Generator - Error in
Component of type org.eclipse.xpand2.Generator:
EvaluationException : Couldn't find property 'elements' for type
myDsl::Model
templates::Template.xpt[110,13] on line 8 'this.elements'
[23,42] on line 1 'EXPAND templates::Template::main FOR model'

2016 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - Workflow
interrupted. Reason: Couldn't find property 'elements' for type
myDsl::Model
2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find property 'elements' for type myDsl::Model(Element: this.elements;
Reported by: Generator: generating 'templates::Template::main FOR model'
=> [])
2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find property 'elements' for type myDsl::Model(Element:
org.eclipse.internal.xpand2.ast.ForEachStatement@1493102; Reported by:
Generator: generating 'templates::Template::main FOR model' => [])
2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find property 'elements' for type myDsl::Model(Element:
org.eclipse.internal.xpand2.ast.FileStatement@30ae41; Reported by:
Generator: generating 'templates::Template::main FOR model' => [])
2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find property 'elements' for type myDsl::Model(Element: main : Model;
Reported by: Generator: generating 'templates::Template::main FOR model'
=> [])
2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find property 'elements' for type myDsl::Model(Element: EXPAND
templates::Template::main FOR model; Reported by: Generator: generating
'templates::Template::main FOR model' => [])
Re: Workflow Problem [message #51322 is a reply to message #51242] Sun, 14 June 2009 15:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: peter.friese.itemis.com

Aurel,

could you also please post your template, as this seems to be the place
the error ocurrs?

Cheers,
Peter

On 2009-06-14 18:21:19 +0200, aurel_ganga@yahoo.com (Aurel Ganga) said:

> Hello,
>
> I am relatively new to xText and began with the oAW release, and have
> migrated my code to tmf now. My grammar seems fine but when I generate
> a concrete model I get a workflow error.
> What could be the problem? Thanks in advance for any tips.
>
> My grammar:
>
> grammar org.xtext.example.MyDsl with org.eclipse.xtext.common.Terminals
>
> generate myDsl "http://www.xtext.org/example/MyDsl"
>
>
> //Our ORM2 Model
> Model:
> (elements+=Element)*;
> //Elements can be Objects or Predicates
> Element:
> Object_Type | Predicate;
> //Objects are Entities or Values
> Object_Type:
> Entity_Type | Value_Type (IsPrimitive?="subtype" supertype=[Object_Type])?;
> //Entities
> Entity_Type:
> "entity" name=ID (IsPrimitive?="subtype" supertype=[Object_Type])?
> "{" (IsNested?="nests" Predicate=[Predicate])? ("definition"
> def=STRING)?
> ("subconstr" sub=STRING)?
> ("role" role=STRING Predicate=[Predicate])* "}";
>
> //Value is a DataType or not
> Value_Type:
> ("value" type=[DataType|ID] name=ID) | DataType (IsPrimitive?="subtype")?;
>
> //DataTypes includes Integer, String, Boolean...
> DataType:
> "datatype" name=ID;
>
>
> //Predicate Predicate:
> "predicate" name=ID "{"
> "part" (Participants+=Participant)+
> (Arity=Arity ";")? (IsDerived?="derived" ";")?
> "}";
>
> //Participants in the predicate
> Participant:
> type=[Object_Type];
>
> //Arity Arity:
> "arity" name=INT;
>
>
> My test model:
>
> entity student{}
>
> entity person{}
>
> entity professor{
> nests teaches
> definition "he teaches"
> subconst "alot"
> }
>
> entity teacher subtype person{}
>
> predicate teaches {
> part professor student
> arity 3;
> derived;
> }
>
>
> I get the error:
>
> 2016 [main] ERROR org.eclipse.xpand2.Generator - Error in
> Component of type org.eclipse.xpand2.Generator: EvaluationException :
> Couldn't find property 'elements' for type myDsl::Model
> templates::Template.xpt[110,13] on line 8 'this.elements' [23,42]
> on line 1 'EXPAND templates::Template::main FOR model'
>
> 2016 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - Workflow
> interrupted. Reason: Couldn't find property 'elements' for type
> myDsl::Model
> 2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
> Couldn't find property 'elements' for type myDsl::Model(Element:
> this.elements; Reported by: Generator: generating
> 'templates::Template::main FOR model' => [])
> 2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
> Couldn't find property 'elements' for type myDsl::Model(Element:
> org.eclipse.internal.xpand2.ast.ForEachStatement@1493102; Reported by:
> Generator: generating 'templates::Template::main FOR model' => [])
> 2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
> Couldn't find property 'elements' for type myDsl::Model(Element:
> org.eclipse.internal.xpand2.ast.FileStatement@30ae41; Reported by:
> Generator: generating 'templates::Template::main FOR model' => [])
> 2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
> Couldn't find property 'elements' for type myDsl::Model(Element: main :
> Model; Reported by: Generator: generating 'templates::Template::main
> FOR model' => [])
> 2032 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
> Couldn't find property 'elements' for type myDsl::Model(Element: EXPAND
> templates::Template::main FOR model; Reported by: Generator: generating
> 'templates::Template::main FOR model' => [])
Re: Workflow Problem [message #51379 is a reply to message #51242] Sun, 14 June 2009 16:49 Go to previous messageGo to next message
Eclipse UserFriend
My Template is the default one, havent changed anything.

«IMPORT myDsl»;

«EXTENSION templates::Extensions»

«DEFINE main FOR Model»
«FILE "output.txt"-»
«FOREACH this.elements AS e»
«e.name» («e.metaType») «e.referencedBy()»
«ENDFOREACH-»
«ENDFILE»
«ENDDEFINE»

My Extensions file is also almost the default, but with a part commented
out because it gave another error:

import myDsl;

//referencedBy(Class this) :
// this.eRootContainer.eAllContents.typeSelect(Class).select(e| e.references
== this).name.toString(",");


After some minor code optimization and tampering, the error is:

3016 [main] ERROR org.eclipse.xpand2.Generator - Error in
Component of type org.eclipse.xpand2.Generator:
EvaluationException : Couldn't find operation 'referencedBy()' for
myDsl::Entity_Type.
templates::Template.xpt[158,16] on line 9 'e.referencedBy()'
[23,42] on line 1 'EXPAND templates::Template::main FOR model'

3016 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - Workflow
interrupted. Reason: Couldn't find operation 'referencedBy()' for
myDsl::Entity_Type.
3016 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find operation 'referencedBy()' for myDsl::Entity_Type.(Element:
e.referencedBy(); Reported by: Generator: generating
'templates::Template::main FOR model' => [])
3016 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find operation 'referencedBy()' for myDsl::Entity_Type.(Element:
EXPRESSION: e.referencedBy(); Reported by: Generator: generating
'templates::Template::main FOR model' => [])
3016 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find operation 'referencedBy()' for myDsl::Entity_Type.(Element:
org.eclipse.internal.xpand2.ast.ForEachStatement@b20352; Reported by:
Generator: generating 'templates::Template::main FOR model' => [])
3016 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find operation 'referencedBy()' for myDsl::Entity_Type.(Element:
org.eclipse.internal.xpand2.ast.FileStatement@f8395f; Reported by:
Generator: generating 'templates::Template::main FOR model' => [])
3016 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find operation 'referencedBy()' for myDsl::Entity_Type.(Element: main :
Model; Reported by: Generator: generating 'templates::Template::main FOR
model' => [])
3016 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find operation 'referencedBy()' for myDsl::Entity_Type.(Element: EXPAND
templates::Template::main FOR model; Reported by: Generator: generating
'templates::Template::main FOR model' => [])


It seems as the problem is in the template still, but i haven't changed
the default at all. Maybe i have to change the template?
Re: Workflow Problem [message #51434 is a reply to message #51322] Mon, 15 June 2009 05:17 Go to previous messageGo to next message
Eclipse UserFriend
The errors appear in Template.xpt and Extensions.ext, both are the default
files created by the project. They look like this:

Template:
«IMPORT myDsl»;

«EXTENSION templates::Extensions»

«DEFINE main FOR Model-»
«FILE "output.txt"-»
«FOREACH this.elements.typeSelect(Element).sortBy(e|e.name) AS e-»
«e.name» has «e.listSubclasses()».
«ENDFOREACH-»
«ENDFILE-»
«ENDDEFINE»

Extensions:
import myDsl;

listSubclasses(Class this) :
let subclasses =
this.eRootContainer.eAllContents.typeSelect(Class).select(e| e.superClass
== this).name:
switch (subclasses.size) {
case 0: "no subclasses"
case 1: "subclass: " + subclasses.toString(", ")
default: subclasses.size.toString() + " subclasses: " +
subclasses.toString(", ")
};

My model/grammar no rule/entity contains the keyword "class" (nor is
called that way).

At workflow runtime I get the error that starts like this (is much longer):

2328 [main] ERROR org.eclipse.xpand2.Generator - Error in
Component of type org.eclipse.xpand2.Generator:
EvaluationException : Couldn't resolve type for 'Class'. Did you forget
to configure the corresponding metamodel?
templates::Extensions.ext[15,333] on line 3 'listSubclasses(Class this)'
[23,42] on line 1 'EXPAND templates::Template::main FOR model'

2328 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - Workflow
interrupted. Reason: Couldn't resolve type for 'Class'. Did you forget to
configure the corresponding metamodel?
2328 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
Diagnosis of
org.xtext.example.myDsl.impl.ModelImpl@1d88db7{classpath:/model/MyModel.mydsl#/}(Element:
org.xtext.example.myDsl.impl.ModelImpl@1d88db7; Reported by: MweReader:
loading file from classpath:/model/MyModel.mydsl)
2328 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]: Couldn't
find operation 'allElements()' for myDsl::Entity_Type.(Element:
EvaluationException : Couldn't find operation 'allElements()' for
myDsl::Entity_Type.

Any tips?
Re: Workflow Problem [message #51516 is a reply to message #51434] Mon, 15 June 2009 05:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: peter.friese.itemis.com

Aurel,

On 2009-06-15 11:17:32 +0200, aurel_ganga@yahoo.com (Aurel Ganga) said:

> The errors appear in Template.xpt and Extensions.ext, both are the
> default files created by the project. They look like this:
[...]

The template and the extension look exactly right - they match the
*original* version of the DSL (containing concepts like Class and
DataType). Xtext can not derive templates and extensions from a given
grammar. It probably could, but this would entirely miss the point.
Only you know what to do with a model and how to transform the model
into somethin meaningful. That's the whole point of a DSL.

> My model/grammar no rule/entity contains the keyword "class" (nor is
> called that way).

Right - as I pointed out, Xtext does not derive the template form your grammar.

>
> At workflow runtime I get the error that starts like this (is much longer):
>
> 2328 [main] ERROR org.eclipse.xpand2.Generator - Error in
> Component of type org.eclipse.xpand2.Generator: EvaluationException :
> Couldn't resolve type for 'Class'. Did you forget to configure the
> corresponding metamodel?
> templates::Extensions.ext[15,333] on line 3 'listSubclasses(Class this)'
> [23,42] on line 1 'EXPAND templates::Template::main FOR model'
> 2328 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - Workflow
> interrupted. Reason: Couldn't resolve type for 'Class'. Did you forget
> to configure the corresponding metamodel?
> 2328 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
> Diagnosis of
> org.xtext.example.myDsl.impl.ModelImpl@1d88db7{classpath:/model/MyModel.mydsl#/}(Element:
> org.xtext.example.myDsl.impl.ModelImpl@1d88db7; Reported by: MweReader:
> loading file from classpath:/model/MyModel.mydsl)
> 2328 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
> Couldn't find operation 'allElements()' for
> myDsl::Entity_Type.(Element: EvaluationException : Couldn't find
> operation 'allElements()' for myDsl::Entity_Type.
>
> Any tips?

Yes - start writing your own template :-) Xpand (the language used to
write templates) is documented here:
http://www.openarchitectureware.org/pub/documentation/4.3.1/ html/contents/core_reference.html#xpand_reference_introducti on

Cheers,
Peter
Re: Workflow Problem [message #51542 is a reply to message #51379] Mon, 15 June 2009 06:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: peter.friese.itemis.com

Aurel,

On 2009-06-14 22:49:03 +0200, aurel_ganga@yahoo.com (Aurel Ganga) said:

> My Template is the default one, havent changed anything.
[...]
> My Extensions file is also almost the default, but with a part
> commented out because it gave another error:
>
> import myDsl;
>
> //referencedBy(Class this) :
> // this.eRootContainer.eAllContents.typeSelect(Class).select(e| e.references
> == this).name.toString(",");
>
>
> After some minor code optimization and tampering, the error is:
>
> 3016 [main] ERROR org.eclipse.xpand2.Generator - Error in
> Component of type org.eclipse.xpand2.Generator: EvaluationException :
> Couldn't find operation 'referencedBy()' for myDsl::Entity_Type.
> templates::Template.xpt[158,16] on line 9 'e.referencedBy()' [23,42]
> on line 1 'EXPAND templates::Template::main FOR model'
[...]
> It seems as the problem is in the template still, but i haven't changed
> the default at all. Maybe i have to change the template?

No, the problem is in the extension. As you commented out the extension
"referencedBy()", there is extension named "referencedBy()" any more
and thus you're getting an error when invoking this non-existing
extension from your template.

Maybe you could point out what you're trying to achieve so we can help you.

Cheers,
Peter
Re: Workflow Problem [message #51567 is a reply to message #51516] Mon, 15 June 2009 06:24 Go to previous message
Eclipse UserFriend
I am still new to Xtext so I did not fully realise what the template must
do.

Thank you very much for the pointers.
Previous Topic:Uniqueness Check
Next Topic:Rich text styling in a Xtext-generated editor
Goto Forum:
  


Current Time: Wed Apr 30 08:54:08 EDT 2025

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

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

Back to the top