| Home » Modeling » GMF (Graphical Modeling Framework) » required attributes in semantic model not present, bug?
 Goto Forum:| 
| required attributes in semantic model not present, bug? [message #121021] | Fri, 20 April 2007 15:34  |  | 
| Eclipse User  |  |  |  |  | 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 #121309 is a reply to message #121021] | Mon, 23 April 2007 09:54   |  | 
| Eclipse User  |  |  |  |  | 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 11:10  |  | 
| Eclipse User  |  |  |  |  | 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
 |  |  |  | 
 
 
 Current Time: Wed Oct 29 20:10:35 EDT 2025 
 Powered by FUDForum . Page generated in 0.03956 seconds |