Modeling problem [message #661118] |
Wed, 23 March 2011 09:19 |
Antoine Messages: 22 Registered: February 2011 Location: Toulouse, France |
Junior Member |
|
|
Hello everyone !
What I'm doing: I create a Metamodel to represent concepts use in a spreadsheet file (excel, calc or anything else...). I want to have the possibility to import a spreadsheet file as a model and the opposite : create a model and export it as an spreadsheet file.
Explanation of the MetaModel: My modeling is very simple (as you can see on the joined image) : we have a Spreadsheet which contained Sheet(s), which contained Line(s), which contained DataCell(s)...
I introduce a mechanism that I need : HeaderCell. A Sheet has HeaderCell(s) which are Cell(s) (typically the first line of the Sheet but nevermind) and a DataCell can refer to an HeaderCell. For example: a column represent Dates, the first cell contained the string "Date" so this cell is a HeaderCell and each DataCell of the column refer to this HeaderCell, like this I know from a DataCell what content I will found on it (in terms of semantics more than in syntactic).
The problem: a DataCell can refer to a HeaderCell which are not on the same Sheet. I know that I can make an OCL rule to check this but I want to know if there is a modeling solution to do this. Because for the moment, if I create a Spredsheet model with the generated EMF Editor, the text result is this (no CODE tag to have color...):
<?xml version="1.0" encoding="UTF-8"?>
<spreadsheet:Spreadsheet xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:spreadsheet="spreadsheet" name="Main">
___<containedSheets name="Sheet1">
______<containedHeaders content="Name" headerId="1"/>
______<containedLines num="1">
_________<containedCells content="FOO" relatedHeader="1"/>
______</containedLines>
___</containedSheets>
___<containedSheets name="Sheet2">
______<containedHeaders content="Identifier" headerId="1"/>
______<containedLines num="1">
_________<containedCells content="FIFOO" relatedHeader="1"/>
______</containedLines>
___</containedSheets>
</spreadsheet:Spreadsheet>
The reference on the HeaderCell is ambiguous, and in reality when I load my model, the Cell "FIFOO" refer to the HeaderCell "Name" in the first Sheet...
The MetaModel:
Thank you for answering !
Antoine
[Updated on: Wed, 23 March 2011 09:20] Report message to a moderator
|
|
|
Re: Modeling problem [message #661222 is a reply to message #661118] |
Wed, 23 March 2011 15:37 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Antoine,
Comments below.
Antoine wrote:
> Hello everyone !
>
> What I'm doing: I create a Metamodel to represent concepts use in a
> spreadsheet file (excel, calc or anything else...). I want to have the
> possibility to import a spreadsheet file as a model and the opposite :
> create a model and export it as an spreadsheet file.
>
> Explanation of the MetaModel: My modeling is very simple (as you can
> see on the joined image)
No images...
> : we have a Spreadsheet which contained Sheet(s), which contained
> Line(s), which contained DataCell(s)...
> I introduce a mechanism that I need : HeaderCell. A Sheet has
> HeaderCell(s) which are Cell(s) (typically the first line of the Sheet
> but nevermind) and a DataCell can refer to an HeaderCell. For example:
> a column represent Dates, the first cell contained the string date
> "Date" so this cell is a HeaderCell and each DataCell of the column
> refer to this HeaderCell, like this I know from a DataCell what
> content I will found on it (in terms of semantics more than in
> syntactic).
>
> The problem: a DataCell can refer to a HeaderCell which are not on the
> same Sheet. I know that I can make an OCL rule to check this but I
> want to know if there is a modeling solution to do this.
No.
> Because for the moment, if I create a Spredsheet model with the
> generated EMF Editor, the text result is this (no CODE tag to have
> color...):
> <?xml version="1.0" encoding="UTF-8"?>
> <spreadsheet:Spreadsheet xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI" xmlns:spreadsheet="spreadsheet"
> name="Main">
> ___<containedSheets name="Sheet1">
> ______<containedHeaders content="Name" headerId="1"/>
> ______<containedLines num="1">
> _________<containedCells content="FOO" relatedHeader="1"/>
> ______</containedLines>
> ___</containedSheets>
> ___<containedSheets name="Sheet2">
> ______<containedHeaders content="Identifier" headerId="1"/>
> ______<containedLines num="1">
> _________<containedCells content="FIFOO" relatedHeader="1"/>
> ______</containedLines>
> ___</containedSheets>
> </spreadsheet:Spreadsheet>
>
> The reference on the HeaderCell is ambiguous, and in reality when I
> load my model, the Cell "FIFOO" refer to the HeaderCell "Name" in the
> first Sheet...
You can't have more than one object with the same ID in the same resource.
>
> The MetaModel:
>
>
> Thank you for answering !
>
> Antoine
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02847 seconds