Problem with Parsing XML-Files [message #1803164] |
Sun, 24 February 2019 08:09  |
Eclipse User |
|
|
|
I use the default xmi-editor that comes with eclipse. The problem is the following:
whenever i edit the files in this editor, the references are saved in a certain format in text representation. This format concludes a reference by name like
<eClassifiers
xsi:type="ecore:EClass"
name="MyFirstClass">
<eStructuralFeatures
xsi:type="ecore:EReference"
name="multiRef"
eType="//MySecondClass"/> <-----------------
</eClassifiers>
<eClassifiers
xsi:type="ecore:EClass"
name="MySecondClass"/>
When i want to use qvtd however, i don't get any results nor errors, probably because qvtd won't work on this representation. At least until i change the representation in the text editor to
eType="//@eClassifiers.1"/> <-----------------
Since this is a pretty annoying process that i have to go through when i change anything in my xmi-models, i'd like to "skip" this step.
So is anyone else experiencing the same problems? Is qvtd not able to handle these references? Will it be in the future?
And concluding the question: am i able to change the default-representation for xmi-references by any chance, or will i have to parse and change them myself before using qvtd?
Thanks, i'm sure you guys can help me out there.
[Updated on: Sun, 24 February 2019 08:11] by Moderator
|
|
|
|
|
|
|
|
|
Re: Problem with Parsing XML-Files [message #1803306 is a reply to message #1803272] |
Tue, 26 February 2019 10:29   |
Eclipse User |
|
|
|
Hi Ed,
first of all thanks a great lot for your help and time!
I think I have to clarify some of Lukas statements...
We are currently working on 'migrating' (or rather reimplementing) our old medini-QVT (QVT-R) transformations to qvt-d but face some problems.
Lukas tries to write an Ecore to SQL transformation which behaves well in the case the source model (an Ecore model) is of the right format. I provide you a really small simplistic example that shows the problem at least on my system (Ubuntu 18.04, Eclipse Photon) and Lukas is facing similar problems (as mentioned above).
The simplified transformation (Ecore2SQL_simple.qvtr) should transform Ecore models into an SQL (SQL.ecore) representation. The very simple model My2.ecore (consisting of two lose classes) is transformed without any problems. The model with one containment reference between the two classes (My.ecore) is not transformed and there is no error stating why.
As Lukas tried to explain, he found out that changing in the Ecore files the notation of the applied occurences from ('#//') or ('//') to ('//@eClassifiers.' followed by the respective number) the transformation is executed correctly.
Thus, we are a little puzzled. It shouldn't mean we have to make this kind of string replacements? I just created the two models with the Ecore editor in the way I upload them (which seems to be the usual storage mechanism for applied occurences) and we don't see why the transformation is not creating target files without reporting errors. Maybe you can now reproduce the misbehavior and help us understanding what we might be doing wrong or what is going on at all?
If you need further details, just tell me... Thanks anyways for your efforts!
Attachment: Ecore2Sql2_simple.qvtr
(Size: 1.37KB, Downloaded 126 times)
Attachment: My.ecore
(Size: 0.58KB, Downloaded 120 times)
Attachment: My2.ecore
(Size: 0.43KB, Downloaded 150 times)
Attachment: SQL.ecore
(Size: 5.24KB, Downloaded 149 times)
|
|
|
Re: Problem with Parsing XML-Files [message #1803583 is a reply to message #1803272] |
Mon, 04 March 2019 19:41   |
Eclipse User |
|
|
|
Hi Ed,
I think I have to clarify some my statements, but first of all thanks a lot for your time and help on this issue!
What we are trying to do is to migrate or rather re-implement our old medini-QVT transformations in QVT-d. I am working on a transformation from Ecore to a relational database schema (SQL).
When we try to execute it, the success depends on the format of the input source file. As i tried to explain: if references to complex datatypes are not stored in a specific format, the transformation will not produce a trace and the target model but there is no error message. This is hard for us to work with.
I try to give you a short example for (hopefully) reproducing the misbehavior also on your system. I now also realized the same problems with Eclipse Photon on Ubuntu 18.04.
That's the literal contents of the Ecore class diagram, I created with the default Ecore Editor:
<?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="test" nsURI="http://de.ubt.ai1.mvmt.test.graph/test/" nsPrefix="de.ubt.ai1.mvmt.test.graph">
<eClassifiers xsi:type="ecore:EClass" name="Graph">
<eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1"
eType="#//Node" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Node"/>
</ecore:EPackage>
With this source model as input, I don't get any resulting target model.
If we change the notation of the applied occurence of the Node class in the containment reference in the following way, we get a perfect result:
<?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="graph" nsURI="http://de.ubt.ai1.mvmt.test.graph/test/" nsPrefix="de.ubt.ai1.mvmt.test.graph">
<eClassifiers xsi:type="ecore:EClass" name="Graph">
<eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1"
eType="//@eClassifiers.1" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Node"/>
</ecore:EPackage>
So we changed, the representation of the EReferences type from to eType="//@eClassifiers.1" . Maybe there is some issue with resolving the applied occurences?
The exact same thing is also happening with EReferences of type , which happen to appear in the same places on some of our other test-systems (primarily under Windows with the version of Eclipse 2018-12).
The corresponding transformation:
import ecoreMM : 'Ecore.ecore'::ecore;
import sqlMM : 'SQL.ecore'::sql;
/**
* Transform a hierarchical StateMachine into a flat StateMachine.
*/
transformation ecore2sql::Ecore2SQL(ecore:ecoreMM, sql:sqlMM) {
-- Package
top relation Package2Schema {
domain ecore ecorePackage : EPackage {
name = ePackageName: String{}
};
enforce domain sql sqlSchema : Schema {
name = ePackageName
};
}
-- Class
top relation Class2Table {
domain ecore ecoreClass : EClassifier {
name = eClassName : String{},
ePackage = ePackage : ecore::EPackage{}
};
enforce domain sql sqlTable : Table {
name = eClassName,
owningSchema = owningSchema : sql::Schema{}
};
when {
Package2Schema(ePackage, owningSchema);
}
}
}
Sorry for putting everything literally inside this post, but it seems the file upload did not work that my colleague made a few days ago.
We hope you can help us on this issue because it would be tidious to change all applied ocurences for each new input model.
Besides, do you think it could be a solution to programatically load the files and run the execution, including some kind of transformation for the model that runs before qvtd gets executed?
There are also some other questions that we have in mind, but they are rather up to a new thread ;)
I hope based on this information you can help us, if you need more please just let me know.
Regards
Lukas
PS:
i've now also created a github repository for this bug. It is reachable under https://github.com/LukasSchwarz00/Ecore2Sql. Further instructions on how to test out the bug and different reference-formats can be found in the readme. The repo was created and tested with Eclipse 2018-12.
|
|
|
|
|
|
Re: Problem with Parsing XML-Files [message #1803753 is a reply to message #1803618] |
Fri, 08 March 2019 06:11  |
Eclipse User |
|
|
|
Sandra Greiner wrote on Tue, 05 March 2019 10:02
If you are interested, Bernhard Westfechtel pointed out some of the issues in his most recent publications.
Unfortunately these are not freely available and my ResearchGate request for a full text has received no response.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.12583 seconds