Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » EMOF to Ecore
| | |
Re: EMOF to Ecore [message #128559 is a reply to message #128520] |
Mon, 11 August 2008 11:00 |
Ed Merks Messages: 33236 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------010407090007000209070704
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Swetha,
Comments below.
Swetha wrote:
> Hi Ed,
>
> Thanks for your reply.
>
> I tried the following.
>
> 1.Initially I had the test.xml file which is in XML format.
Not sure what XML format means.
>
> 2.I did a File Save As and saved it in the ecore format.
You saved with a *.ecore extension using the Sample Ecore Editor which
has this logic:
public void doSaveAs()
{
SaveAsDialog saveAsDialog= new SaveAsDialog(getSite().getShell());
saveAsDialog.create();
saveAsDialog.setMessage(EcoreEditorPlugin.INSTANCE.getString ( "_UI_SaveAs_message"));
saveAsDialog.open();
IPath path= saveAsDialog.getResult();
if (path != null)
{
IFile file =
ResourcesPlugin.getWorkspace().getRoot().getFile(path);
if (file != null)
{
ResourceSet resourceSet = editingDomain.getResourceSet();
Resource currentResource = resourceSet.getResources().get(0);
String currentExtension =
currentResource.getURI().fileExtension();
URI newURI =
URI.createPlatformResourceURI(file.getFullPath().toString(), true);
String newExtension = newURI.fileExtension();
if (currentExtension.equals(ECORE_FILE_EXTENSION) &&
newExtension.equals(EMOF_FILE_EXTENSION) ||
currentExtension.equals(EMOF_FILE_EXTENSION) &&
newExtension.equals(ECORE_FILE_EXTENSION))
{
Resource newResource = resourceSet.createResource(newURI);
newResource.getContents().addAll(currentResource.getContents ());
resourceSet.getResources().remove(0);
resourceSet.getResources().move(0, newResource);
}
else
{
currentResource.setURI(newURI);
}
IFileEditorInput modelFile = new FileEditorInput(file);
setInputWithNotify(modelFile);
setPartName(file.getName());
doSave(getActionBars().getStatusLineManager().getProgressMon itor());
}
}
}
>
> 3.I tried opening this ecore file using EMF .
>
> 4.While loading the Ecore,the following Exception has been thrown.
> !ENTRY org.eclipse.emf.importer 2 0 2008-08-11 09:27:24.274
> !MESSAGE Class 'Package' not found.
> (platform:/resource/TestEMF/model/test.ecore, 4, 22)
> !STACK 0
> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'Package' not
> found. (platform:/resource/TestEMF/model/test.ecore, 4, 22)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:2229)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:2220)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1318)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1454)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1019)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:83)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:1001)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:712)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
>
>
>
> I am not sure just by saving the emof file(in xml format) into
> ecore format works for me.
It didn't seem to work.
> Have I missed something here.
I guess so. It worked fine for me when I just tried it. You used the
Sample Ecore Editor?
> I am currently using Eclipse Ganymede V3.4
>
>
> Plz advice.
>
> Regards,
> Swetha.
>
--------------010407090007000209070704
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Swetha,<br>
<br>
Comments below.<br>
<br>
Swetha wrote:
<blockquote
cite="mid:00ee2974a514f91390e0d3e40aab0fe1$1@www.eclipse.org"
type="cite">Hi Ed,
<br>
<br>
Thanks for your reply.
<br>
<br>
I tried the following.
<br>
<br>
1.Initially I had the test.xml file which is in XML format.
<br>
</blockquote>
Not sure what XML format means.<br>
<blockquote
cite="mid:00ee2974a514f91390e0d3e40aab0fe1$1@www.eclipse.org"
type="cite"><br>
2.I did a File Save As and saved it in the ecore format.
<br>
</blockquote>
You saved with a *.ecore extension using the Sample Ecore Editor which
has this logic:<br>
<blockquote>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: EMOF to Ecore [message #128732 is a reply to message #128720] |
Wed, 13 August 2008 10:49 |
Ed Merks Messages: 33236 Registered: July 2009 |
Senior Member |
|
|
Swetha,
If you have the full EMF installed (as available in the Ganymede
modeling package or from the EMF download package) it comes with the
Sample Ecore Editor; you'll see that choice on the Open With menu. I
can't comment informatively on what's in various other distros...
Swetha wrote:
> Hi Ed,
>
> I am using the TOPCASED Ver 2.0 M6.This has the Sample Ecore Editor. I
> hope it's the same editor you are referring. If its not correct, can
> you please tell me the link where I can download Sample Ecore Editor.
>
>
> Regards,
> Swetha.
>
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: EMOF to Ecore [message #620216 is a reply to message #128428] |
Fri, 08 August 2008 12:20 |
Ed Merks Messages: 33236 Registered: July 2009 |
Senior Member |
|
|
Swetha,
EMOFResourceFactoryImpl creates resources implementations configured to
do this. Even the Sample Ecore Editor can do this. I.e., it can open a
*.emof file and if you do a "Save As" to a *.ecore name, it will save it
in Ecore format instead of EMOF format (or vice versa as well). With
the content type support in EMF 2.4, we've even registered the EMOF
content type for *.xmi extension so we should be able to read that...
I saw your questions on one of the other newsgroups. Likely those folks
should be supporting this directly and perhaps just need to tweak some
configuration to make it work. EMOF serializations should just be
transparently handles as an interchangeable format for Ecore...
Swetha wrote:
> Hi,
>
> I have an EMOF file in the XML format.I need to convert this into the
> ECORE format.
>
> A small snippet of the code is given below:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <emof:Package xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI" xmi:id="xyz"
> name="xyz" >
>
>
> Is there any tool,which can accept this format and give the
> corresponding ecore relevant code.
>
> If there is no tool and if I have to do it manually,how do I proceed.
>
> Please help me in solving this issue.
>
> Thanks,
> Swetha.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: EMOF to Ecore [message #620225 is a reply to message #128520] |
Mon, 11 August 2008 11:00 |
Ed Merks Messages: 33236 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------010407090007000209070704
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Swetha,
Comments below.
Swetha wrote:
> Hi Ed,
>
> Thanks for your reply.
>
> I tried the following.
>
> 1.Initially I had the test.xml file which is in XML format.
Not sure what XML format means.
>
> 2.I did a File Save As and saved it in the ecore format.
You saved with a *.ecore extension using the Sample Ecore Editor which
has this logic:
public void doSaveAs()
{
SaveAsDialog saveAsDialog= new SaveAsDialog(getSite().getShell());
saveAsDialog.create();
saveAsDialog.setMessage(EcoreEditorPlugin.INSTANCE.getString ( "_UI_SaveAs_message"));
saveAsDialog.open();
IPath path= saveAsDialog.getResult();
if (path != null)
{
IFile file =
ResourcesPlugin.getWorkspace().getRoot().getFile(path);
if (file != null)
{
ResourceSet resourceSet = editingDomain.getResourceSet();
Resource currentResource = resourceSet.getResources().get(0);
String currentExtension =
currentResource.getURI().fileExtension();
URI newURI =
URI.createPlatformResourceURI(file.getFullPath().toString(), true);
String newExtension = newURI.fileExtension();
if (currentExtension.equals(ECORE_FILE_EXTENSION) &&
newExtension.equals(EMOF_FILE_EXTENSION) ||
currentExtension.equals(EMOF_FILE_EXTENSION) &&
newExtension.equals(ECORE_FILE_EXTENSION))
{
Resource newResource = resourceSet.createResource(newURI);
newResource.getContents().addAll(currentResource.getContents ());
resourceSet.getResources().remove(0);
resourceSet.getResources().move(0, newResource);
}
else
{
currentResource.setURI(newURI);
}
IFileEditorInput modelFile = new FileEditorInput(file);
setInputWithNotify(modelFile);
setPartName(file.getName());
doSave(getActionBars().getStatusLineManager().getProgressMon itor());
}
}
}
>
> 3.I tried opening this ecore file using EMF .
>
> 4.While loading the Ecore,the following Exception has been thrown.
> !ENTRY org.eclipse.emf.importer 2 0 2008-08-11 09:27:24.274
> !MESSAGE Class 'Package' not found.
> (platform:/resource/TestEMF/model/test.ecore, 4, 22)
> !STACK 0
> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'Package' not
> found. (platform:/resource/TestEMF/model/test.ecore, 4, 22)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:2229)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:2220)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1318)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1454)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1019)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:83)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:1001)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:712)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
>
>
>
> I am not sure just by saving the emof file(in xml format) into
> ecore format works for me.
It didn't seem to work.
> Have I missed something here.
I guess so. It worked fine for me when I just tried it. You used the
Sample Ecore Editor?
> I am currently using Eclipse Ganymede V3.4
>
>
> Plz advice.
>
> Regards,
> Swetha.
>
--------------010407090007000209070704
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Swetha,<br>
<br>
Comments below.<br>
<br>
Swetha wrote:
<blockquote
cite="mid:00ee2974a514f91390e0d3e40aab0fe1$1@www.eclipse.org"
type="cite">Hi Ed,
<br>
<br>
Thanks for your reply.
<br>
<br>
I tried the following.
<br>
<br>
1.Initially I had the test.xml file which is in XML format.
<br>
</blockquote>
Not sure what XML format means.<br>
<blockquote
cite="mid:00ee2974a514f91390e0d3e40aab0fe1$1@www.eclipse.org"
type="cite"><br>
2.I did a File Save As and saved it in the ecore format.
<br>
</blockquote>
You saved with a *.ecore extension using the Sample Ecore Editor which
has this logic:<br>
<blockquote>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: EMOF to Ecore [message #620236 is a reply to message #128720] |
Wed, 13 August 2008 10:49 |
Ed Merks Messages: 33236 Registered: July 2009 |
Senior Member |
|
|
Swetha,
If you have the full EMF installed (as available in the Ganymede
modeling package or from the EMF download package) it comes with the
Sample Ecore Editor; you'll see that choice on the Open With menu. I
can't comment informatively on what's in various other distros...
Swetha wrote:
> Hi Ed,
>
> I am using the TOPCASED Ver 2.0 M6.This has the Sample Ecore Editor. I
> hope it's the same editor you are referring. If its not correct, can
> you please tell me the link where I can download Sample Ecore Editor.
>
>
> Regards,
> Swetha.
>
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Sat Oct 19 19:37:51 GMT 2024
Powered by FUDForum. Page generated in 0.04052 seconds
|