Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » required attributes in semantic model not present, bug?
required attributes in semantic model not present, bug? [message #121021] Fri, 20 April 2007 19:34 Go to next message
Eclipse UserFriend
Originally posted by: jacob.barde.swri.org

I have defined several _required_ attributes in my model, some with
default values.

When generating a diagram, if these attributes with default values are
not changed, the resulting semantic model will not include those
attributes with their default values in the element.

E.g.
Pipe 'foobar':
-name="foobar" (String)
-length=10 (Double, default=5, req.)
-diameter=1 (Double, default=1, req.)
-friction=0.35 (Double, default=0.35, req.)


the semantic model diagram xml results as this:
....
<nodes xmi:type="foo:Pipe" xmi:id="_KIzOsO3iEdujV4yBOSY8tQ"
name="foobar" length="10.0"/>
....

Needless to say, the genmodel generated XSD file gives me plenty of
"XSD: The 'use' must be 'optional' when a 'default' is present" errors
(and I understand why). Even the required attributes without default
values get a 'default=""' in the schema.

Is this all a known bug? Or perhaps there's a workaround to it? Or
maybe I'm doing something wrong?

FYI, I'm using GMFv2 M6...

Regards,

Jacob
Re: required attributes in semantic model not present, bug? [message #121275 is a reply to message #121021] Mon, 23 April 2007 13:15 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jacob,

Can you try editing your model using EMF-generated editor? If you are getting
the same result then this is aproblem of EMF-generated code (I suppose so).

-----------------
Alex Shatalin
Re: required attributes in semantic model not present, bug? [message #121309 is a reply to message #121021] Mon, 23 April 2007 13:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Jacob,

The options XMLResource.OPTION_KEEP_DEFAULT_CONTENT mapped to
Boolean.TRUE is needed if you want EMF to save features for which eIsSet
is false. I can't reproduce the schema generation problem you describe
but if you can provide a test case that does reproduce that problem,
I'll be happy to have a look.


Jacob Barde wrote:
> I have defined several _required_ attributes in my model, some with
> default values.
>
> When generating a diagram, if these attributes with default values are
> not changed, the resulting semantic model will not include those
> attributes with their default values in the element.
>
> E.g.
> Pipe 'foobar':
> -name="foobar" (String)
> -length=10 (Double, default=5, req.)
> -diameter=1 (Double, default=1, req.)
> -friction=0.35 (Double, default=0.35, req.)
>
>
> the semantic model diagram xml results as this:
> ...
> <nodes xmi:type="foo:Pipe" xmi:id="_KIzOsO3iEdujV4yBOSY8tQ"
> name="foobar" length="10.0"/>
> ...
>
> Needless to say, the genmodel generated XSD file gives me plenty of
> "XSD: The 'use' must be 'optional' when a 'default' is present" errors
> (and I understand why). Even the required attributes without default
> values get a 'default=""' in the schema.
>
> Is this all a known bug? Or perhaps there's a workaround to it? Or
> maybe I'm doing something wrong?
>
> FYI, I'm using GMFv2 M6...
>
> Regards,
>
> Jacob
Re: required attributes in semantic model not present, bug? [message #121336 is a reply to message #121309] Mon, 23 April 2007 15:10 Go to previous message
Eclipse UserFriend
Originally posted by: jacob.barde.swri.org

Actually found something to get rid of the default="" in schema
production. An EMF/ecore editor context menu item for Default Literal
Value which I wasn't aware of, Restore Default Value... apparently if
you just edit/delete a value you had placed in the field, it treats it
as "". This menu item removes it completely, as if it had never been
set at all.

As for the required default values, I started in with some OCL
initialization, probably best that way.

Thanks guys.

-Jay

Ed Merks wrote:
> Jacob,
>
> The options XMLResource.OPTION_KEEP_DEFAULT_CONTENT mapped to
> Boolean.TRUE is needed if you want EMF to save features for which eIsSet
> is false. I can't reproduce the schema generation problem you describe
> but if you can provide a test case that does reproduce that problem,
> I'll be happy to have a look.
>
>
> Jacob Barde wrote:
>> I have defined several _required_ attributes in my model, some with
>> default values.
>>
>> When generating a diagram, if these attributes with default values are
>> not changed, the resulting semantic model will not include those
>> attributes with their default values in the element.
>>
>> E.g.
>> Pipe 'foobar':
>> -name="foobar" (String)
>> -length=10 (Double, default=5, req.)
>> -diameter=1 (Double, default=1, req.)
>> -friction=0.35 (Double, default=0.35, req.)
>>
>>
>> the semantic model diagram xml results as this:
>> ...
>> <nodes xmi:type="foo:Pipe" xmi:id="_KIzOsO3iEdujV4yBOSY8tQ"
>> name="foobar" length="10.0"/>
>> ...
>>
>> Needless to say, the genmodel generated XSD file gives me plenty of
>> "XSD: The 'use' must be 'optional' when a 'default' is present" errors
>> (and I understand why). Even the required attributes without default
>> values get a 'default=""' in the schema.
>>
>> Is this all a known bug? Or perhaps there's a workaround to it? Or
>> maybe I'm doing something wrong?
>>
>> FYI, I'm using GMFv2 M6...
>>
>> Regards,
>>
>> Jacob
Previous Topic:how to change the color of diagarmelemnts dynamically
Next Topic:Problem with fill style in Properties View (Apperance) if background color defined in gmfgraph
Goto Forum:
  


Current Time: Tue Jul 16 10:24:08 GMT 2024

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

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

Back to the top