Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » Do I need a new discoverer to pull out a metamodel described in xml(probably similar to hibernate mapping file in concept)
Do I need a new discoverer to pull out a metamodel described in xml [message #909095] Thu, 06 September 2012 14:21 Go to next message
Tom H is currently offline Tom HFriend
Messages: 136
Registered: July 2009
Senior Member
Hi,
Am new to MoDisco as of yesterday, hence this newbie question.

I have a legacy ERM system with entities (DB tables) described in xml.

It's a similar concept to any mapping file expressed in xml (like hibernate, or indeed ecore) like so;

entity.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="entity">
        <xs:complexType>
            <xs:sequence>
...



some-entity-file.xml
<?xml version="1.0" encoding="UTF-8"?>
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="entity.xsd">
    <description>None</description>
    <version>1.0</version>
    <entity entity-name="EntityAuditLog" title="Entity Audit Log">
        <field name="auditHistorySeqId"><description>Sequenced primary key</description></field>
        <field name="changedEntityName"></field>
...






So obviously I want to discover all the entity-name entity metamodel, rather than the xsd associated with the some-entity-file.xml file.

Also there are a bunch of these metamodels, so I'd like to automate this, and be able to map back-and-forwards between the metamodel to emf/ecore.

Is this something I should be using MoDisco for?

Thanks,
Tom
Re: Do I need a new discoverer to pull out a metamodel described in xml [message #909156 is a reply to message #909095] Thu, 06 September 2012 16:25 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 612
Registered: July 2009
Senior Member
Hello,

First, thanks for looking to MoDisco Smile

Concerning your problem, it depends from the finality of your developed solution.

MoDisco will allow you to directly obtain generic XML models out of any XML file (an XML document, an XML schema) via the provided XML Discoverer: cf. the MoDisco User Guide (in Technologies >> XML). Note that I also encourage you to take a look to the other MoDisco components such as the generic MoDisco Model Browser for instance.
Then, from these models (in EMF), you will be able to use any of the EMF-based modeling technologies to manipulate them. This includes notably model transformation technologies such as ATL (http://www.eclipse.org/atl/) which allows producing other models (possibly conforming to other metamodels) from them.

However, if your problem is just directly mapping your XML Schema with Ecore, EMF already provides built-in features to implement this (cf. the EMF documentation and forum).

I hope this helps.

Best regards,

Hugo


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Re: Do I need a new discoverer to pull out a metamodel described in xml [message #909170 is a reply to message #909095] Thu, 06 September 2012 17:04 Go to previous messageGo to next message
Tom H is currently offline Tom HFriend
Messages: 136
Registered: July 2009
Senior Member
The target metamodel is from a project called Apache Ofiz, and it specifies its own entity-relations systems and persistence in XML mappings.

So I can use the basic XSD-EMF bridge, to import the entity.xsd metamodel and manipulate the ofbiz-entities.xml files as instances of that metamodel, and this is good.

But the EObject is an EClass of type "Entity", with an instance value of for example "OfBizEntityType". So using basic xsd->emf I have their entity-system metamodel expressed in ecore.

Also using MoDisco xml discoverer, I can point at a ofbiz-entities.xml file, which will give me back a meta-model corresponding to the their existing xsd file.
So I can discover their entity system metamodel from instances. Which is similar to the above.


However I want to get back the DB and Java objects that are output from the instances of the entity-system, hence I need to discover the metamodel from the instances expressed in the mappings. (rather than the metamodel of the entity-system itself)

I guess the analogy would be that, if you (in a crazy world) wanted to be able to have model correspondence from some hibernate persistence model to ecore model, what is the strategy for that?

my initial ideas are...

EMF Facet?

As these metamodels are in XML, should I create an EMF facet that extends the xml schema? because I am looking for correspondence between something like this;

<entity entity-name="EntityAuditLog">


and the ecore version;
<eClassifiers xsi:type="ecore:EClass" name="EntityAuditLog">


create a facet type call entity, and then use a query to find the elements that match?


model to model mapping with ATL

maybe this is more appropriate?

Ofbiz discoverer?

Not looked into this one, but I imagine I would base it on the xml discoverer, and then on inspection reflect all the element instances as types, ie, kind of "promote" the instances to types...








Re: Do I need a new discoverer to pull out a metamodel described in xml [message #909511 is a reply to message #909170] Fri, 07 September 2012 09:01 Go to previous message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 612
Registered: July 2009
Senior Member
Hello,

I's not very clear to me what is your final objective: which (types of) artifacts/models do you want to produce as outputs?

In any case, the first step is for sure to obtain a reusable model out of your input XML file.
For this, as said before, you can use either directly EMF or the MoDisco XML discoverer according to your needs.

Then, if you have to extract information from this model, model transformation is really appropriate.
However, you thus have to clearly identify what is(are) the metamodel(s) you will target.

Best regards,

Hugo


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Previous Topic:Extracting the compilation unit info
Next Topic:Extending KDM Model
Goto Forum:
  


Current Time: Mon Nov 24 12:31:03 GMT 2014

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

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