Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » model myself an EBooleanObject
model myself an EBooleanObject [message #687178] Sat, 11 June 2011 09:07 Go to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
I not managed to model a EDataType which behaves as EBooleanObject, e.g.
having the possible values true,false and null. Anybody knows how to
achieve this with the ecore editor?
Re: model myself an EBooleanObject [message #687181 is a reply to message #687178] Sat, 11 June 2011 17:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
There's a reset button in the properties view for setting the back to
null. You can also look at the EMF recipes in the wiki for how to
define your own specialized editor.


exquisitus wrote:
> I not managed to model a EDataType which behaves as EBooleanObject,
> e.g. having the possible values true,false and null. Anybody knows how
> to achieve this with the ecore editor?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model myself an EBooleanObject [message #687183 is a reply to message #687181] Sun, 12 June 2011 11:34 Go to previous messageGo to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
What to you mean with "back"? do you refer to the "Ecore Diagram
Editing" editor or the "Sample Ecore Model Editor" or the "Sample
Reflective Edore Model Editor" (by the way, what is the diff between the
last two?)?

> There's a reset button in the properties view for setting the back to
> null. You can also look at the EMF recipes in the wiki for how to define
> your own specialized editor.
>
>
> exquisitus wrote:
>> I not managed to model a EDataType which behaves as EBooleanObject,
>> e.g. having the possible values true,false and null. Anybody knows how
>> to achieve this with the ecore editor?
Re: model myself an EBooleanObject [message #687185 is a reply to message #687183] Sun, 12 June 2011 16:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Comments below.

exquisitus wrote:
> What to you mean with "back"?
It starts out as null, right, so you'd be setting it back to the
original default value.
> do you refer to the "Ecore Diagram Editing" editor or the "Sample
> Ecore Model Editor" or the "Sample Reflective Edore Model Editor" (by
> the way, what is the diff between the last two?)?
I'm referring to the generated editor for your model. The Sample Ecore
Model Editor is for editing instances of Ecore, e.g., *.ecore files, the
Sample Reflective Ecore Model Editor is for editing instances of any
arbitrary model, e.g., Library instances stored *.library files.
>
> > There's a reset button in the properties view for setting the back to
> > null. You can also look at the EMF recipes in the wiki for how to
> define
> > your own specialized editor.
> >
> >
> > exquisitus wrote:
> >> I not managed to model a EDataType which behaves as EBooleanObject,
> >> e.g. having the possible values true,false and null. Anybody knows how
> >> to achieve this with the ecore editor?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model myself an EBooleanObject [message #687187 is a reply to message #687185] Mon, 13 June 2011 04:59 Go to previous messageGo to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
> I'm referring to the generated editor for your model. The Sample Ecore
> Model Editor is for editing instances of Ecore, e.g., *.ecore files, the
I also mean how to do my task with the Ecore editor, not the generated
editor. I want to edit the Ecore file, but dont know how to achieve my
goal. I copied from Ecore.ecore the following into my ecore metamodel:


<eClassifiers xsi:type="ecore:EDataType" name="EBooleanObject"
instanceClassName="java.lang.Boolean">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="baseType" value="EBoolean"/>
<details key="name" value="EBoolean:Object"/>
</eAnnotations>
</eClassifiers>

So I not named it "EBooleanObject" but "LOGICAL". However my datatype
not behaves as EBooleanObject, since I can store only the state true and
false, not the state true, false and null. So EBooleanObject finally
supports 4 states:
true
false
null
not-set

My plagiarism supports only 3 states
true
false
not-set

So I cannot store "null", what did I miss?

Background: for some reasons, I do not want to use EBooleanObject
directly in my metamodel but an own datatype. But I will end up using it
directly if I can not find out how to do a EBooleanObject plagiarism.
Re: model myself an EBooleanObject [message #687188 is a reply to message #687187] Mon, 13 June 2011 10:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Comments below.

exquisitus wrote:
> > I'm referring to the generated editor for your model. The Sample Ecore
> > Model Editor is for editing instances of Ecore, e.g., *.ecore files,
> the
> I also mean how to do my task with the Ecore editor, not the generated
> editor.
In that case, what you see is all you get. If you want more, you'd need
to do what I mentioned in the recipe in the wiki.
> I want to edit the Ecore file, but dont know how to achieve my goal. I
> copied from Ecore.ecore the following into my ecore metamodel:
>
>
> <eClassifiers xsi:type="ecore:EDataType" name="EBooleanObject"
> instanceClassName="java.lang.Boolean">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="baseType" value="EBoolean"/>
> <details key="name" value="EBoolean:Object"/>
> </eAnnotations>
> </eClassifiers>
>
> So I not named it "EBooleanObject" but "LOGICAL". However my datatype
> not behaves as EBooleanObject, since I can store only the state true
> and false, not the state true, false and null. So EBooleanObject
> finally supports 4 states:
> true
> false
> null
> not-set
Only if your feature is unsettable (which has nothing to do with the
type). You've not mentioned whether that's the case or not.
>
> My plagiarism supports only 3 states
> true
> false
> not-set
So then you want an unsettable feature of type boolean or a plain old EEnum.
>
> So I cannot store "null", what did I miss?
The problem is whether it's null that's really important or whether it's
having a third state that's important; you decide that.
>
> Background: for some reasons, I do not want to use EBooleanObject
> directly in my metamodel but an own datatype.
And why might that be?
> But I will end up using it directly if I can not find out how to do a
> EBooleanObject plagiarism.
If you need to specialize anything, you'll need to do it via code in a
specialized editor.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model myself an EBooleanObject [message #687189 is a reply to message #687188] Tue, 14 June 2011 00:01 Go to previous messageGo to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
>> So I cannot store "null", what did I miss?
> The problem is whether it's null that's really important or whether it's
> having a third state that's important; you decide that.

Yes, I want a third state. Exactly like EBooleanObject has also a third
state. But I do not know how to copy the EBooleanObject EDataType into
my model, it seems that EBooleanObject only works in that ecore plugin
it originates from.
Re: model myself an EBooleanObject [message #687190 is a reply to message #687188] Tue, 14 June 2011 00:12 Go to previous messageGo to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
>> Background: for some reasons, I do not want to use EBooleanObject
>> directly in my metamodel but an own datatype.
> And why might that be?

The metamodel is actually output of a QVT transformation, the QVT engine
is Tefkat, and in order to use EBooleanObject directly, would mean to
load the Ecore metametamodel as model input into Tefkat, find the
EDatatype named "EBooleanObject" and link it to the generated metamodel.

Besides the question if this is possible with the prototyped QVT engine
Tefkat at all (it served as input for the QVT standard, but then is
actually quite different from it), I hoped not to be forced to try it.
revision [message #687191 is a reply to message #687188] Tue, 14 June 2011 00:41 Go to previous messageGo to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
I have written unit tests (maybe I should have done earlier..) and it
revealed that actually my own EBooleanObject plagiarism works using only
simple model manipulations, so I guess the error is somewhere elsewhere
in my code, or e.g. in CDO, as actually the model was retrieved from the
DB, maybe the CDO DB not handled my EBooleanObject plagiarism correctly,
to be continued..
Re: model myself an EBooleanObject [message #687192 is a reply to message #687188] Tue, 14 June 2011 02:09 Go to previous messageGo to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
I think I have identifier the source of error.
TBooleanObject is handled by CDO in special by CDOTypeImpl.BOOLEAN_OBJECT

But my EBooleanObject plagiarism is handled by CDOTypeImpl.CUSTOM.

So while CDOTypeImpl.BOOLEAN_OBJECT not tries to convert NIL to a string
representation, CDOTypeImpl.CUSTOM does it, resulting in something like
e.g. "Object@123" (which is NIL.toString()).

Later, when I retrieve the attribute value, in comes down to an
invocation of java.lang.Boolean.valueOf("Object@123"), which returns
false, so thats why the null-value is mapped to false for my plagiarism.

I am not familiar with CDO, its the question now if CDO is really
required to handle EBooleanObject in special, or should it handle it
like a user-defined EDataType? So dont know if its a CDO bug or not,
what do you think, Ed?
Re: model myself an EBooleanObject [message #687198 is a reply to message #687192] Tue, 14 June 2011 12:53 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
I'm having a hard time following this thread. I can't comment on
details of CDO's implementation. That's a question for Eike, but I'm not
sure he understands how you arrived at this point...

exquisitus wrote:
> I think I have identifier the source of error.
> TBooleanObject is handled by CDO in special by CDOTypeImpl.BOOLEAN_OBJECT
>
> But my EBooleanObject plagiarism is handled by CDOTypeImpl.CUSTOM.
>
> So while CDOTypeImpl.BOOLEAN_OBJECT not tries to convert NIL to a
> string representation, CDOTypeImpl.CUSTOM does it, resulting in
> something like e.g. "Object@123" (which is NIL.toString()).
>
> Later, when I retrieve the attribute value, in comes down to an
> invocation of java.lang.Boolean.valueOf("Object@123"), which returns
> false, so thats why the null-value is mapped to false for my plagiarism.
>
> I am not familiar with CDO, its the question now if CDO is really
> required to handle EBooleanObject in special, or should it handle it
> like a user-defined EDataType? So dont know if its a CDO bug or not,
> what do you think, Ed?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model myself an EBooleanObject [message #687438 is a reply to message #687178] Sat, 11 June 2011 17:02 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
There's a reset button in the properties view for setting the back to
null. You can also look at the EMF recipes in the wiki for how to
define your own specialized editor.


exquisitus wrote:
> I not managed to model a EDataType which behaves as EBooleanObject,
> e.g. having the possible values true,false and null. Anybody knows how
> to achieve this with the ecore editor?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model myself an EBooleanObject [message #687440 is a reply to message #687181] Sun, 12 June 2011 11:34 Go to previous message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
What to you mean with "back"? do you refer to the "Ecore Diagram
Editing" editor or the "Sample Ecore Model Editor" or the "Sample
Reflective Edore Model Editor" (by the way, what is the diff between the
last two?)?

> There's a reset button in the properties view for setting the back to
> null. You can also look at the EMF recipes in the wiki for how to define
> your own specialized editor.
>
>
> exquisitus wrote:
>> I not managed to model a EDataType which behaves as EBooleanObject,
>> e.g. having the possible values true,false and null. Anybody knows how
>> to achieve this with the ecore editor?
Re: model myself an EBooleanObject [message #687442 is a reply to message #687183] Sun, 12 June 2011 16:22 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Comments below.

exquisitus wrote:
> What to you mean with "back"?
It starts out as null, right, so you'd be setting it back to the
original default value.
> do you refer to the "Ecore Diagram Editing" editor or the "Sample
> Ecore Model Editor" or the "Sample Reflective Edore Model Editor" (by
> the way, what is the diff between the last two?)?
I'm referring to the generated editor for your model. The Sample Ecore
Model Editor is for editing instances of Ecore, e.g., *.ecore files, the
Sample Reflective Ecore Model Editor is for editing instances of any
arbitrary model, e.g., Library instances stored *.library files.
>
> > There's a reset button in the properties view for setting the back to
> > null. You can also look at the EMF recipes in the wiki for how to
> define
> > your own specialized editor.
> >
> >
> > exquisitus wrote:
> >> I not managed to model a EDataType which behaves as EBooleanObject,
> >> e.g. having the possible values true,false and null. Anybody knows how
> >> to achieve this with the ecore editor?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model myself an EBooleanObject [message #687445 is a reply to message #687185] Mon, 13 June 2011 04:59 Go to previous message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
> I'm referring to the generated editor for your model. The Sample Ecore
> Model Editor is for editing instances of Ecore, e.g., *.ecore files, the
I also mean how to do my task with the Ecore editor, not the generated
editor. I want to edit the Ecore file, but dont know how to achieve my
goal. I copied from Ecore.ecore the following into my ecore metamodel:


<eClassifiers xsi:type="ecore:EDataType" name="EBooleanObject"
instanceClassName="java.lang.Boolean">
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="baseType" value="EBoolean"/>
<details key="name" value="EBoolean:Object"/>
</eAnnotations>
</eClassifiers>

So I not named it "EBooleanObject" but "LOGICAL". However my datatype
not behaves as EBooleanObject, since I can store only the state true and
false, not the state true, false and null. So EBooleanObject finally
supports 4 states:
true
false
null
not-set

My plagiarism supports only 3 states
true
false
not-set

So I cannot store "null", what did I miss?

Background: for some reasons, I do not want to use EBooleanObject
directly in my metamodel but an own datatype. But I will end up using it
directly if I can not find out how to do a EBooleanObject plagiarism.
Re: model myself an EBooleanObject [message #687446 is a reply to message #687187] Mon, 13 June 2011 10:54 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Comments below.

exquisitus wrote:
> > I'm referring to the generated editor for your model. The Sample Ecore
> > Model Editor is for editing instances of Ecore, e.g., *.ecore files,
> the
> I also mean how to do my task with the Ecore editor, not the generated
> editor.
In that case, what you see is all you get. If you want more, you'd need
to do what I mentioned in the recipe in the wiki.
> I want to edit the Ecore file, but dont know how to achieve my goal. I
> copied from Ecore.ecore the following into my ecore metamodel:
>
>
> <eClassifiers xsi:type="ecore:EDataType" name="EBooleanObject"
> instanceClassName="java.lang.Boolean">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="baseType" value="EBoolean"/>
> <details key="name" value="EBoolean:Object"/>
> </eAnnotations>
> </eClassifiers>
>
> So I not named it "EBooleanObject" but "LOGICAL". However my datatype
> not behaves as EBooleanObject, since I can store only the state true
> and false, not the state true, false and null. So EBooleanObject
> finally supports 4 states:
> true
> false
> null
> not-set
Only if your feature is unsettable (which has nothing to do with the
type). You've not mentioned whether that's the case or not.
>
> My plagiarism supports only 3 states
> true
> false
> not-set
So then you want an unsettable feature of type boolean or a plain old EEnum.
>
> So I cannot store "null", what did I miss?
The problem is whether it's null that's really important or whether it's
having a third state that's important; you decide that.
>
> Background: for some reasons, I do not want to use EBooleanObject
> directly in my metamodel but an own datatype.
And why might that be?
> But I will end up using it directly if I can not find out how to do a
> EBooleanObject plagiarism.
If you need to specialize anything, you'll need to do it via code in a
specialized editor.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model myself an EBooleanObject [message #687449 is a reply to message #687188] Tue, 14 June 2011 00:01 Go to previous message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
>> So I cannot store "null", what did I miss?
> The problem is whether it's null that's really important or whether it's
> having a third state that's important; you decide that.

Yes, I want a third state. Exactly like EBooleanObject has also a third
state. But I do not know how to copy the EBooleanObject EDataType into
my model, it seems that EBooleanObject only works in that ecore plugin
it originates from.
Re: model myself an EBooleanObject [message #687450 is a reply to message #687188] Tue, 14 June 2011 00:12 Go to previous message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
>> Background: for some reasons, I do not want to use EBooleanObject
>> directly in my metamodel but an own datatype.
> And why might that be?

The metamodel is actually output of a QVT transformation, the QVT engine
is Tefkat, and in order to use EBooleanObject directly, would mean to
load the Ecore metametamodel as model input into Tefkat, find the
EDatatype named "EBooleanObject" and link it to the generated metamodel.

Besides the question if this is possible with the prototyped QVT engine
Tefkat at all (it served as input for the QVT standard, but then is
actually quite different from it), I hoped not to be forced to try it.
revision [message #687451 is a reply to message #687188] Tue, 14 June 2011 00:41 Go to previous message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
I have written unit tests (maybe I should have done earlier..) and it
revealed that actually my own EBooleanObject plagiarism works using only
simple model manipulations, so I guess the error is somewhere elsewhere
in my code, or e.g. in CDO, as actually the model was retrieved from the
DB, maybe the CDO DB not handled my EBooleanObject plagiarism correctly,
to be continued..
Re: model myself an EBooleanObject [message #687452 is a reply to message #687188] Tue, 14 June 2011 02:09 Go to previous message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
I think I have identifier the source of error.
TBooleanObject is handled by CDO in special by CDOTypeImpl.BOOLEAN_OBJECT

But my EBooleanObject plagiarism is handled by CDOTypeImpl.CUSTOM.

So while CDOTypeImpl.BOOLEAN_OBJECT not tries to convert NIL to a string
representation, CDOTypeImpl.CUSTOM does it, resulting in something like
e.g. "Object@123" (which is NIL.toString()).

Later, when I retrieve the attribute value, in comes down to an
invocation of java.lang.Boolean.valueOf("Object@123"), which returns
false, so thats why the null-value is mapped to false for my plagiarism.

I am not familiar with CDO, its the question now if CDO is really
required to handle EBooleanObject in special, or should it handle it
like a user-defined EDataType? So dont know if its a CDO bug or not,
what do you think, Ed?
Re: model myself an EBooleanObject [message #687461 is a reply to message #687192] Tue, 14 June 2011 12:53 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
I'm having a hard time following this thread. I can't comment on
details of CDO's implementation. That's a question for Eike, but I'm not
sure he understands how you arrived at this point...

exquisitus wrote:
> I think I have identifier the source of error.
> TBooleanObject is handled by CDO in special by CDOTypeImpl.BOOLEAN_OBJECT
>
> But my EBooleanObject plagiarism is handled by CDOTypeImpl.CUSTOM.
>
> So while CDOTypeImpl.BOOLEAN_OBJECT not tries to convert NIL to a
> string representation, CDOTypeImpl.CUSTOM does it, resulting in
> something like e.g. "Object@123" (which is NIL.toString()).
>
> Later, when I retrieve the attribute value, in comes down to an
> invocation of java.lang.Boolean.valueOf("Object@123"), which returns
> false, so thats why the null-value is mapped to false for my plagiarism.
>
> I am not familiar with CDO, its the question now if CDO is really
> required to handle EBooleanObject in special, or should it handle it
> like a user-defined EDataType? So dont know if its a CDO bug or not,
> what do you think, Ed?
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:(no subject)
Next Topic:(no subject)
Goto Forum:
  


Current Time: Tue Apr 16 22:42:18 GMT 2024

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

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

Back to the top