Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Possible to reference a xml simple type`?
Possible to reference a xml simple type`? [message #431665] Tue, 21 July 2009 10:46 Go to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

I'm just wondering if it is possible to import anyhow the xml simple
types. I mean I don't want to create them in my metamodel but rather
want to use them in my generated editor as references. In the ecore
diagram editor I tried to load resources... but I only can load ecore
models in the workspace or filesystem and not in the registry. Is it
possible anyhow?
Re: Possible to reference a xml simple type`? [message #431678 is a reply to message #431665] Tue, 21 July 2009 14:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Gilbert,

Comments below.

Gilbert Mirenque wrote:
> I'm just wondering if it is possible to import anyhow the xml simple
> types.
XMLTypePackage has EDataTypes for the XML Schema built-in simple types...
> I mean I don't want to create them in my metamodel but rather
> want to use them in my generated editor as references. In the ecore
> diagram editor I tried to load resources... but I only can load ecore
> models in the workspace or filesystem and not in the registry.
Perhaps if you use the Sample Ecore Editor to load it and make your
first reference to it, after that the diagram editor will let you work
with it...
> Is it
> possible anyhow?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Possible to reference a xml simple type`? [message #431701 is a reply to message #431678] Wed, 22 July 2009 10:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Ed Merks wrote:
> XMLTypePackage has EDataTypes for the XML Schema built-in simple types...
found it

> Perhaps if you use the Sample Ecore Editor to load it and make your
> first reference to it, after that the diagram editor will let you work
> with it...
Ok so it works. If you add a reference in the sample editor first you
can work with the imported package in the ecore diagram editor as well.
But now I have another problem. In my genmodel the imported package
appears as well - understandable. The generation of the editor worked
fine except an error in one test class. For now I commented the line out
where a not existent method is to be invoked. But in the new eclipse
instance, where I want to work with my editor, I get the following error
when starting the creation wizard:

Plug-in "myplugin.editor" was unable to instantiate class
"myplugin.presentation.ModelWizard".
Could not initialize class myplugin.MyModelPackage

that's caused by the following line in the init method of my package impl:

TypePackageImpl theTypePackage =
(TypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(Typ ePackage.eNS_URI)
instanceof TypePackageImpl ?
EPackage.Registry.INSTANCE.getEPackage(TypePackage.eNS_URI) :
TypePackage.eINSTANCE);

and by the following line in my imported TypePackageImpl:
XMLTypePackage theXMLTypePackage =
(XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTy pePackage.eNS_URI);


What can I do to avoid this?
Re: Possible to reference a xml simple type`? [message #431705 is a reply to message #431701] Wed, 22 July 2009 11:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020309040302040608060207
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Gilbert,

How exactly do those lines cause a problem? The XMLTypePackage does
exist. When you created your GenModel, did you choose the existing
GenModel for XMLTypePackage in the final wizard or create a new
GenPackage for it?


Gilbert Mirenque wrote:
> Ed Merks wrote:
>
>> XMLTypePackage has EDataTypes for the XML Schema built-in simple types...
>>
> found it
>
>
>> Perhaps if you use the Sample Ecore Editor to load it and make your
>> first reference to it, after that the diagram editor will let you work
>> with it...
>>
> Ok so it works. If you add a reference in the sample editor first you
> can work with the imported package in the ecore diagram editor as well.
> But now I have another problem. In my genmodel the imported package
> appears as well - understandable. The generation of the editor worked
> fine except an error in one test class. For now I commented the line out
> where a not existent method is to be invoked. But in the new eclipse
> instance, where I want to work with my editor, I get the following error
> when starting the creation wizard:
>
> Plug-in "myplugin.editor" was unable to instantiate class
> "myplugin.presentation.ModelWizard".
> Could not initialize class myplugin.MyModelPackage
>
> that's caused by the following line in the init method of my package impl:
>
> TypePackageImpl theTypePackage =
> (TypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(Typ ePackage.eNS_URI)
> instanceof TypePackageImpl ?
> EPackage.Registry.INSTANCE.getEPackage(TypePackage.eNS_URI) :
> TypePackage.eINSTANCE);
>
> and by the following line in my imported TypePackageImpl:
> XMLTypePackage theXMLTypePackage =
> (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTy pePackage.eNS_URI);
>
>
> What can I do to avoid this?
>

--------------020309040302040608060207
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Gilbert,<br>
<br>
How exactly do those lines cause a problem?  The XMLTypePackage does
exist.  When you created your GenModel, did you choose the existing
GenModel for XMLTypePackage in the final wizard or create a new
GenPackage for it?  <br>
<br>
<br>
Gilbert Mirenque wrote:
<blockquote cite="mid:h46pa9$fpk$1@build.eclipse.org" type="cite">
<pre wrap="">Ed Merks wrote:
</pre>
<blockquote type="cite">
<pre wrap="">XMLTypePackage has EDataTypes for the XML Schema built-in simple types...
</pre>
</blockquote>
<pre wrap=""><!---->found it

</pre>
<blockquote type="cite">
<pre wrap="">Perhaps if you use the Sample Ecore Editor to load it and make your
first reference to it, after that the diagram editor will let you work
with it...
</pre>
</blockquote>
<pre wrap=""><!---->Ok so it works. If you add a reference in the sample editor first you
can work with the imported package in the ecore diagram editor as well.
But now I have another problem. In my genmodel the imported package
appears as well - understandable. The generation of the editor worked
fine except an error in one test class. For now I commented the line out
where a not existent method is to be invoked. But in the new eclipse
instance, where I want to work with my editor, I get the following error
when starting the creation wizard:

Plug-in "myplugin.editor" was unable to instantiate class
"myplugin.presentation.ModelWizard".
Could not initialize class myplugin.MyModelPackage

that's caused by the following line in the init method of my package impl:

TypePackageImpl theTypePackage =
(TypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(Typ ePackage.eNS_URI)
instanceof TypePackageImpl ?
EPackage.Registry.INSTANCE.getEPackage(TypePackage.eNS_URI) :
TypePackage.eINSTANCE);

and by the following line in my imported TypePackageImpl:
XMLTypePackage theXMLTypePackage =
(XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTy pePackage.eNS_URI);


What can I do to avoid this?
</pre>
</blockquote>
</body>
</html>

--------------020309040302040608060207--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Possible to reference a xml simple type`? [message #431713 is a reply to message #431705] Wed, 22 July 2009 14:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Ed Merks wrote:
> Gilbert,
>
> How exactly do those lines cause a problem? The XMLTypePackage does
> exist. When you created your GenModel, did you choose the existing
> GenModel for XMLTypePackage in the final wizard or create a new
> GenPackage for it?

In my genmodel appeared a new package for the XMLTypePackage
automatically when adding references to it in my metamodel. How can I
specify to choose an existing genmodel and where do I find it?
Re: Possible to reference a xml simple type`? [message #431743 is a reply to message #431713] Thu, 23 July 2009 15:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020004050408070001010402
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Gilbert,

The bottom 1/2 of the wizard should support that. Have a look at how a
model generated from an XSD looks and try to make it look like that...


Gilbert Mirenque wrote:
> Ed Merks wrote:
>
>> Gilbert,
>>
>> How exactly do those lines cause a problem? The XMLTypePackage does
>> exist. When you created your GenModel, did you choose the existing
>> GenModel for XMLTypePackage in the final wizard or create a new
>> GenPackage for it?
>>
>
> In my genmodel appeared a new package for the XMLTypePackage
> automatically when adding references to it in my metamodel. How can I
> specify to choose an existing genmodel and where do I find it?
>

--------------020004050408070001010402
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Gilbert,<br>
<br>
The bottom 1/2 of the wizard should support that.  Have a look at how a
model generated from an XSD looks and try to make it look like that...<br>
<br>
<br>
Gilbert Mirenque wrote:
<blockquote cite="mid:h479f4$fnr$1@build.eclipse.org" type="cite">
<pre wrap="">Ed Merks wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Gilbert,

How exactly do those lines cause a problem? The XMLTypePackage does
exist. When you created your GenModel, did you choose the existing
GenModel for XMLTypePackage in the final wizard or create a new
GenPackage for it?
</pre>
</blockquote>
<pre wrap=""><!---->
In my genmodel appeared a new package for the XMLTypePackage
automatically when adding references to it in my metamodel. How can I
specify to choose an existing genmodel and where do I find it?
</pre>
</blockquote>
</body>
</html>

--------------020004050408070001010402--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Possible to reference a xml simple type`? [message #431778 is a reply to message #431743] Sat, 25 July 2009 12:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Ed Merks wrote:
> Gilbert,
>
> The bottom 1/2 of the wizard should support that. Have a look at how a
> model generated from an XSD looks and try to make it look like that...
>

Ok, it works in that way if you delete the genmodel and generate it
again. But you can't reference the other genmodel if your own genmodel
already exists - or I didn't find it.
But I think my explanation from my first post was a little bit
underinformed (nice word ;) ). I try to explain in other words what I
want to do:
I start from behind. With the generated editor I want to create a model
for my domain. In this domain I need datatypes as well. My idea was that
it would be nice if one can reference existing XML simple datatypes such
as xs:string for example. Or one has the option to create special types
and reference those. That's why I thought that I can create a class
(AbstractDatatype) in my metamodel inheriting from a root class of the
XMLTypes package. I thought there is a class from which all simple xml
types inherit, which I can use as parent class for my AbstractDatatype.
Furthermore my idea was that now I simply can reference the parent class
of all simple XML types in my metamodel. I thought that by that I can
then reference all XML simple types or an own special type (inheriting
from the parent XML simple type). That means I don't want to use the
metaelements from the XMLTypes package and the concrete types in my
generated editor or alternatively some special types. Is it
udnerstandable? And the more important question: is it possible?

best regards,
Gilbert
Re: Possible to reference a xml simple type`? [message #431779 is a reply to message #431778] Sat, 25 July 2009 13:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

I have another idea. Maybe the following scenario is possible:

in the second Eclipse instance where the generated editor is available:
- create a new XML schema
- create an instance of my metamodel with the generated editor
- in that instance load the created xml schema as resource
- in that instance reference a type contained in the xml schema

Is that possible or is it to freaky?
Re: Possible to reference a xml simple type`? [message #431780 is a reply to message #431779] Sat, 25 July 2009 14:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Gilbert,

This article describes some of the steps that occur when converting an
XML Schema to an Ecore model. While the XML Schema simple types indeed
form a hierarchy, it's not possible to reflect that in Java's type
system because the existing Java types don't form the same hierarchy.


Gilbert Mirenque wrote:
> I have another idea. Maybe the following scenario is possible:
>
> in the second Eclipse instance where the generated editor is available:
> - create a new XML schema
> - create an instance of my metamodel with the generated editor
> - in that instance load the created xml schema as resource
> - in that instance reference a type contained in the xml schema
>
> Is that possible or is it to freaky?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Possible to reference a xml simple type`? [message #431879 is a reply to message #431743] Tue, 28 July 2009 15:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

I'm interested in how to reference an existing genmodel in my own
existing genmodel? If I load a resource in the ecore file I can add
references to the loaded model. But by that my genmodel won't contain a
reference to the genmodel from which the model was loaded. I have real
packages. How do I do this when my genmodel already exists? How do I
reference a genmodel from the emf registry?
Re: Possible to reference a xml simple type`? [message #431886 is a reply to message #431879] Tue, 28 July 2009 16:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Gilbert,

The last page of the wizard should allow you to locate GenModels for any
packages being loaded. For packages that are registered, they should be
suggested automatically. For ones in the workspace, you need to use the
Browse... button to locate them...


Gilbert Mirenque wrote:
> I'm interested in how to reference an existing genmodel in my own
> existing genmodel? If I load a resource in the ecore file I can add
> references to the loaded model. But by that my genmodel won't contain a
> reference to the genmodel from which the model was loaded. I have real
> packages. How do I do this when my genmodel already exists? How do I
> reference a genmodel from the emf registry?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Possible to reference a xml simple type`? [message #431895 is a reply to message #431886] Tue, 28 July 2009 19:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Ed Merks wrote:
> The last page of the wizard should allow you to locate GenModels for any
> packages being loaded.
This is right - but the wizard can only be used when I want to create a
new genmodel. My genmodel exists already so I can't use it :/
Re: Possible to reference a xml simple type`? [message #431897 is a reply to message #431895] Tue, 28 July 2009 23:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010309040502030107050409
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Gilbert,

Reload... uses the same wizard.

Gilbert Mirenque wrote:
> Ed Merks wrote:
>
>> The last page of the wizard should allow you to locate GenModels for any
>> packages being loaded.
>>
> This is right - but the wizard can only be used when I want to create a
> new genmodel. My genmodel exists already so I can't use it :/
>

--------------010309040502030107050409
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Gilbert,<br>
<br>
Reload... uses the same wizard.<br>
<br>
Gilbert Mirenque wrote:
<blockquote cite="mid:h4nibi$4qd$1@build.eclipse.org" type="cite">
<pre wrap="">Ed Merks wrote:
</pre>
<blockquote type="cite">
<pre wrap="">The last page of the wizard should allow you to locate GenModels for any
packages being loaded.
</pre>
</blockquote>
<pre wrap=""><!---->This is right - but the wizard can only be used when I want to create a
new genmodel. My genmodel exists already so I can't use it :/
</pre>
</blockquote>
</body>
</html>

--------------010309040502030107050409--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:resource utility example unable to find hibernate
Next Topic:Generating EMF EPackages for all xsd URIs
Goto Forum:
  


Current Time: Thu Apr 18 20:57:53 GMT 2024

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

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

Back to the top