Export model to XMI with direct mapping, not by id [message #986502] |
Tue, 20 November 2012 16:36 |
Alexander Unsonamed Messages: 10 Registered: October 2012 |
Junior Member |
|
|
There is a Model 2 Model QVTo transformation which works pretty well.
After getting new Model I'd like to extract it to XMI, but there is a problem I have no idea how to address it.
For example there is a root element Box with children elements of type Box.
Besides, Box itself comprises refenerce to another class, e.g. Title.
Box = {child: Box, name:String, title: Title}
The problem is that I do get something like this:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1" xmlns:xmi="ht_tp://schema.omg._org/spec/XMI/2.1" xmlns:mymodel="ht_tp://example._org/spec/MYMODEL/1.0">
<mymodel:boxes xmi:id="uniqueId" name="RootBox" title="_YZAicjM3EeKpdar6P-33Hw">
<mymodel:boxes xmi:id="uniqueId" name="ChildOne"/>
</mymodel:boxes>
...
<mymodel:Title xmi:id="_YZAicjM3EeKpdar6P-33Hw" expression="something" language="English"/>
...
But, I'd really like to remove mapping "by id" between Box and Title and get title element directly inside <mymodel:Box>. Is that possible?
By the time, I use options to for extracting to XMI:
...
Resource resource = resourceSet.createResource(fileURI);
...
Map options = new HashMap();
options.put(XMIResource.OPTION_USE_XMI_TYPE, Boolean.TRUE);
options.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.FALSE);
...
resource.save(options);
[Updated on: Tue, 20 November 2012 16:47] Report message to a moderator
|
|
|
Re: Export model to XMI with direct mapping, not by id [message #986523 is a reply to message #986502] |
Tue, 20 November 2012 17:47 |
Ed Merks Messages: 33145 Registered: July 2009 |
Senior Member |
|
|
Alexander,
Comments below.
On 20/11/2012 5:36 PM, Alexander Unsonamed wrote:
> There is a Model 2 Model QVTo transformation which works pretty well.
> After getting new Model I'd like to extract it to XMI, but there is a
> problem I have no idea how to address it.
>
> For example there is a root element Box with children elements of type
> Box.
> Besides, Box itself comprises refenerce to another class, e.g. Title.
> Box = {child: Box, name:String, title: Title}
> The problem is that I do get something like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.1"
> xmlns:xmi="ht_tp://schema.omg._org/spec/XMI/2.1"
> xmlns:mymodel="ht_tp://example._org/spec/MYMODEL/1.0">
> <mymodel:boxes xmi:id="uniqueId" name="RootBox"
> title="_YZAicjM3EeKpdar6P-33Hw">
> <mymodel:boxes xmi:id="uniqueId" name="ChildOne"/> </boxes> ..
Two things with the same xsi:id; that can't be good.
> <mymodel:Title xmi:id="_YZAicjM3EeKpdar6P-33Hw" expression="something"
> language="English"/>
> ..
>
>
>
> But, I'd really like to remove mapping "by id" between Box and Title
> and get title element directly inside <mymodel:Box>.
Where is mymodel:Box?
> Is that possible?
You can make "title" a containment reference if you want that.
>
>
> By the time, I use options to for extracting to XMI:
>
> ..
> Resource resource = resourceSet.createResource(fileURI);
> ..
> Map options = new HashMap();
> options.put(XMIResource.OPTION_USE_XMI_TYPE, Boolean.TRUE);
> options.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE,
> Boolean.FALSE);
> ..
> resource.save(options);
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03424 seconds