Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Decision tables in Xtext
Decision tables in Xtext [message #1743280] Tue, 13 September 2016 20:20 Go to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 26
Registered: August 2016
Junior Member
Good evening,

the forum and google search couldn't help me so far.

I was looking for decision tables or something equal within XText. I know that "decision table" is an old term and that today it may run with a new term for it.

I'm not sure if I saw it within the docs.

It would be nice if you could point me into the correct direction. I have a strange feeling I'm overlooking something very simple.

Thanks for your help.
Re: Decision tables in Xtext [message #1743282 is a reply to message #1743280] Tue, 13 September 2016 20:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11502
Registered: July 2009
Senior Member
Hi this question is extremely vague. Can you be a bit more specific what this is about?
Grammar? Formatting ... https://blogs.itemis.com/en/tabular-formatting-with-the-new-formatter-api

.....


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Decision tables in Xtext [message #1743284 is a reply to message #1743282] Tue, 13 September 2016 21:43 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 26
Registered: August 2016
Junior Member
Hello Christian,

thanks for the fast answer as always. Wink

I was looking
a) if it is possible,
b) for the syntax,
and c) under what terms they are refered to within Xtext. Since eighter the forum nor google has a single matching result for xText and decision tables.

As far as I recall it is never even mentioned in the Xtext online docs.

Edit: With "decision table" I'm refering to the pattern not to a common table
(https://en.wikipedia.org/wiki/Decision_table)

[Updated on: Tue, 13 September 2016 21:58]

Report message to a moderator

Re: Decision tables in Xtext [message #1743286 is a reply to message #1743284] Wed, 14 September 2016 03:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11502
Registered: July 2009
Senior Member
You have to build that yourself

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Decision tables in Xtext [message #1743291 is a reply to message #1743280] Wed, 14 September 2016 06:38 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 557
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Why would you build that in Xtext? I assume it is because you would like to embed decision tables in a DSL. Otherwise real tabular editors could be better.

I think Dominik's blog post that Christian linked is a good start to define tables in an Xtext grammar. This could be extended to your use case. You may want to name the rules not so generic as in the example, but more suited to your case. Also the structure is more fixed.

Please let us know if the example does not help you.
Re: Decision tables in Xtext [message #1743442 is a reply to message #1743291] Thu, 15 September 2016 13:45 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 26
Registered: August 2016
Junior Member
I will try it. But since decision tables are a rather basic concept within DSLs I thought there would be a simple mechanism to use them with full Xtext support etc.
Re: Decision tables in Xtext [message #1743514 is a reply to message #1743442] Fri, 16 September 2016 07:12 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5533
Registered: July 2009
Senior Member
Hi

I think you are confusing paradigms.

Xtext provides powerful automation for a textual DSL.

There are many alternative paradigms for a DSL.
graphical - Papyrus/Sirius/Graphiti/...
tree - Sample Ecore Editor, ?EEF
forms - ? EEF
tables - ? EEF
text - Xtext

You seem to require tables which is a different and inappropriate paradigm to Xtext.

If you want a mixture of paradigms as an integrated whole, then you need an integration technology. You might want to look at Mylyn Intent. Pushing additional paradigms down into Xtext seems rather suspect.

Regards

Ed Willink
Re: Decision tables in Xtext [message #1743519 is a reply to message #1743514] Fri, 16 September 2016 07:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11502
Registered: July 2009
Senior Member
having a look at MPS might be another option - well they have text like looking syntax but dont use parsers as Xtext does or other Parser Based internal and external dsls do

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Decision tables in Xtext [message #1743563 is a reply to message #1743519] Fri, 16 September 2016 12:15 Go to previous messageGo to next message
Ronan Mising name is currently offline Ronan Mising nameFriend
Messages: 5
Registered: July 2009
Junior Member
More specifically take a look at http://mbeddr.com/index.html which builds on MPS
Re: Decision tables in Xtext [message #1743564 is a reply to message #1743519] Fri, 16 September 2016 12:16 Go to previous messageGo to next message
Ronan Mising name is currently offline Ronan Mising nameFriend
Messages: 5
Registered: July 2009
Junior Member
More specifically take a look at http://mbeddr.com/index.html which builds on MPS
Re: Decision tables in Xtext [message #1743594 is a reply to message #1743564] Fri, 16 September 2016 16:44 Go to previous messageGo to next message
Karsten Wilken is currently offline Karsten WilkenFriend
Messages: 26
Registered: August 2016
Junior Member
I read Fowlers chapter about decision tables again and I think that it isn't that complicated after all if you have to implement it yourself.

I didn't have time to start programming so I'm glad to be pointed to logic mistake I make.

Instead of using the top rows of the column as the condition, just use the first columns as the conditions and the following columns as the consequences.
More or less a rotated table.
decisionTable {
condition1 | condition2 | condition3 | consequence1 | consequence2;
condition1 | condition2 | condition3 | consequence1 | consequence2;
}

Don't mind the syntax, just as a hint to what I ment with rotated table. If you declare the number of conditions that are used in the table and do the checks this would work, right?
With a bit of formatting you can get the "table" look and have all the logic to build the decision table in xtend.

Am I overlooking something or would this rather simple attempt work?
Re: Decision tables in Xtext [message #1743719 is a reply to message #1743594] Mon, 19 September 2016 08:26 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 557
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Quote:
If you declare the number of conditions that are used in the table and do the checks this would work, right?

Yes, that is basically it. You would have to identify what columns are conditions and which are consequences. Maybe by adding a special header row. And which valid consequences you have.

For the formatting take Dominik's blog post.
Previous Topic:Localization in the IParserErrorContext
Next Topic:Retrieving STRING terminals in Xtend?
Goto Forum:
  


Current Time: Fri Dec 15 16:04:20 GMT 2017

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

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