[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Reading an OMG MOF file into eclipse EMF framework

Jean-Marc,

EMF will only read an EMOF serialization and as far as I understand it, ownedMember should be ownedType instead.  See figure 12.3 of
http://www.omg.org/docs/formal/06-01-01.pdf
It should read instances serialized according to the above specification, and indeed it will covert that directly to Ecore on the fly.  Ecore is effectively isomorphic to EMOF (and predates it).  The translation happens within the bowels of the EMOFResourceImpl's infrastructure.  There's no documentation for it.  We're working on the second edition of the EMF book now:
EMF Book, Second Edition Rough Cut

Jean-Marc Vanel wrote:
Ed Merks wrote:

Jean-Marc,

Clients don't typically access the internals of a resource's implementation. Something like this should work better.  You should use a URI that directly references the instance file.
[...]

Thanks Ed; it goes further now.
It reads the Package element, but fails on element ownedMember; now I get this:

 org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'ownedMember' not found. (file:///home/jvanel/public_Jean_Marc_Vanel/uml_examples/sam_profile_test_datatype.emof, 8, 55)

Of course I can try ownedElement, packagedElement, etc, but I'd like to know which MOF dialect is recognized. I read somewhere that the EMOF is tranlated on the fly into EMF eCore during reading. Where does that occur on the source ? Is there some more doc. on the Web that I missed? A book recommended ?

Also other questions:

- isn't it a bug if when opening the same EMOF file from the eclipse file manager it fails with the same stack I reported the first time?
- would you have a code snippet for writing an eCore model into an EMOF file ?

[...]
I'm trying to read an  OMG MOF file like this:

<?xml version='1.0' encoding='UTF-8'?>
<xmi:XMI xmi:version='2.1'
xmlns:xmi='http://schema.omg.org/spec/XMI/2.1'
xmlns:mof='http://schema.omg.org/spec/mof/2.0/emof.xmi' >
<mof:Package xmi:type='mof:Package' xmi:id='135436_1' >
    <name>Data</name>
    <ownedMember xmi:type='mof:Class' xmi:id='my1' >
        <name>My_1</name>
    </ownedMember>
</mof:Package>
</xmi:XMI>
[...]