Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » PrimitiveTypes For Metamodel
PrimitiveTypes For Metamodel [message #1162163] Wed, 30 October 2013 07:40 Go to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi all,

I need to create primitive types for my metamodel. When user create ScalarProperty

type must be one of Int32 or Binary. But i dont want to create Instance of Int32 or

Binary. I just need to ref this class so

How can i do this ?

my metamodel;

class ScalarProperty extends SingleProperty {
  attr String defaultValue;
  ref  EDataType[1] type;
}

class Type {
}

class Int32 extends Type{
}

class Binary extends Type {
}

...


Regards
Re: PrimitiveTypes For Metamodel [message #1162437 is a reply to message #1162163] Wed, 30 October 2013 11:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Serhat,

Comments below.

On 30/10/2013 8:40 AM, serhat gezgin wrote:
> Hi all,
>
> I need to create primitive types for my metamodel.
Or you mean more like built-in types?
> When user create ScalarProperty
> type must be one of Int32 or Binary. But i dont want to create
> Instance of Int32 or
> Binary.
So you likely need some type of "library" resource that contains your
definitions of such things and that resource should be packaged in your
bundle so it can be referenced by other model instances.
> I just need to ref this class so
> How can i do this ?
You can look at how Ecore makes things like EString available. Or at
how Xcore's org.eclipse.emf.xcore.lib provides library files, in this
case to define built-in annotation declarations...
>
> my metamodel;
>
>
> class ScalarProperty extends SingleProperty {
> attr String defaultValue;
> ref EDataType[1] type;
> }
>
> class Type {
> }
>
> class Int32 extends Type{
> }
>
> class Binary extends Type {
> }
>
> ..
>
>
> Regards


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: PrimitiveTypes For Metamodel [message #1162898 is a reply to message #1162437] Wed, 30 October 2013 17:54 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi Ed,

Yes i mean built-in types Smile

i look to ecore.ecore but don't understand. They do this with datatypes ?


@Ecore(constraints="WellFormedInstanceTypeName UniqueTypeParameterNames")
abstract class EClassifier extends ENamedElement {
  op EBoolean isInstance(EJavaObject object);
  op EInt getClassifierID();

  @GenModel(suppressedIsSetVisibility="true", suppressedUnsetVisibility="true")
  volatile unsettable attr EString instanceClassName;
  readonly volatile transient derived attr EJavaClass<?> instanceClass;
  readonly volatile transient derived attr EJavaObject defaultValue;

  @GenModel(suppressedIsSetVisibility="true", suppressedUnsetVisibility="true")
  volatile unsettable attr EString instanceTypeName;
  readonly transient ref EPackage#eClassifiers ePackage;
  val ETypeParameter[*] eTypeParameters;
}

class EDataType extends EClassifier {
  attr EBoolean serializable = "true";
}

@ExtendedMetaData(baseType="http://www.w3.org/2001/XMLSchema#short")
datatype EShort : short;

@ExtendedMetaData(baseType="EShort", name="EShort:Object")
datatype EShortObject : java.lang.Short;

@ExtendedMetaData(baseType="http://www.w3.org/2001/XMLSchema#string")
datatype EString : java.lang.String;

...



i dont understand where is the resource of types ?

Regards
Re: PrimitiveTypes For Metamodel [message #1163911 is a reply to message #1162898] Thu, 31 October 2013 09:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Serhat,

Things like platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore can
be used to load the resource contained in that plugin/bundle. So you can
always define instance of any model, and keep them in your plugin and
ensure (via the build.properties) that the end up on the classpath of
the binary bundle and then they'll be available for any other model that
needs them.


On 30/10/2013 6:54 PM, serhat gezgin wrote:
> Hi Ed,
>
> Yes i mean built-in types :)
>
> i look to ecore.ecore but don't understand. They do this with datatypes ?
>
>
>
> @Ecore(constraints="WellFormedInstanceTypeName UniqueTypeParameterNames")
> abstract class EClassifier extends ENamedElement {
> op EBoolean isInstance(EJavaObject object);
> op EInt getClassifierID();
>
> @GenModel(suppressedIsSetVisibility="true",
> suppressedUnsetVisibility="true")
> volatile unsettable attr EString instanceClassName;
> readonly volatile transient derived attr EJavaClass<?> instanceClass;
> readonly volatile transient derived attr EJavaObject defaultValue;
>
> @GenModel(suppressedIsSetVisibility="true",
> suppressedUnsetVisibility="true")
> volatile unsettable attr EString instanceTypeName;
> readonly transient ref EPackage#eClassifiers ePackage;
> val ETypeParameter[*] eTypeParameters;
> }
>
> class EDataType extends EClassifier {
> attr EBoolean serializable = "true";
> }
>
> @ExtendedMetaData(baseType="http://www.w3.org/2001/XMLSchema#short")
> datatype EShort : short;
>
> @ExtendedMetaData(baseType="EShort", name="EShort:Object")
> datatype EShortObject : java.lang.Short;
>
> @ExtendedMetaData(baseType="http://www.w3.org/2001/XMLSchema#string")
> datatype EString : java.lang.String;
>
> ..
>
>
>
> i dont understand where is the resource of types ?
>
> Regards


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: PrimitiveTypes For Metamodel [message #1167304 is a reply to message #1163911] Sat, 02 November 2013 15:07 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi Ed,

If i understand correctly, i must create MyMeta.ecore

than i must create insteance from this model MyMeta.xmi (Because .ecore file include my Type Clasees) and create insteance of types

after that i must load MyMeta.xmi to MyMeta.ecore ?

Am i right ? is this the correct way ?

or do i completely wrong Embarrassed ?

Regards
Re: PrimitiveTypes For Metamodel [message #1167446 is a reply to message #1167304] Sat, 02 November 2013 17:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Serhat,

No, the point is you can store any resource in your bundle itself and
access it using
platform:/plugin/<plugin-id>/<path-to-resource>/<resource-name> and you
can load that into any resource set. So you can store "static
instances" of any model. Ecore.ecore is just an example. There's also
Ecore.genmodel in there. So just store your MyMeta.xmi with your
"library" instance.


On 02/11/2013 4:07 PM, serhat gezgin wrote:
> Hi Ed,
>
> If i understand correctly, i must create MyMeta.ecore
>
> than i must create insteance from this model MyMeta.xmi (Because
> .ecore file include my Type Clasees) and create insteance of types
>
> after that i must load MyMeta.xmi to MyMeta.ecore ?
>
> Am i right ? is this the correct way ?
>
> or do i completely wrong :blush: ?
>
> Regards


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: PrimitiveTypes For Metamodel [message #1168641 is a reply to message #1167446] Sun, 03 November 2013 12:58 Go to previous message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi Ed,

Finally I solved the problem with your suggestions Smile

Regards
Previous Topic:[EMFStore] Problem sharing project
Next Topic:[EMF Client Platform] Date UI in German
Goto Forum:
  


Current Time: Fri Mar 29 10:57:59 GMT 2024

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

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

Back to the top