MPS TABLE EDITOR DETAILED STEPS

Hi,

 

Is there any detailed and clear document available for creating the table  anad accessing one by one value in MPS?

 

From the table i need to give data as a input from node,i need to use those data inside my program..

 

 

0
7 comments
Avatar
Permanently deleted user

There are, just google "JetBrains MPS table" and you will find this: https://tomassetti.me/tabular-projections-in-jetbrains-mps-lets-start-building-an-accounting-system/

Also, it is worthwhile trying to invest a little effort in asking questions here to get better answers. The examples in the slisson table demo language are very easy to explore when you play around with them a little.

Maybe your problem is that you have a wrong conception of how structure and editor aspects interact with each other.

If you want to define a structure in your language that is close to a two-dimensional array, you have to either build it row-based or column-based.

Let's say you want to model a meal plan, where the columns are weekdays and the rows are your daily meals, you could do it like this:

  • Define a concept Mealplan that represents your data object
  • Define a concept Day that represents a column in a Mealplan table; add a days : Day[0..n] child to Mealplan concept 
  • Define a concept Meal that represents a cell in a Day column; add a meals : Meal[0..n] child to your Day concept 
  • You can add additional concepts for your table headers, e.g. a DayHeader concept and a MealHeader concept and add children to your Mealplan / Day concepts to hold the header information

With such a structure in place (example is column-based, but you can also do row-based, if it fits better with what you want to do), you can then use the table editors that come with MPS-extensions to define the table projections. The table editor is very versatile and can be used in a lot of different ways, depending on your specific use cases and intended user interactions. The examples in the demo language cover the most important approaches.

You are invited to ask more specific questions if necessary, e.g. how to static vs. dynamic tables, but also please have a look at the linked article and the examples that are available.

1

Hi @...

 

Thanks for your response.

 i created a table Structure and inserted some values in cells.

 

so now my question is how can i get the particular cell value from table to my java program to perform calculations based on the cell value.

 

Here is the Git Link for this project -> :https://github.com/vishnu2497/MPS-TABLE.git 

0
Avatar
Permanently deleted user

The fact that you project your data as a table does not influence how you access the AST from a 3rd party application (unless the data you are projecting is, of course, not stored in your AST).

So I don't understand the question. 

At what point in time and in what context would you like to access a specific cell? From an intention or an action? From the generator? 

Again, I don't understand what the problem is.

0

Hi @...

I am also working in the similar kind of application. I have created a table using partial table. Then, for calculation i need to access each values in the table in class. How can i do that ?

1
Avatar
Permanently deleted user

Hi Jacquilinedoss,

again, it shouldn't matter how your editor looks like, i.e. whether or not you use a tabular or any other kind of projection.

If you want to access each value in your table, you have to traverse your AST according to its structure.

Imagine my example from above, the Mealplan.

  • A Mealplan has [0..n] children of concept Day in role days
  • A Day has [0..n] children of concept Meal in role meals

So, if you imagine a function that takes a node of concept Mealplan, you iterate like so, for example:

public void traverseMealplan(node<Mealplan> mealplan) {
foreach day in mealplan.days {
// do something with your day
foreach meal in day.meals {
// do something with meal
}
}
}

The Mealplan might happen to be projected as a table, but it might as well not be. This does not affect the way you access the AST....

0

Hi @...,

I have Created the table in node ... but now i want to access the data in each cell...  if is through index means, how i should get the reference for that particular index. 

0

What does your concept structure look like? Please post a screenshot.

0

Please sign in to leave a comment.