Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "STEM Model Generator/EAnnotations"

(EPackage EAnnotations)
(Model Parameter Constraint EAnnotation)
 
(35 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
# Save the Ecore file
 
# Save the Ecore file
  
=== EAnnotations used in STEM's Model Generator ===
+
=== Annotating a STEM Computational Model Ecore ===
  
==== EPackage EAnnotations  ====
+
* EPackage
 +
** [[#STEM_Model_Generator_Marker_EAnnotation|http:///org/eclipse/stem/modelgen/generated]] (0..1)
 +
** [[#Author_Details_EAnnotation|http:///org/eclipse/stem/modelgen/author]] (0..1)
  
These are EAnnotations that should be applied to the parent EPackage of your STEM Disease/Population model.  
+
* EClass (all)
 +
** [[#STEM_Model_Generator_Marker_EAnnotation|http:///org/eclipse/stem/modelgen/generated]] (0..1)
  
{| width="500" cellspacing="0" cellpadding="2" border="1"
+
* EAttribute (all)
 +
** [[#STEM_Model_Generator_Marker_EAnnotation|http:///org/eclipse/stem/modelgen/generated]] (0..1)
 +
 
 +
* EClass extending IntegrationDecorator (Computational Models)
 +
** [[#Author_Details_EAnnotation|http:///org/eclipse/stem/modelgen/author]] (0..1)
 +
** [[#Model_Adapters_EAnnotation|http:///org/eclipse/stem/modelgen/model/adapters]] (0..1)
 +
** [[#Label_and_LabelValue_EAnnotations|http:///org/eclipse/stem/modelgen/model/label]] (0..1)
 +
** [[#Label_and_LabelValue_EAnnotations|http:///org/eclipse/stem/modelgen/model/labelvalue]] (0..1)
 +
 
 +
* EAttribute contained by EClass extending IntegrationDecorator (Model Parameters)
 +
** [[#Model_Parameter_UI_Messages_EAnnotation|http:///org/eclipse/stem/modelgen/modelparam/messages]] (0..1)
 +
** [[#Model_Parameter_Constraint_EAnnotation|http:///org/eclipse/stem/modelgen/modelparam/constraints]] (0..1)
 +
 
 +
* EAttribute contained by EClass extending IntegrationLabelValue (Compartments)
 +
** [[#Compartment_Type_EAnnotation|http:///org/eclipse/stem/modelgen/compartment/type]] (0..1)
 +
 
 +
=== EAnnotations used in STEM's Model Generator ===
 +
 
 +
==== STEM Model Generator Marker EAnnotation ====
 +
 
 +
{| width="800px" cellspacing="0" cellpadding="2" border="1"
 
|-
 
|-
 
| '''Description'''  
 
| '''Description'''  
 
| colspan="4" | Generator Marker Annotation
 
| colspan="4" | Generator Marker Annotation
|-
 
| '''Required?'''
 
| colspan="4" | Yes
 
 
|-
 
|-
 
| '''Source'''  
 
| '''Source'''  
 
| colspan="4" | http:///org/eclipse/stem/modelgen/generated
 
| colspan="4" | http:///org/eclipse/stem/modelgen/generated
 
|-
 
|-
| rowspan="2" | '''Details'''  
+
| width="100px" rowspan="2" | '''Details'''  
| ''Key''  
+
| width="100px"| ''Key''  
| ''Example Value''
+
| width="200px"|''Example Value''
| ''Description''
+
| width="400px"|''Description''
 
|-
 
|-
 
| version  
 
| version  
Line 46: Line 66:
 
|}
 
|}
  
==== Integration Decorator EAnnotations ====
 
  
===== EClass =====
+
==== Author Details EAnnotation ====
===== EAttribute =====
+
  
==== Integration Label EAnnotations ====
+
{| width="800px" cellspacing="0" cellpadding="2" border="1"
===== EClass =====
+
|-
==== Integration Label Value EAnnotations ====
+
| '''Description'''
===== EAttribute =====
+
| colspan="4" | Author Details Annotation.  Similar to the STEM Dublin Core.
 +
|-
 +
| '''Source'''
 +
| colspan="4" | http:///org/eclipse/stem/modelgen/author
 +
|-
 +
| width="100px" rowspan="2" | '''Details'''
 +
| width="100px"| ''Key''
 +
| width="200px"|''Example Value''
 +
| width="400px"|''Description''
 +
|-
 +
| tbd
 +
| tbd
 +
| tbd
 +
|}
 +
 
 +
 
 +
==== Model Adapters EAnnotation ====
 +
 
 +
{| width="800px" cellspacing="0" cellpadding="2" border="1"
 +
|-
 +
| '''Description'''
 +
| colspan="4" | STEM Adapter class references.  Used to define inheritance hierarchy of generated classes.
 +
|-
 +
| '''Source'''
 +
| colspan="4" | http:///org/eclipse/stem/modelgen/model/adapters
 +
|-
 +
| width="100px" rowspan="3" | '''Details'''
 +
| width="100px"| ''Key''
 +
| width="200px"|''Example Value''
 +
| width="400px"|''Description''
 +
|-
 +
| propertyEditorClass
 +
| MyDiseaseModel-PropertyEditor
 +
| The class name of property editor for the computational model
 +
|-
 +
| propertyEditor-SuperClass
 +
| StandardDisease-ModelPropertyEditor
 +
| The parent class name of property editor for the computational model
 +
|}
 +
 
 +
 
 +
==== Label and LabelValue EAnnotations ====
 +
 
 +
{| width="800px" cellspacing="0" cellpadding="2" border="1"
 +
|-
 +
| '''Description'''
 +
| colspan="4" | Model label EAnnotation. Defines the IntegrationLabels returned by the computational model's create*Label(...) method.
 +
|-
 +
| '''Source'''
 +
| colspan="4" | http:///org/eclipse/stem/modelgen/model/label
 +
|-
 +
| width="100px" rowspan="2" | '''Details'''
 +
| width="100px"| ''Key''
 +
| width="200px"|''Example Value''
 +
| width="400px"|''Description''
 +
|-
 +
| *
 +
| MyDiseaseModelLabel
 +
| The class name of the label created by this computational model
 +
|}
 +
 
 +
 
 +
{| width="800px" cellspacing="0" cellpadding="2" border="1"
 +
|-
 +
| '''Description'''
 +
| colspan="4" | Model label value EAnnotation. Defines the IntegrationLabelValues (which stores compartments) returned by the computational model's create*LabelValue(...) method.
 +
|-
 +
| '''Source'''
 +
| colspan="4" | http:///org/eclipse/stem/modelgen/model/labelvalue
 +
|-
 +
| width="100px" rowspan="2" | '''Details'''
 +
| width="100px"| ''Key''
 +
| width="200px"|''Example Value''
 +
| width="400px"|''Description''
 +
|-
 +
| *
 +
| MyDiseaseModelLabelValue
 +
| The LabelValue class name created by this computational model
 +
|}
 +
 
 +
 
 +
==== Compartment Type EAnnotation ====
 +
 
 +
{| width="800px" cellspacing="0" cellpadding="2" border="1"
 +
|-
 +
| '''Description'''
 +
| colspan="4" | Sets the compartment type in a IntegrationLabelValue EClass's EAttribute.
 +
|-
 +
| '''Source'''
 +
| colspan="4" | http:///org/eclipse/stem/modelgen/compartment/type
 +
|-
 +
| width="100px" rowspan="2" | '''Details'''
 +
| width="100px"| ''Key''
 +
| width="200px"|''Example Value''
 +
| width="400px"|''Description''
 +
|-
 +
| type
 +
| Standard
 +
| The compartment type. Valid values are ''Standard'', ''Incidence'', and ''Deaths''
 +
|}
 +
 
 +
 
 +
==== Model Parameter UI Messages EAnnotation ====
 +
 
 +
{| width="800px" cellspacing="0" cellpadding="2" border="1"
 +
|-
 +
| '''Description'''
 +
| colspan="4" | Defines UI strings applied to the EAttributes in the computational model's property editor.
 +
|-
 +
| '''Source'''
 +
| colspan="4" | http:///org/eclipse/stem/modelgen/modelparam/messages
 +
|-
 +
| width="100px" rowspan="6" | '''Details'''
 +
| width="100px"| ''Key''
 +
| width="200px"|''Example Value''
 +
| width="400px"|''Description''
 +
|-
 +
| name
 +
| Transmission Rate
 +
| Display name
 +
|-
 +
| tooltip
 +
| Transmission Rate is a value for doing something
 +
| Extended help message describing the purpose of the EAttribute/parameter
 +
|-
 +
| unit
 +
| ft/s
 +
| The expected units for the parameter
 +
|-
 +
| invalid
 +
| Transmission Rate is invalid
 +
| Message to display if the value does not satisfy the required constraints
 +
|-
 +
| missing
 +
| Transmission Rate is required
 +
| Message to display if a required value is missing
 +
|}
 +
 
 +
==== Model Parameter Constraints EAnnotation ====
 +
 
 +
{| width="800px" cellspacing="0" cellpadding="2" border="1"
 +
|-
 +
| '''Description'''
 +
| colspan="4" | Defines validation constraints applied to values for the EAttribute
 +
|-
 +
| '''Source'''
 +
| colspan="3" | http:///org/eclipse/stem/modelgen/modelparam/constraints
 +
|-
 +
| width="100px" rowspan="6" | '''Details'''
 +
| width="100px"| ''Key''
 +
| width="200px"| ''Example Value''
 +
| width="400px"| ''Description''
 +
|-
 +
| minValue
 +
| 0.0
 +
| Minimum numeric value allowed
 +
|-
 +
| maxValue
 +
| 1.0
 +
| Maximum numeric value allowed
 +
|}
  
 
== GenModel Settings  ==
 
== GenModel Settings  ==

Latest revision as of 17:34, 6 September 2012

STEM Model Generator EAnnotation info coming soon.

Ecore EAnnotations

To generate code complying with the STEM API, additional information must be passed to the code generator that is out-of-scope to EMF's Ecore and GenModel schemas. To get around this, Ecore EAnnotations are used to pass information to the code generator. In order to use an Ecore/GenModel that wasn't generated automatically, you need to add these EAnnotations by hand.

Adding an EAnnotation to an EPackage/EClass/EAttribute

It's easy to add an EAnnotation to an existing Ecore model instance using the Ecore Editor.

  1. Open your project's .ecore file in the EMF Ecore Editor
  2. Right click on the object you wish to EAnnotate. Select New Child, EAnnotation.
  3. Right click on the new EAnnotation and select Show Properties View
  4. In the Properties view, enter a value for the Source
    Note: This is generally a URI. See below for appropriate EAnnotation Source values for use with STEM's Model Generator
  5. Right click on the new EAnnotation. Select New Child, Details Entry.
  6. Select the new EAnnotation Detail Entry
  7. In the Properties view, enter values for Key and Value
    Note: See below for values to use with STEM's Model Generator
    Repeat this step for additional Detail Entries
  8. Save the Ecore file

Annotating a STEM Computational Model Ecore

EAnnotations used in STEM's Model Generator

STEM Model Generator Marker EAnnotation

Description Generator Marker Annotation
Source http:///org/eclipse/stem/modelgen/generated
Details Key Example Value Description
version 1.0 Model Generator version to use in codegen


Author Details EAnnotation

Description Author Details Annotation. Similar to the STEM Dublin Core.
Source http:///org/eclipse/stem/modelgen/author
Details Key Example Value Description
tbd tbd tbd


Model Adapters EAnnotation

Description STEM Adapter class references. Used to define inheritance hierarchy of generated classes.
Source http:///org/eclipse/stem/modelgen/model/adapters
Details Key Example Value Description
propertyEditorClass MyDiseaseModel-PropertyEditor The class name of property editor for the computational model
propertyEditor-SuperClass StandardDisease-ModelPropertyEditor The parent class name of property editor for the computational model


Label and LabelValue EAnnotations

Description Model label EAnnotation. Defines the IntegrationLabels returned by the computational model's create*Label(...) method.
Source http:///org/eclipse/stem/modelgen/model/label
Details Key Example Value Description
* MyDiseaseModelLabel The class name of the label created by this computational model


Description Model label value EAnnotation. Defines the IntegrationLabelValues (which stores compartments) returned by the computational model's create*LabelValue(...) method.
Source http:///org/eclipse/stem/modelgen/model/labelvalue
Details Key Example Value Description
* MyDiseaseModelLabelValue The LabelValue class name created by this computational model


Compartment Type EAnnotation

Description Sets the compartment type in a IntegrationLabelValue EClass's EAttribute.
Source http:///org/eclipse/stem/modelgen/compartment/type
Details Key Example Value Description
type Standard The compartment type. Valid values are Standard, Incidence, and Deaths


Model Parameter UI Messages EAnnotation

Description Defines UI strings applied to the EAttributes in the computational model's property editor.
Source http:///org/eclipse/stem/modelgen/modelparam/messages
Details Key Example Value Description
name Transmission Rate Display name
tooltip Transmission Rate is a value for doing something Extended help message describing the purpose of the EAttribute/parameter
unit ft/s The expected units for the parameter
invalid Transmission Rate is invalid Message to display if the value does not satisfy the required constraints
missing Transmission Rate is required Message to display if a required value is missing

Model Parameter Constraints EAnnotation

Description Defines validation constraints applied to values for the EAttribute
Source http:///org/eclipse/stem/modelgen/modelparam/constraints
Details Key Example Value Description
minValue 0.0 Minimum numeric value allowed
maxValue 1.0 Maximum numeric value allowed

GenModel Settings

To take advantage of the STEM Model Generator's custom templates, you must enable Dynamic Templates in your project's GenModel.

  1. Open your project's .genmodel in the EMF Generator editor
  2. Select the top level item (the GenModel)
  3. Right click and select Show Properties View
  4. Apply the following settings exactly as specified. When finished, Save the GenModel.
Property Value
Compliance Level 6.0
Runtime Version 2.7
Suppress Notification true
Public Constructors true
Dynamic Templates true
Force Overwrite true
Templates Directory platform:/plugin/org.eclipse.stem.model.codegen/templates
Template Plug-in Variables STEM_CODEGEN=org.eclipse.stem.model.codegen
Update Classpath true

Running the Code Generator

After you finish editing the Ecore and GenModel, you can now run the STEM Model Generator directly. The STEM Model Generator acts as an EMF Generator Adapter, therefore it runs automatically when you execute the EMF Code Generator.

  1. Open your project's .genmodel in the EMF Generator editor
  2. Select the top-level item (the GenModel)
  3. Right click and select a Generate option (Generate All, for example)
  4. Wait while the EMF Code Generator + STEM Model Generator run

Back to the top