Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » open model with validating xml editor
open model with validating xml editor [message #1250562] Wed, 19 February 2014 10:56 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Hi,
I need to examine and, possibly, hand-modify an EMF model saved in XMI.
I generated the corresponding XSD files (I have two models sharing a common part, so I have two .xml and three .xsd).
How should I modify them to be able to open the Schema Definition locally?
I am using "XML Copy Editor" (using Eclipse for the task should be avoided, unfortunately) and it rightly complains (Error at line 2, column 121: no declaration found for element 'hyconmde:MDE').
As You can see the various .x?? files point to a web location (where no .xsd is to be found, at least to date).
What am I doing wrong?
How should I define things to have locally defined Schema Descriptions?
In case this is not possible: how should I upload Schemas to web server?
I tried googling around but found no answer; any pointer to "best practices" welcome.

Regards
Mauro Condarelli

================== hyconmdeXMI.xsd ================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:base="http://www.soft-in.com/base/1.0" xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.soft-in.com/hyconmde/1.0">
<xsd:import namespace="http://www.omg.org/XMI" schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
<xsd:import namespace="http://www.soft-in.com/base/1.0" schemaLocation="baseXMI.xsd"/>
<xsd:simpleType name="ArchivingInterval">
<xsd:restriction base="xsd:NCName">
....
================== baseXMI.xsd ================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:base="http://www.soft-in.com/base/1.0" xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.soft-in.com/base/1.0">
<xsd:import namespace="http://www.omg.org/XMI" schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
<xsd:import namespace="http://www.soft-in.com/hyconmde/1.0" schemaLocation="hyconmdeXMI.xsd"/>
<xsd:simpleType name="Language">
....
<xsd:element name="Identifiable" type="base:Identifiable"/>
</xsd:schema>
================== ?xml version="1.0" encoding="ASCII"?>
<hyconmde:MDE xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0">
<archiveBaseCycles id="1" eId="ArchiveBaseCycle(001)" name="MIN" i18n="StringI18n(070)"/>
....
================================
Re: open model with validating xml editor [message #1250636 is a reply to message #1250562] Wed, 19 February 2014 12:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30691
Registered: July 2009
Senior Member
Mauro,

Comments below.

On 19/02/2014 11:56 AM, Mauro Condarelli wrote:
> Hi,
> I need to examine and, possibly, hand-modify an EMF model saved in XMI.
> I generated the corresponding XSD files (I have two models sharing a
> common part, so I have two .xml and three .xsd).
A schema for an XMI serialization is effectively useless in my opinion.
You used the Export Model... for this?
> How should I modify them to be able to open the Schema Definition
> locally?
You're wanting to modify these schemas? For what purpose?
> I am using "XML Copy Editor" (using Eclipse for the task should be
> avoided, unfortunately) and it rightly complains (Error at line 2,
> column 121: no declaration found for element 'hyconmde:MDE').
I would expect a global element declaration corresponding to each
non-abstract EClass in your model.
> As You can see the various .x??
No, where do I see that?
> files point to a web location (where no .xsd is to be found, at least
> to date).
> What am I doing wrong?
I can warn you up front that you will get no use validation from an XMI
schema.
> How should I define things to have locally defined Schema Descriptions?
What do you mean by locally defined?
> In case this is not possible: how should I upload Schemas to web server?
> I tried googling around but found no answer; any pointer to "best
> practices" welcome.
I think it's better to explain what you're hoping to achieve so I can
tell you whether that's sensible or not. Keep in mind some constraints
of XML Schema. It only supports single inheritance and has essentially
no support for typed cross references. Ecore/EMOF supports multiple
inheritance and real models make heavy use of cross references. It's a
very bad mismatch. Compound that with the fact that XMI has a very
loose syntax, i.e., a feature can be serialized as an element or an
attribute, and you end up with something that's simply not generally
describable with an XML Schema. So at best these XMI schemas are a
highly verbose way of turning off validation so if your goal is to
achieve some kind of useful validation, I can warn you up front that
this is not achievable...
>
> Regards
> Mauro Condarelli
> ================== hyconmdeXMI.xsd ================================
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
> xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.soft-in.com/hyconmde/1.0">
> <xsd:import namespace="http://www.omg.org/XMI"
> schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
> <xsd:import namespace="http://www.soft-in.com/base/1.0"
> schemaLocation="baseXMI.xsd"/>
> <xsd:simpleType name="ArchivingInterval">
> <xsd:restriction base="xsd:NCName">
> ...
> ================== baseXMI.xsd ================================
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
> xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.soft-in.com/base/1.0">
> <xsd:import namespace="http://www.omg.org/XMI"
> schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
> <xsd:import namespace="http://www.soft-in.com/hyconmde/1.0"
> schemaLocation="hyconmdeXMI.xsd"/>
> <xsd:simpleType name="Language">
> ...
> <xsd:element name="Identifiable" type="base:Identifiable"/>
> </xsd:schema>
> ================== ?xml version="1.0" encoding="ASCII"?>
> <hyconmde:MDE xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0">
> <archiveBaseCycles id="1" eId="ArchiveBaseCycle(001)" name="MIN"
> i18n="StringI18n(070)"/>
> ...
> ================================
Re: open model with validating xml editor [message #1251450 is a reply to message #1250636] Thu, 20 February 2014 08:22 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Thanks Ed,
a few words to describe my current predicament.
I am writing an application heavily relying on a non-trivial (65+ EClasses) EMF model.
Unfortunately some parts of this mode are to be considered "read only" and filled from a custom Database I have no access to.
Customer will have to write on his own database interface, but, since that is not yet available, while I need to test my part, Customer wants to manually enter in XML the "missing parts".
On the other hand I would like to constrain whoever enters data manually, as much as possible,to enter valid data.
Add to this Customer "does not want to be tied to Eclipse" (I'm using EMF in Standalone mode)...
This is the reason to the present request.
Other comments below.

On 19/02/2014 13:35, Ed Merks wrote:
> Mauro,
>
> Comments below.
>
> On 19/02/2014 11:56 AM, Mauro Condarelli wrote:
>> Hi,
>> I need to examine and, possibly, hand-modify an EMF model saved in XMI.
>> I generated the corresponding XSD files (I have two models sharing a common part, so I have two .xml and three .xsd).
> A schema for an XMI serialization is effectively useless in my opinion. You used the Export Model... for this?
Yes.

>> How should I modify them to be able to open the Schema Definition locally?
> You're wanting to modify these schemas? For what purpose?
I do not want to modify the schemas, I want to use them in a sensible XML/XMI editor to "hand-edit" the model *contents*, possibly with checking, completion, etc.

>> I am using "XML Copy Editor" (using Eclipse for the task should be avoided, unfortunately) and it rightly complains (Error at line 2, column 121: no declaration found for element 'hyconmde:MDE').
> I would expect a global element declaration corresponding to each non-abstract EClass in your model.
They are there, I copied just the headers of the various files, If You want I can attache the whole thing (their're not small!).

>> As You can see the various .x??
> No, where do I see that?
xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
That's my company URL followed by "base" model and a version number

>> files point to a web location (where no .xsd is to be found, at least to date).
>> What am I doing wrong?
> I can warn you up front that you will get no use validation from an XMI schema.
I begin to understand, what alternatives?

>> How should I define things to have locally defined Schema Descriptions?
> What do you mean by locally defined?
I don't exactly know ;)
I was expecting something like:
xsd:schema xmlns:base="../baseXMI.xsd"

>> In case this is not possible: how should I upload Schemas to web server?
>> I tried googling around but found no answer; any pointer to "best practices" welcome.
> I think it's better to explain what you're hoping to achieve so I can tell you whether that's sensible or not. Keep in mind some constraints of XML Schema. It only supports single inheritance and has essentially no support for typed cross references. Ecore/EMOF supports multiple inheritance and real models make heavy use of cross references. It's a very bad mismatch. Compound that with the fact that XMI has a very loose syntax, i.e., a feature can be serialized as an element or an attribute, and you end up with something that's simply not generally describable with an XML Schema. So at best these XMI schemas are a highly verbose way of turning off validation so if your goal is to achieve some kind of useful validation, I can warn you up front that this is not achievable...
What are the alternatives?

Regards
Mauro Condarelli

>>
>> Regards
>> Mauro Condarelli
>> ================== hyconmdeXMI.xsd ================================
>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0" xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.soft-in.com/hyconmde/1.0">
>> <xsd:import namespace="http://www.omg.org/XMI" schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
>> <xsd:import namespace="http://www.soft-in.com/base/1.0" schemaLocation="baseXMI.xsd"/>
>> <xsd:simpleType name="ArchivingInterval">
>> <xsd:restriction base="xsd:NCName">
>> ...
>> ================== baseXMI.xsd ================================
>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0" xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.soft-in.com/base/1.0">
>> <xsd:import namespace="http://www.omg.org/XMI" schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
>> <xsd:import namespace="http://www.soft-in.com/hyconmde/1.0" schemaLocation="hyconmdeXMI.xsd"/>
>> <xsd:simpleType name="Language">
>> ...
>> <xsd:element name="Identifiable" type="base:Identifiable"/>
>> </xsd:schema>
>> ================== ?xml version="1.0" encoding="ASCII"?>
>> <hyconmde:MDE xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0">
>> <archiveBaseCycles id="1" eId="ArchiveBaseCycle(001)" name="MIN" i18n="StringI18n(070)"/>
>> ...
>> ================================
>
Re: open model with validating xml editor [message #1251551 is a reply to message #1251450] Thu, 20 February 2014 10:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30691
Registered: July 2009
Senior Member
Mauro,

Comments below.

On 20/02/2014 9:22 AM, Mauro Condarelli wrote:
> Thanks Ed,
> a few words to describe my current predicament.
> I am writing an application heavily relying on a non-trivial (65+
> EClasses) EMF model.
> Unfortunately some parts of this mode are to be considered "read only"
> and filled from a custom Database I have no access to.
> Customer will have to write on his own database interface, but, since
> that is not yet available, while I need to test my part, Customer
> wants to manually enter in XML the "missing parts".
Maybe it's better that be in a separate resource? In any case, an XMI
Schema is really not useful for this purpose. Because any object can
have an xmi:type that specifies a subclass that's allowed, and because
that information is completely useless from an XML Schema point of view,
nested elements always end up allowing arbitrary content according to
the XMI Schema. That's why I call it a verbose way of turning of
validation.
> On the other hand I would like to constrain whoever enters data
> manually, as much as possible,to enter valid data.
Yes, I can see why you'd want that...
> Add to this Customer "does not want to be tied to Eclipse" (I'm using
> EMF in Standalone mode)...
Perhaps it's better you provide a stand alone validator tool that
effectively tries to load the resource using EMF and reports all the
problems it encounters.
> This is the reason to the present request.
It seems infeasible with XMI, unfortunately.
> Other comments below.
>
> On 19/02/2014 13:35, Ed Merks wrote:
>> Mauro,
>>
>> Comments below.
>>
>> On 19/02/2014 11:56 AM, Mauro Condarelli wrote:
>>> Hi,
>>> I need to examine and, possibly, hand-modify an EMF model saved in XMI.
>>> I generated the corresponding XSD files (I have two models sharing a
>>> common part, so I have two .xml and three .xsd).
>> A schema for an XMI serialization is effectively useless in my
>> opinion. You used the Export Model... for this?
> Yes.
>
>>> How should I modify them to be able to open the Schema Definition
>>> locally?
>> You're wanting to modify these schemas? For what purpose?
> I do not want to modify the schemas, I want to use them in a sensible
> XML/XMI editor to "hand-edit" the model *contents*, possibly with
> checking, completion, etc.
>
>>> I am using "XML Copy Editor" (using Eclipse for the task should be
>>> avoided, unfortunately) and it rightly complains (Error at line 2,
>>> column 121: no declaration found for element 'hyconmde:MDE').
>> I would expect a global element declaration corresponding to each
>> non-abstract EClass in your model.
> They are there, I copied just the headers of the various files, If You
> want I can attache the whole thing (their're not small!).
>
>>> As You can see the various .x??
>> No, where do I see that?
> xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
> That's my company URL followed by "base" model and a version number
>
>>> files point to a web location (where no .xsd is to be found, at
>>> least to date).
>>> What am I doing wrong?
>> I can warn you up front that you will get no use validation from an
>> XMI schema.
> I begin to understand, what alternatives?
>
>>> How should I define things to have locally defined Schema Descriptions?
>> What do you mean by locally defined?
> I don't exactly know ;)
> I was expecting something like:
> xsd:schema xmlns:base="../baseXMI.xsd"
>
>>> In case this is not possible: how should I upload Schemas to web
>>> server?
>>> I tried googling around but found no answer; any pointer to "best
>>> practices" welcome.
>> I think it's better to explain what you're hoping to achieve so I can
>> tell you whether that's sensible or not. Keep in mind some
>> constraints of XML Schema. It only supports single inheritance and
>> has essentially no support for typed cross references. Ecore/EMOF
>> supports multiple inheritance and real models make heavy use of cross
>> references. It's a very bad mismatch. Compound that with the fact
>> that XMI has a very loose syntax, i.e., a feature can be serialized
>> as an element or an attribute, and you end up with something that's
>> simply not generally describable with an XML Schema. So at best
>> these XMI schemas are a highly verbose way of turning off validation
>> so if your goal is to achieve some kind of useful validation, I can
>> warn you up front that this is not achievable...
> What are the alternatives?
>
> Regards
> Mauro Condarelli
>
>>>
>>> Regards
>>> Mauro Condarelli
>>> ================== hyconmdeXMI.xsd ================================
>>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>>> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
>>> xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0"
>>> xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>> targetNamespace="http://www.soft-in.com/hyconmde/1.0">
>>> <xsd:import namespace="http://www.omg.org/XMI"
>>> schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
>>> <xsd:import namespace="http://www.soft-in.com/base/1.0"
>>> schemaLocation="baseXMI.xsd"/>
>>> <xsd:simpleType name="ArchivingInterval">
>>> <xsd:restriction base="xsd:NCName">
>>> ...
>>> ================== baseXMI.xsd ================================
>>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>>> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
>>> xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0"
>>> xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>> targetNamespace="http://www.soft-in.com/base/1.0">
>>> <xsd:import namespace="http://www.omg.org/XMI"
>>> schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
>>> <xsd:import namespace="http://www.soft-in.com/hyconmde/1.0"
>>> schemaLocation="hyconmdeXMI.xsd"/>
>>> <xsd:simpleType name="Language">
>>> ...
>>> <xsd:element name="Identifiable" type="base:Identifiable"/>
>>> </xsd:schema>
>>> ================== ?xml version="1.0" encoding="ASCII"?>
>>> <hyconmde:MDE xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0">
>>> <archiveBaseCycles id="1" eId="ArchiveBaseCycle(001)" name="MIN"
>>> i18n="StringI18n(070)"/>
>>> ...
>>> ================================
>>
>
Re: open model with validating xml editor [message #1251586 is a reply to message #1251551] Thu, 20 February 2014 11:29 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Ed,
see inline comments.

On 20/02/2014 11:36, Ed Merks wrote:
> Mauro,
>
> Comments below.
>
> On 20/02/2014 9:22 AM, Mauro Condarelli wrote:
>> Thanks Ed,
>> a few words to describe my current predicament.
>> I am writing an application heavily relying on a non-trivial (65+ EClasses) EMF model.
>> Unfortunately some parts of this mode are to be considered "read only" and filled from a custom Database I have no access to.
>> Customer will have to write on his own database interface, but, since that is not yet available, while I need to test my part, Customer wants to manually enter in XML the "missing parts".
> Maybe it's better that be in a separate resource? In any case, an XMI Schema is really not useful for this purpose. Because any object can have an xmi:type that specifies a subclass that's allowed, and because that information is completely useless from an XML Schema point of view, nested elements always end up allowing arbitrary content according to the XMI Schema. That's why I call it a verbose way of turning of validation.
>> On the other hand I would like to constrain whoever enters data manually, as much as possible,to enter valid data.
> Yes, I can see why you'd want that...
>> Add to this Customer "does not want to be tied to Eclipse" (I'm using EMF in Standalone mode)...
> Perhaps it's better you provide a stand alone validator tool that effectively tries to load the resource using EMF and reports all the problems it encounters.
A standalone validator is feasible and easy.
After all my application does a validation pass right after loading resource from XMI.
Problem is providing, if at all possible, a "guided way" to edit the model, possibly without implementing a complete editor, which would NOT be something fast.

>> This is the reason to the present request.
> It seems infeasible with XMI, unfortunately.
This is what I feared.
I tried generating the default editor, hoping to be able to transform it in an RCP "standalone" application.
Problem is I get errors when spawning the eclipse application because it lacks JavaFX support.
Note: I added a few JavaFX Dialogs to edit/modify EClasses directly as model EOperation (I know it's not "clean", but reasons are too long to explain here).
My Application is a native Java8/JavaFX application and I am using Tom's e(fx)clipse with Java8-ea SDK, but starting the EMF-generated editor as "eclipse application" produces the following errors:


!SESSION 2014-02-20 12:11:40.969 -----------------------------------------------
eclipse.buildId=4.3.0.M20130911-1000
java.version=1.8.0-ea
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.sdk.ide
Command-line arguments: -product org.eclipse.sdk.ide -data D:\Work\Voith\00 Soft-in\workspaces\step2/../runtime-EclipseApplication -dev file:D:/Work/Voith/00 Soft-in/workspaces/step2/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.osgi 2 0 2014-02-20 12:12:01.069
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2014-02-20 12:12:01.069
!MESSAGE Bundle reference:file:/D:/opt/eclipse-SDK-4.3.1-win32-x86_64-efx-0.9.0-SNAPSHOT/eclipse/plugins/org.eclipse.fx.ide.java6_0.9.0.201312110809/ was not resolved.
!SUBENTRY 2 org.eclipse.fx.ide.java6 2 0 2014-02-20 12:12:01.069
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version>=1.3)(!(version>=1.7)))".

!ENTRY org.eclipse.osgi 2 0 2014-02-20 12:12:01.069
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2014-02-20 12:12:01.069
!MESSAGE Bundle org.eclipse.fx.ide.java6_0.9.0.201312110809 [222] was not resolved.
!SUBENTRY 2 org.eclipse.fx.ide.java6 2 0 2014-02-20 12:12:01.069
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version>=1.3)(!(version>=1.7)))".

!ENTRY org.eclipse.e4.ui.workbench 4 0 2014-02-20 12:13:11.400
!MESSAGE Unable to create class 'org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor' from bundle '345'
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javafx/scene/Node
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:877)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:119)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:333)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:949)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:633)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:706)


Any help welcome.

>> Other comments below.
>>
>> On 19/02/2014 13:35, Ed Merks wrote:
>>> Mauro,
>>>
>>> Comments below.
>>>
>>> On 19/02/2014 11:56 AM, Mauro Condarelli wrote:
>>>> Hi,
>>>> I need to examine and, possibly, hand-modify an EMF model saved in XMI.
>>>> I generated the corresponding XSD files (I have two models sharing a common part, so I have two .xml and three .xsd).
>>> A schema for an XMI serialization is effectively useless in my opinion. You used the Export Model... for this?
>> Yes.
>>
>>>> How should I modify them to be able to open the Schema Definition locally?
>>> You're wanting to modify these schemas? For what purpose?
>> I do not want to modify the schemas, I want to use them in a sensible XML/XMI editor to "hand-edit" the model *contents*, possibly with checking, completion, etc.
>>
>>>> I am using "XML Copy Editor" (using Eclipse for the task should be avoided, unfortunately) and it rightly complains (Error at line 2, column 121: no declaration found for element 'hyconmde:MDE').
>>> I would expect a global element declaration corresponding to each non-abstract EClass in your model.
>> They are there, I copied just the headers of the various files, If You want I can attache the whole thing (their're not small!).
>>
>>>> As You can see the various .x??
>>> No, where do I see that?
>> xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
>> That's my company URL followed by "base" model and a version number
>>
>>>> files point to a web location (where no .xsd is to be found, at least to date).
>>>> What am I doing wrong?
>>> I can warn you up front that you will get no use validation from an XMI schema.
>> I begin to understand, what alternatives?
>>
>>>> How should I define things to have locally defined Schema Descriptions?
>>> What do you mean by locally defined?
>> I don't exactly know ;)
>> I was expecting something like:
>> xsd:schema xmlns:base="../baseXMI.xsd"
>>
>>>> In case this is not possible: how should I upload Schemas to web server?
>>>> I tried googling around but found no answer; any pointer to "best practices" welcome.
>>> I think it's better to explain what you're hoping to achieve so I can tell you whether that's sensible or not. Keep in mind some constraints of XML Schema. It only supports single inheritance and has essentially no support for typed cross references. Ecore/EMOF supports multiple inheritance and real models make heavy use of cross references. It's a very bad mismatch. Compound that with the fact that XMI has a very loose syntax, i.e., a feature can be serialized as an element or an attribute, and you end up with something that's simply not generally describable with an XML Schema. So at best these XMI schemas are a highly verbose way of turning off validation so if your goal is to achieve some kind of useful validation, I can warn you up front that this is not achievable...
>> What are the alternatives?
>>
>> Regards
>> Mauro Condarelli
>>
>>>>
>>>> Regards
>>>> Mauro Condarelli
>>>> ================== hyconmdeXMI.xsd ================================
>>>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>>>> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0" xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.soft-in.com/hyconmde/1.0">
>>>> <xsd:import namespace="http://www.omg.org/XMI" schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
>>>> <xsd:import namespace="http://www.soft-in.com/base/1.0" schemaLocation="baseXMI.xsd"/>
>>>> <xsd:simpleType name="ArchivingInterval">
>>>> <xsd:restriction base="xsd:NCName">
>>>> ...
>>>> ================== baseXMI.xsd ================================
>>>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>>>> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0" xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.soft-in.com/base/1.0">
>>>> <xsd:import namespace="http://www.omg.org/XMI" schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
>>>> <xsd:import namespace="http://www.soft-in.com/hyconmde/1.0" schemaLocation="hyconmdeXMI.xsd"/>
>>>> <xsd:simpleType name="Language">
>>>> ...
>>>> <xsd:element name="Identifiable" type="base:Identifiable"/>
>>>> </xsd:schema>
>>>> ================== ?xml version="1.0" encoding="ASCII"?>
>>>> <hyconmde:MDE xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0">
>>>> <archiveBaseCycles id="1" eId="ArchiveBaseCycle(001)" name="MIN" i18n="StringI18n(070)"/>
>>>> ...
>>>> ================================
>>>
>>
>
Re: open model with validating xml editor [message #1251641 is a reply to message #1251586] Thu, 20 February 2014 12:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30691
Registered: July 2009
Senior Member
Mauro,

Comments below.

On 20/02/2014 12:29 PM, Mauro Condarelli wrote:
> Ed,
> see inline comments.
>
> On 20/02/2014 11:36, Ed Merks wrote:
>> Mauro,
>>
>> Comments below.
>>
>> On 20/02/2014 9:22 AM, Mauro Condarelli wrote:
>>> Thanks Ed,
>>> a few words to describe my current predicament.
>>> I am writing an application heavily relying on a non-trivial (65+
>>> EClasses) EMF model.
>>> Unfortunately some parts of this mode are to be considered "read
>>> only" and filled from a custom Database I have no access to.
>>> Customer will have to write on his own database interface, but,
>>> since that is not yet available, while I need to test my part,
>>> Customer wants to manually enter in XML the "missing parts".
>> Maybe it's better that be in a separate resource? In any case, an
>> XMI Schema is really not useful for this purpose. Because any object
>> can have an xmi:type that specifies a subclass that's allowed, and
>> because that information is completely useless from an XML Schema
>> point of view, nested elements always end up allowing arbitrary
>> content according to the XMI Schema. That's why I call it a verbose
>> way of turning of validation.
>>> On the other hand I would like to constrain whoever enters data
>>> manually, as much as possible,to enter valid data.
>> Yes, I can see why you'd want that...
>>> Add to this Customer "does not want to be tied to Eclipse" (I'm
>>> using EMF in Standalone mode)...
>> Perhaps it's better you provide a stand alone validator tool that
>> effectively tries to load the resource using EMF and reports all the
>> problems it encounters.
> A standalone validator is feasible and easy.
> After all my application does a validation pass right after loading
> resource from XMI.
Indeed.
> Problem is providing, if at all possible, a "guided way" to edit the
> model, possibly without implementing a complete editor, which would
> NOT be something fast.
Aren't they just going to copy and paste XML?
>
>>> This is the reason to the present request.
>> It seems infeasible with XMI, unfortunately.
> This is what I feared.
> I tried generating the default editor, hoping to be able to transform
> it in an RCP "standalone" application.
Not so easy. You need all kinds of scaffolding for an RCP application.
> Problem is I get errors when spawning the eclipse application because
> it lacks JavaFX support.
> Note: I added a few JavaFX Dialogs to edit/modify EClasses directly as
> model EOperation (I know it's not "clean", but reasons are too long to
> explain here).
> My Application is a native Java8/JavaFX application and I am using
> Tom's e(fx)clipse with Java8-ea SDK, but starting the EMF-generated
> editor as "eclipse application" produces the following errors:
>
>
> !SESSION 2014-02-20 12:11:40.969
> -----------------------------------------------
> eclipse.buildId=4.3.0.M20130911-1000
> java.version=1.8.0-ea
> java.vendor=Oracle Corporation
> BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
> Framework arguments: -product org.eclipse.sdk.ide
> Command-line arguments: -product org.eclipse.sdk.ide -data
> D:\Work\Voith\00
> Soft-in\workspaces\step2/../runtime-EclipseApplication -dev
> file:D:/Work/Voith/00
> Soft-in/workspaces/step2/.metadata/.plugins/org.eclipse.pde.core/Eclipse
> Application/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog
>
> !ENTRY org.eclipse.osgi 2 0 2014-02-20 12:12:01.069
> !MESSAGE One or more bundles are not resolved because the following
> root constraints are not resolved:
> !SUBENTRY 1 org.eclipse.osgi 2 0 2014-02-20 12:12:01.069
> !MESSAGE Bundle
> reference:file:/D:/opt/eclipse-SDK-4.3.1-win32-x86_64-efx-0.9.0-SNAPSHOT/eclipse/plugins/org.eclipse.fx.ide.java6_0.9.0.201312110809/
> was not resolved.
> !SUBENTRY 2 org.eclipse.fx.ide.java6 2 0 2014-02-20 12:12:01.069
> !MESSAGE Missing required capability Require-Capability: osgi.ee;
> filter="(&(osgi.ee=JavaSE)(version>=1.3)(!(version>=1.7)))".
>
> !ENTRY org.eclipse.osgi 2 0 2014-02-20 12:12:01.069
> !MESSAGE The following is a complete list of bundles which are not
> resolved, see the prior log entry for the root cause if it exists:
> !SUBENTRY 1 org.eclipse.osgi 2 0 2014-02-20 12:12:01.069
> !MESSAGE Bundle org.eclipse.fx.ide.java6_0.9.0.201312110809 [222] was
> not resolved.
> !SUBENTRY 2 org.eclipse.fx.ide.java6 2 0 2014-02-20 12:12:01.069
> !MESSAGE Missing required capability Require-Capability: osgi.ee;
> filter="(&(osgi.ee=JavaSE)(version>=1.3)(!(version>=1.7)))".
>
> !ENTRY org.eclipse.e4.ui.workbench 4 0 2014-02-20 12:13:11.400
> !MESSAGE Unable to create class
> 'org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor' from
> bundle '345'
> !STACK 0
> org.eclipse.e4.core.di.InjectionException:
> java.lang.NoClassDefFoundError: javafx/scene/Node
> at
> org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:877)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:119)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:333)
> at
> org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:254)
> at
> org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
> at
> org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:949)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:633)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:706)
>
>
> Any help welcome.
In the case that we wanted an RCP editor for our Oomph model, I copied
the *.genmodel, and change the copy to specify i wanted to generated an
RCP editor and changed the bundle where that editor is generated. Then
I can generate a normal editor and an RCP editor (and hopefully not end
up with too many hand-written changes I need to maintain across the two
copies).
>
>>> Other comments below.
>>>
>>> On 19/02/2014 13:35, Ed Merks wrote:
>>>> Mauro,
>>>>
>>>> Comments below.
>>>>
>>>> On 19/02/2014 11:56 AM, Mauro Condarelli wrote:
>>>>> Hi,
>>>>> I need to examine and, possibly, hand-modify an EMF model saved in
>>>>> XMI.
>>>>> I generated the corresponding XSD files (I have two models sharing
>>>>> a common part, so I have two .xml and three .xsd).
>>>> A schema for an XMI serialization is effectively useless in my
>>>> opinion. You used the Export Model... for this?
>>> Yes.
>>>
>>>>> How should I modify them to be able to open the Schema Definition
>>>>> locally?
>>>> You're wanting to modify these schemas? For what purpose?
>>> I do not want to modify the schemas, I want to use them in a
>>> sensible XML/XMI editor to "hand-edit" the model *contents*,
>>> possibly with checking, completion, etc.
>>>
>>>>> I am using "XML Copy Editor" (using Eclipse for the task should be
>>>>> avoided, unfortunately) and it rightly complains (Error at line 2,
>>>>> column 121: no declaration found for element 'hyconmde:MDE').
>>>> I would expect a global element declaration corresponding to each
>>>> non-abstract EClass in your model.
>>> They are there, I copied just the headers of the various files, If
>>> You want I can attache the whole thing (their're not small!).
>>>
>>>>> As You can see the various .x??
>>>> No, where do I see that?
>>> xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
>>> That's my company URL followed by "base" model and a version number
>>>
>>>>> files point to a web location (where no .xsd is to be found, at
>>>>> least to date).
>>>>> What am I doing wrong?
>>>> I can warn you up front that you will get no use validation from an
>>>> XMI schema.
>>> I begin to understand, what alternatives?
>>>
>>>>> How should I define things to have locally defined Schema
>>>>> Descriptions?
>>>> What do you mean by locally defined?
>>> I don't exactly know ;)
>>> I was expecting something like:
>>> xsd:schema xmlns:base="../baseXMI.xsd"
>>>
>>>>> In case this is not possible: how should I upload Schemas to web
>>>>> server?
>>>>> I tried googling around but found no answer; any pointer to "best
>>>>> practices" welcome.
>>>> I think it's better to explain what you're hoping to achieve so I
>>>> can tell you whether that's sensible or not. Keep in mind some
>>>> constraints of XML Schema. It only supports single inheritance and
>>>> has essentially no support for typed cross references. Ecore/EMOF
>>>> supports multiple inheritance and real models make heavy use of
>>>> cross references. It's a very bad mismatch. Compound that with
>>>> the fact that XMI has a very loose syntax, i.e., a feature can be
>>>> serialized as an element or an attribute, and you end up with
>>>> something that's simply not generally describable with an XML
>>>> Schema. So at best these XMI schemas are a highly verbose way of
>>>> turning off validation so if your goal is to achieve some kind of
>>>> useful validation, I can warn you up front that this is not
>>>> achievable...
>>> What are the alternatives?
>>>
>>> Regards
>>> Mauro Condarelli
>>>
>>>>>
>>>>> Regards
>>>>> Mauro Condarelli
>>>>> ================== hyconmdeXMI.xsd ================================
>>>>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>>>>> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
>>>>> xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0"
>>>>> xmlns:xmi="http://www.omg.org/XMI"
>>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>>>> targetNamespace="http://www.soft-in.com/hyconmde/1.0">
>>>>> <xsd:import namespace="http://www.omg.org/XMI"
>>>>> schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
>>>>> <xsd:import namespace="http://www.soft-in.com/base/1.0"
>>>>> schemaLocation="baseXMI.xsd"/>
>>>>> <xsd:simpleType name="ArchivingInterval">
>>>>> <xsd:restriction base="xsd:NCName">
>>>>> ...
>>>>> ================== baseXMI.xsd ================================
>>>>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>>>>> <xsd:schema xmlns:base="http://www.soft-in.com/base/1.0"
>>>>> xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0"
>>>>> xmlns:xmi="http://www.omg.org/XMI"
>>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>>>> targetNamespace="http://www.soft-in.com/base/1.0">
>>>>> <xsd:import namespace="http://www.omg.org/XMI"
>>>>> schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/XMI.xsd"/>
>>>>> <xsd:import namespace="http://www.soft-in.com/hyconmde/1.0"
>>>>> schemaLocation="hyconmdeXMI.xsd"/>
>>>>> <xsd:simpleType name="Language">
>>>>> ...
>>>>> <xsd:element name="Identifiable" type="base:Identifiable"/>
>>>>> </xsd:schema>
>>>>> ================== ?xml version="1.0" encoding="ASCII"?>
>>>>> <hyconmde:MDE xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>>>>> xmlns:hyconmde="http://www.soft-in.com/hyconmde/1.0">
>>>>> <archiveBaseCycles id="1" eId="ArchiveBaseCycle(001)" name="MIN"
>>>>> i18n="StringI18n(070)"/>
>>>>> ...
>>>>> ================================
>>>>
>>>
>>
>
Re: open model with validating xml editor [message #1252073 is a reply to message #1251641] Thu, 20 February 2014 22:48 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Thanks Ed,
comments inline.

On 20/02/2014 13:44, Ed Merks wrote:
> Mauro,
>
> Comments below.
>> I tried generating the default editor, hoping to be able to transform it in an RCP "standalone" application.
> Not so easy. You need all kinds of scaffolding for an RCP application.
What I really need is to have the EMF-generated editor to open as a normal editor, without the whole eclipse IDE.
Nothing else is necessary.
Would that be possible, somehow?

>> Any help welcome.
> In the case that we wanted an RCP editor for our Oomph model, I copied the *.genmodel, and change the copy to
> specify i wanted to generated an RCP editor and changed the bundle where that editor is generated. Then I can
> generate a normal editor and an RCP editor (and hopefully not end up with too many hand-written changes I need
> to maintain across the two copies).
Sorry, I fail to understand You.
Why copying?
Note I'm using ONLY the model code, no edit, no editor.
I would generate edit/editor JUST for this purpose.
It should be possible to "Export as Eclipse Product", shouldn't it?
I will retry specifying RCP Editor.
First problem, however, is to convince the target eclipse invocation to use the "right" JVM (JDK8-ea).

Please elaborate.

Regards
Mauro
Re: open model with validating xml editor [message #1252333 is a reply to message #1252073] Fri, 21 February 2014 05:26 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30691
Registered: July 2009
Senior Member
Mauro,

Comments below.

On 20/02/2014 11:48 PM, Mauro Condarelli wrote:
> Thanks Ed,
> comments inline.
>
> On 20/02/2014 13:44, Ed Merks wrote:
>> Mauro,
>>
>> Comments below.
>>> I tried generating the default editor, hoping to be able to
>>> transform it in an RCP "standalone" application.
>> Not so easy. You need all kinds of scaffolding for an RCP application.
> What I really need is to have the EMF-generated editor to open as a
> normal editor, without the whole eclipse IDE.
> Nothing else is necessary.
> Would that be possible, somehow?
That's what the RCP editor is supposed to be.
>
>>> Any help welcome.
>> In the case that we wanted an RCP editor for our Oomph model, I
>> copied the *.genmodel, and change the copy to
>> specify i wanted to generated an RCP editor and changed the bundle
>> where that editor is generated. Then I can
>> generate a normal editor and an RCP editor (and hopefully not end up
>> with too many hand-written changes I need
>> to maintain across the two copies).
> Sorry, I fail to understand You.
> Why copying?
Because there are settings in the *.genmodel for generating RCP and that
produces something quite different from the normal editor. If you want
both, you'll want two different *.editor projects and one *.genmodel
can't do that.
> Note I'm using ONLY the model code, no edit, no editor.
Well of course the editor requires the later, but if you don't need two
editors you can use just one *.genmodel to produce your RCP editor.
> I would generate edit/editor JUST for this purpose.
I see, then you don't need a copy.
> It should be possible to "Export as Eclipse Product", shouldn't it?
We don't generate a product definition, but yes, if you wrote such a
thing, you can use that to produce your "product".
> I will retry specifying RCP Editor.
> First problem, however, is to convince the target eclipse invocation
> to use the "right" JVM (JDK8-ea).
That's defined in the launcher choosing the JRE you've registered via
the Java preferences for that.
>
> Please elaborate.
>
> Regards
> Mauro
>
>
Previous Topic:EMF modifying files?
Next Topic:EMF Validation,
Goto Forum:
  


Current Time: Thu Dec 12 03:27:12 GMT 2019

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

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

Back to the top