rgen 0.4.6 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. data/CHANGELOG +95 -83
  2. data/Rakefile +4 -3
  3. data/lib/ea_support/ea_support.rb +54 -0
  4. data/lib/ea_support/id_store.rb +32 -0
  5. data/lib/ea_support/uml13_ea_metamodel.rb +562 -0
  6. data/lib/ea_support/uml13_ea_metamodel_ext.rb +45 -0
  7. data/lib/ea_support/uml13_ea_metamodel_generator.rb +43 -0
  8. data/lib/ea_support/uml13_ea_to_uml13.rb +72 -0
  9. data/lib/ea_support/uml13_to_uml13_ea.rb +82 -0
  10. data/lib/rgen/ecore/ecore.rb +16 -2
  11. data/lib/rgen/ecore/ecore_builder_methods.rb +81 -0
  12. data/lib/rgen/ecore/ecore_instantiator.rb +5 -1
  13. data/lib/rgen/metamodel_builder/builder_extensions.rb +11 -3
  14. data/lib/rgen/metamodel_builder/module_extension2.rb +205 -0
  15. data/lib/rgen/method_delegation.rb +99 -0
  16. data/lib/rgen/model_builder.rb +27 -0
  17. data/lib/rgen/model_builder/builder_context.rb +318 -0
  18. data/lib/rgen/model_builder/model_serializer.rb +201 -0
  19. data/lib/rgen/model_builder/reference_resolver.rb +156 -0
  20. data/lib/rgen/template_language/directory_template_container.rb +6 -2
  21. data/lib/rgen/template_language/output_handler.rb +2 -4
  22. data/lib/rgen/template_language/template_container.rb +212 -195
  23. data/lib/rgen/transformer.rb +95 -4
  24. data/lib/transformers/ecore_to_uml13.rb +66 -0
  25. data/lib/transformers/uml13_to_ecore.rb +16 -7
  26. data/test/ea_instantiator_test.rb +8 -14
  27. data/test/ea_serializer_test.rb +3 -9
  28. data/test/ea_serializer_test/ea_testmodel_regenerated.xml +2 -2
  29. data/test/ea_serializer_test/ea_testmodel_regenerated_import.log +3 -0
  30. data/test/metamodel_roundtrip_test/TestModel_Regenerated.rb +19 -19
  31. data/test/metamodel_roundtrip_test/houseMetamodel_Regenerated.ecore +44 -44
  32. data/test/method_delegation_test.rb +178 -0
  33. data/test/model_builder/builder_context_test.rb +59 -0
  34. data/test/model_builder/builder_test.rb +284 -0
  35. data/test/model_builder/ecore_internal.rb +103 -0
  36. data/test/model_builder/ecore_original.rb +163 -0
  37. data/test/model_builder/ecore_original_regenerated.rb +163 -0
  38. data/test/model_builder/reference_resolver_test.rb +156 -0
  39. data/test/model_builder/serializer_test.rb +63 -0
  40. data/test/model_builder_test.rb +4 -0
  41. data/test/rgen_test.rb +2 -0
  42. data/test/template_language_test.rb +41 -1
  43. data/test/template_language_test/expected_result1.txt +1 -3
  44. data/test/template_language_test/templates/define_local_test/local.tpl +8 -0
  45. data/test/template_language_test/templates/define_local_test/test.tpl +8 -0
  46. data/test/template_language_test/templates/evaluate_test/test.tpl +7 -0
  47. data/test/template_language_test/templates/no_indent_test/no_indent.tpl +3 -0
  48. data/test/template_language_test/templates/no_indent_test/sub1/no_indent.tpl +3 -0
  49. data/test/template_language_test/templates/no_indent_test/test.tpl +24 -0
  50. data/test/template_language_test/templates/no_indent_test/test2.tpl +13 -0
  51. data/test/template_language_test/templates/no_indent_test/test3.tpl +10 -0
  52. data/test/template_language_test/templates/template_resolution_test/sub1.tpl +9 -0
  53. data/test/template_language_test/templates/template_resolution_test/sub1/sub1.tpl +3 -0
  54. data/test/template_language_test/templates/template_resolution_test/test.tpl +4 -0
  55. data/test/template_language_test/testout.txt +1 -3
  56. data/test/testmodel/ea_testmodel_import.log +1 -0
  57. data/test/testmodel/ea_testmodel_regenerated.xml +808 -0
  58. data/test/transformer_test.rb +3 -5
  59. metadata +52 -3
  60. data/lib/instantiators/ea_instantiator.rb +0 -39
@@ -1,3 +1,6 @@
1
+ require 'rgen/ecore/ecore'
2
+ require 'rgen/ecore/ecore_ext'
3
+
1
4
  module RGen
2
5
 
3
6
  # The Transformer class can be used to specify model transformations.
@@ -162,6 +165,55 @@ module RGen
162
165
  # occure if the condition are based on transformation target elements, i.e. if +trans+
163
166
  # is used within the condition to lookup or transform other elements.
164
167
  #
168
+ # = Copy Transformations
169
+ #
170
+ # In some cases, transformations should just copy a model, either in the same metamodel
171
+ # or in another metamodel with the same package/class structure. Sometimes, a transformation
172
+ # is not exactly a copy, but a copy with slight modifications. Also in this case most
173
+ # classes need to be copied verbatim.
174
+ #
175
+ # The class method Transformer.copy can be used to specify a copy rule for a single
176
+ # metamodel class. If no target class is specified using the :to named parameter, the
177
+ # target class will be the same as the source class (i.e. in the same metamodel).
178
+ #
179
+ # copy MM1::ClassA # copy within the same metamodel
180
+ # copy MM1::ClassA, :to => MM2::ClassA
181
+ #
182
+ # The class method Transfomer.copy_all can be used to specify copy rules for all classes
183
+ # of a particular metamodel package. Again with :to, the target metamodel package may
184
+ # be specified which must have the same package/class structure. If :to is omitted, the
185
+ # target metamodel is the same as the source metamodel. In case that for some classes
186
+ # specific transformation rules should be used instead of copy rules, exceptions may be
187
+ # specified using the :except named parameter. +copy_all+ also provides an easy way to
188
+ # copy (clone) a model within the same metamodel.
189
+ #
190
+ # copy_all MM1 # copy rules for the whole metamodel MM1,
191
+ # # used to clone models of MM1
192
+ #
193
+ # copy_all MM1, :to => MM2, :except => %w( # copy rules for all classes of MM1 to
194
+ # ClassA # equally named classes in MM2, except
195
+ # Sub1::ClassB # "ClassA" and "Sub1::ClassB"
196
+ # )
197
+ #
198
+ # If a specific class transformation is not an exact copy, the Transformer.transform method
199
+ # should be used to actually specify the transformation. If this transformation is also
200
+ # mostly a copy, the helper method Transformer#copy_features can be used to create the
201
+ # transformation Hash required by the transform method. Any changes to this hash may be done
202
+ # in a hash returned by a block given to +copy_features+. This hash will extend or overwrite
203
+ # the default copy hash. In case a particular feature should not be part of the copy hash
204
+ # (e.g. because it does not exist in the target metamodel), exceptions can be specified using
205
+ # the :except named parameter. Here is an example:
206
+ #
207
+ # transform ClassA, :to => ClassAx do
208
+ # copy_features :except => [:featA] do
209
+ # { :featB => featA }
210
+ # end
211
+ # end
212
+ #
213
+ # In this example, ClassAx is a copy of ClassA except, that feature "featA" in ClassA is renamed
214
+ # into "featB" in ClassAx. Using +copy_features+ all features are copied except "featA". Then
215
+ # "featB" of the target class is assigned the value of "featA" of the source class.
216
+ #
165
217
  class Transformer
166
218
 
167
219
  TransformationDescription = Struct.new(:block, :target) # :nodoc:
@@ -205,16 +257,37 @@ class Transformer
205
257
 
206
258
  # This class method specifies that all objects of class +from+ are to be copied
207
259
  # into an object of class +to+. If +to+ is omitted, +from+ is used as target class.
260
+ # The target class may also be specified using the :to => <class> hash notation.
208
261
  # During copy, all attributes and references of the target object
209
262
  # are set to their transformed counterparts of the source object.
210
263
  #
211
264
  def self.copy(from, to=nil)
265
+ raise StandardError.new("Specify target class either directly as second parameter or using :to => <class>") \
266
+ unless to.nil? || to.is_a?(Class) || (to.is_a?(Hash) && to[:to].is_a?(Class))
267
+ to = to[:to] if to.is_a?(Hash)
212
268
  transform(from, :to => to || from) do
213
- Hash[*@current_object.class.ecore.eAllStructuralFeatures.inject([]) {|l,a|
214
- l + [a.name.to_sym, trans(@current_object.send(a.name))]
215
- }]
269
+ copy_features
216
270
  end
217
- end
271
+ end
272
+
273
+ # Create copy rules for all classes of metamodel package (module) +from+ and its subpackages.
274
+ # The target classes are the classes with the same name in the metamodel package
275
+ # specified using named parameter :to. If no target metamodel is specified, source
276
+ # and target classes will be the same.
277
+ # The named parameter :except can be used to specify classes by qualified name for which
278
+ # no copy rules should be created. Qualified names are relative to the metamodel package
279
+ # specified.
280
+ #
281
+ def self.copy_all(from, hash={})
282
+ to = hash[:to] || from
283
+ except = hash[:except]
284
+ fromDepth = from.ecore.qualifiedName.split("::").size
285
+ from.ecore.eAllClasses.each do |c|
286
+ path = c.qualifiedName.split("::")[fromDepth..-1]
287
+ next if except && except.include?(path.join("::"))
288
+ copy c.instanceClass, :to => path.inject(to){|m,c| m.const_get(c)}
289
+ end
290
+ end
218
291
 
219
292
  # Define a transformer method for the current transformer class.
220
293
  # In contrast to regular Ruby methods, a method defined this way executes in the
@@ -283,6 +356,24 @@ class Transformer
283
356
  @transformer_results[obj]
284
357
  end
285
358
 
359
+ # Create the hash required as return value of the block given to the Transformer.transform method.
360
+ # The hash will assign feature values of the source class to the features of the target class,
361
+ # assuming the features of both classes are the same. If the :except named parameter specifies
362
+ # an Array of symbols, the listed features are not copied by the hash. In order to easily manipulate
363
+ # the resulting hash, a block may be given which should also return a feature assignmet hash. This
364
+ # hash should be created manually and will extend/overwrite the automatically created hash.
365
+ #
366
+ def copy_features(options={})
367
+ hash = {}
368
+ @current_object.class.ecore.eAllStructuralFeatures.each do |f|
369
+ next if f.derived
370
+ next if options[:except] && options[:except].include?(f.name.to_sym)
371
+ hash[f.name.to_sym] = trans(@current_object.send(f.name))
372
+ end
373
+ hash.merge!(yield) if block_given?
374
+ hash
375
+ end
376
+
286
377
  def _transformProperties(obj, block_desc) #:nodoc:
287
378
  old_object, @current_object = @current_object, obj
288
379
  block_result = instance_eval(&block_desc.block)
@@ -0,0 +1,66 @@
1
+ require 'rgen/transformer'
2
+ require 'rgen/ecore/ecore'
3
+ require 'metamodels/uml13_metamodel'
4
+
5
+ class ECoreToUML13 < RGen::Transformer
6
+ include RGen::ECore
7
+
8
+ def transform
9
+ trans(:class => EPackage)
10
+ trans(:class => EClass)
11
+ end
12
+
13
+ transform EPackage, :to => UML13::Package do
14
+ {:name => name,
15
+ :namespace => trans(eSuperPackage) || model,
16
+ :ownedElement => trans(eClassifiers.select{|c| c.is_a?(EClass)} + eSubpackages)
17
+ }
18
+ end
19
+
20
+ transform EClass, :to => UML13::Class do
21
+ {:name => name,
22
+ :namespace => trans(ePackage),
23
+ :feature => trans(eStructuralFeatures.select{|f| f.is_a?(EAttribute)} + eOperations),
24
+ :associationEnd => trans(eStructuralFeatures.select{|f| f.is_a?(EReference)}),
25
+ :generalization => eSuperTypes.collect { |st|
26
+ @env_out.new(UML13::Generalization, :parent => trans(st), :namespace => trans(ePackage) || model)
27
+ }
28
+ }
29
+ end
30
+
31
+ transform EAttribute, :to => UML13::Attribute do
32
+ _typemap = {EString => "string", EBoolean => "boolean", EInt => "int", EFloat => "float"}
33
+ {:name => name,
34
+ :taggedValue => [@env_out.new(UML13::TaggedValue, :tag => "type", :value => _typemap[eType] || "")]
35
+ }
36
+ end
37
+
38
+ transform EReference, :to => UML13::AssociationEnd do
39
+ _otherAssocEnd = eOpposite ? trans(eOpposite) :
40
+ @env_out.new(UML13::AssociationEnd,
41
+ :type => trans(eType), :name => name, :multiplicity => createMultiplicity(@current_object),
42
+ :aggregation => :none, :isNavigable => true)
43
+ { :association => trans(@current_object).association || @env_out.new(UML13::Association,
44
+ :connection => [_otherAssocEnd], :namespace => trans(eContainingClass.ePackage) || model),
45
+ :name => eOpposite && eOpposite.name,
46
+ :multiplicity => eOpposite && createMultiplicity(eOpposite),
47
+ :aggregation => containment ? :composite : :none,
48
+ :isNavigable => !eOpposite.nil?
49
+ }
50
+ end
51
+
52
+ transform EOperation, :to => UML13::Operation do
53
+ {:name => name}
54
+ end
55
+
56
+ def createMultiplicity(ref)
57
+ @env_out.new(UML13::Multiplicity, :range => [
58
+ @env_out.new(UML13::MultiplicityRange,
59
+ :lower => ref.lowerBound.to_s.sub("-1","*"), :upper => ref.upperBound.to_s.sub("-1","*"))])
60
+ end
61
+
62
+ def model
63
+ @model ||= @env_out.new(UML13::Model, :name => "Model")
64
+ end
65
+
66
+ end
@@ -31,7 +31,7 @@ class UML13ToECore < RGen::Transformer
31
31
  :eStructuralFeatures => trans(feature.select{|f| f.is_a?(UML13::Attribute)} + associationEnd),
32
32
  :eOperations => trans(feature.select{|f| f.is_a?(UML13::Operation)}),
33
33
  :eSuperTypes => trans(generalization.parent + clientDependency.select{|d| d.stereotype.name == "implements"}.supplier),
34
- :eAnnotations => [ EAnnotation.new(:details => trans(taggedValue)) ] }
34
+ :eAnnotations => createAnnotations(taggedValue) }
35
35
  end
36
36
 
37
37
  transform UML13::Interface, :to => EClass do
@@ -44,9 +44,8 @@ class UML13ToECore < RGen::Transformer
44
44
 
45
45
  transform UML13::Attribute, :to => EAttribute do
46
46
  typemap = { "string" => EString, "boolean" => EBoolean, "int" => EInt, "float" => EFloat }
47
- typetv = taggedValue.find{|tv| tv.tag == "type"}
48
- { :name => name && name.strip, :eType => (typetv && typetv.value && typemap[typetv.value.downcase]),
49
- :eAnnotations => [ EAnnotation.new(:details => trans(taggedValue)) ] }
47
+ { :name => name && name.strip, :eType => getType && typemap[getType.name && getType.name.downcase],
48
+ :eAnnotations => createAnnotations(taggedValue) }
50
49
  end
51
50
 
52
51
  transform UML13::Operation, :to => EOperation do
@@ -58,16 +57,26 @@ class UML13ToECore < RGen::Transformer
58
57
  { :eType => trans(otherEnd.type),
59
58
  :name => otherEnd.name && otherEnd.name.strip,
60
59
  :eOpposite => trans(otherEnd),
61
- :lowerBound => otherEnd.multiplicity ? otherEnd.multiplicity.range.first.lower.to_i : 0,
62
- :upperBound => otherEnd.multiplicity ? otherEnd.multiplicity.range.first.upper.gsub('*','-1').to_i : 1,
60
+ :lowerBound => (otherEnd.multiplicity && otherEnd.multiplicity.range.first.lower &&
61
+ otherEnd.multiplicity.range.first.lower.to_i) || 0,
62
+ :upperBound => (otherEnd.multiplicity && otherEnd.multiplicity.range.first.upper &&
63
+ otherEnd.multiplicity.range.first.upper.gsub('*','-1').to_i) || 1,
63
64
  :containment => (aggregation == :composite),
64
- :eAnnotations => [ EAnnotation.new(:details => trans(association.taggedValue)) ] }
65
+ :eAnnotations => createAnnotations(association.taggedValue) }
65
66
  end
66
67
 
67
68
  method :isReference do
68
69
  otherEnd = association.connection.find{|ae| ae != @current_object}
69
70
  otherEnd.name && otherEnd.name.size > 0
70
71
  end
72
+
73
+ def createAnnotations(taggedValues)
74
+ if taggedValues.size > 0
75
+ [ EAnnotation.new(:details => trans(taggedValues)) ]
76
+ else
77
+ []
78
+ end
79
+ end
71
80
 
72
81
  transform UML13::TaggedValue, :to => EStringToStringMapEntry do
73
82
  { :key => tag, :value => value}
@@ -3,7 +3,7 @@ $:.unshift File.join(File.dirname(__FILE__),"..","lib")
3
3
  require 'test/unit'
4
4
  require 'rgen/environment'
5
5
  require 'metamodels/uml13_metamodel'
6
- require 'instantiators/ea_instantiator'
6
+ require 'ea_support/ea_support'
7
7
  require 'transformers/uml13_to_ecore'
8
8
  require 'testmodel/class_model_checker'
9
9
  require 'testmodel/object_model_checker'
@@ -19,23 +19,17 @@ class EAInstantiatorTest < Test::Unit::TestCase
19
19
 
20
20
  def test_instantiator
21
21
  envUML = RGen::Environment.new
22
- File.open(MODEL_DIR+"/ea_testmodel.xml") { |f|
23
- inst = EAInstantiator.new(envUML, EAInstantiator::ERROR)
24
- inst.instantiate(f.read)
25
- }
26
- checkClassModel(envUML)
27
- checkObjectModel(envUML)
28
- envECore = RGen::Environment.new
29
- UML13ToECore.new(envUML, envECore).transform
30
- checkECoreModel(envECore)
22
+ EASupport.instantiateUML13FromXMI11(envUML, MODEL_DIR+"/ea_testmodel.xml")
23
+ checkClassModel(envUML)
24
+ checkObjectModel(envUML)
25
+ envECore = RGen::Environment.new
26
+ UML13ToECore.new(envUML, envECore).transform
27
+ checkECoreModel(envECore)
31
28
  end
32
29
 
33
30
  def test_partial
34
31
  envUML = RGen::Environment.new
35
- File.open(MODEL_DIR+"/ea_testmodel_partial.xml") { |f|
36
- inst = EAInstantiator.new(envUML, EAInstantiator::ERROR)
37
- inst.instantiate(f.read)
38
- }
32
+ EASupport.instantiateUML13FromXMI11(envUML, MODEL_DIR+"/ea_testmodel_partial.xml")
39
33
  checkClassModelPartial(envUML)
40
34
  end
41
35
  end
@@ -3,7 +3,7 @@ $:.unshift File.join(File.dirname(__FILE__),"..","lib")
3
3
  require 'test/unit'
4
4
  require 'rgen/environment'
5
5
  require 'metamodels/uml13_metamodel'
6
- require 'instantiators/ea_instantiator'
6
+ require 'ea_support/ea_support'
7
7
  require 'rgen/serializer/xmi11_serializer'
8
8
 
9
9
  class EASerializerTest < Test::Unit::TestCase
@@ -13,17 +13,11 @@ class EASerializerTest < Test::Unit::TestCase
13
13
 
14
14
  def test_serializer
15
15
  envUML = RGen::Environment.new
16
- File.open(MODEL_DIR+"/ea_testmodel.xml") { |f|
17
- inst = EAInstantiator.new(envUML, EAInstantiator::ERROR)
18
- inst.instantiate(f.read)
19
- }
16
+ EASupport.instantiateUML13FromXMI11(envUML, MODEL_DIR+"/ea_testmodel.xml")
20
17
  models = envUML.find(:class => UML13::Model)
21
18
  assert_equal 1, models.size
22
19
 
23
- File.open(TEST_DIR+"/ea_testmodel_regenerated.xml", "w") do |f|
24
- ser = RGen::Serializer::XMI11Serializer.new(f)
25
- ser.serialize(models.first, {:documentation => {:exporter => "Enterprise Architect", :exporterVersion => "2.5"}})
26
- end
20
+ EASupport.serializeUML13ToXMI11(envUML, MODEL_DIR+"/ea_testmodel_regenerated.xml")
27
21
  end
28
22
 
29
23
  end
@@ -383,7 +383,7 @@
383
383
  <TaggedValue tag="stereotype" value="implements" xmi.id="27945150"/>
384
384
  <TaggedValue tag="headStyle" value="0" xmi.id="27944460"/>
385
385
  <TaggedValue tag="lineStyle" value="0" xmi.id="27943770"/>
386
- <TaggedValue tag="conditional" value="implements" xmi.id="27943080"/>
386
+ <TaggedValue tag="conditional" value="implements" xmi.id="27943080"/>
387
387
  <TaggedValue tag="src_visibility" value="Public" xmi.id="27942390"/>
388
388
  <TaggedValue tag="src_aggregation" value="0" xmi.id="27941700"/>
389
389
  <TaggedValue tag="src_isOrdered" value="false" xmi.id="27941010"/>
@@ -395,7 +395,7 @@
395
395
  <TaggedValue tag="dst_isNavigable" value="true" xmi.id="27936870"/>
396
396
  <TaggedValue tag="dst_containment" value="Unspecified" xmi.id="27936180"/>
397
397
  <TaggedValue tag="virtualInheritance" value="0" xmi.id="27935490"/>
398
- <TaggedValue tag="mb" value="implements" xmi.id="27934800"/>
398
+ <TaggedValue tag="mb" value="implements" xmi.id="27934800"/>
399
399
  </ModelElement.taggedValue>
400
400
  </Dependency>
401
401
  <Package visibility="public" name="Rooms" isLeaf="false" isAbstract="false" isRoot="true" xmi.id="27933420">
@@ -6,8 +6,17 @@ module HouseMetamodel
6
6
 
7
7
  SexEnum = Enum.new(:name => 'SexEnum', :literals =>[ :male, :female ])
8
8
 
9
+ class House < RGen::MetamodelBuilder::MMBase
10
+ annotation 'complexity' => '1', 'date_created' => '2005-09-16 19:52:18', 'date_modified' => '2006-02-28 08:29:19', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_A1B83D59_CAE1_422c_BA5F_D3624D7156AD', 'package_name' => 'HouseMetamodel', 'phase' => '1.0', 'status' => 'Proposed', 'stereotype' => 'dummy', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
11
+ has_attr 'size', Integer
12
+ has_attr 'module', String
13
+ has_attr 'address', String, :changeable => false do
14
+ annotation 'collection' => 'false', 'containment' => 'Not Specified', 'derived' => '0', 'duplicates' => '0', 'ea_guid' => '{A8DF581B-9AC6-4f75-AB48-8FAEDFC6E068}', 'lowerBound' => '1', 'ordered' => '0', 'position' => '0', 'styleex' => 'volatile=0;', 'type' => 'String', 'upperBound' => '1'
15
+ end
16
+ end
17
+
9
18
  class Person < RGen::MetamodelBuilder::MMBase
10
- annotation 'complexity' => '1', 'date_created' => '2006-06-27 08:34:23', 'date_modified' => '2006-06-27 08:34:26', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_A1B83D59_CAE1_422c_BA5F_D3624D7156AD', 'package_name' => 'HouseMetamodel', 'phase' => '1.0', 'status' => 'Proposed', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
19
+ annotation 'complexity' => '1', 'date_created' => '2006-06-27 08:34:23', 'date_modified' => '2006-06-27 08:34:26', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_A1B83D59_CAE1_422c_BA5F_D3624D7156AD', 'package_name' => 'HouseMetamodel', 'phase' => '1.0', 'status' => 'Proposed', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
11
20
  has_attr 'sex', HouseMetamodel::SexEnum
12
21
  end
13
22
 
@@ -15,15 +24,6 @@ module HouseMetamodel
15
24
  annotation :source => "testmodel", :details => {'complexity' => '1', 'date_created' => '2006-07-12 08:40:46', 'date_modified' => '2006-07-12 08:44:02', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_A1B83D59_CAE1_422c_BA5F_D3624D7156AD', 'package_name' => 'HouseMetamodel', 'phase' => '1.0', 'status' => 'Proposed', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'}
16
25
  end
17
26
 
18
- class House < RGen::MetamodelBuilder::MMBase
19
- annotation 'complexity' => '1', 'date_created' => '2005-09-16 19:52:18', 'date_modified' => '2006-02-28 08:29:19', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_A1B83D59_CAE1_422c_BA5F_D3624D7156AD', 'package_name' => 'HouseMetamodel', 'phase' => '1.0', 'status' => 'Proposed', 'stereotype' => 'dummy', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
20
- has_attr 'size', Integer
21
- has_attr 'module', String
22
- has_attr 'address', String, :changeable => false do
23
- annotation 'collection' => 'false', 'containment' => 'Not Specified', 'derived' => '0', 'duplicates' => '0', 'ea_guid' => '{A8DF581B-9AC6-4f75-AB48-8FAEDFC6E068}', 'lowerBound' => '1', 'ordered' => '0', 'position' => '0', 'styleex' => 'volatile=0;', 'type' => 'String', 'upperBound' => '1'
24
- end
25
- end
26
-
27
27
 
28
28
  module Rooms
29
29
  extend RGen::MetamodelBuilder::ModuleExtension
@@ -32,15 +32,15 @@ module HouseMetamodel
32
32
 
33
33
  class Room < RGen::MetamodelBuilder::MMBase
34
34
  abstract
35
- annotation 'complexity' => '1', 'date_created' => '2005-09-16 19:52:28', 'date_modified' => '2006-06-22 21:15:25', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_F9D8C6E3_4DAD_4aa2_AD47_D0ABA4E93E08', 'package_name' => 'Rooms', 'phase' => '1.0', 'status' => 'Proposed', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
35
+ annotation 'complexity' => '1', 'date_created' => '2005-09-16 19:52:28', 'date_modified' => '2006-06-22 21:15:25', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_F9D8C6E3_4DAD_4aa2_AD47_D0ABA4E93E08', 'package_name' => 'Rooms', 'phase' => '1.0', 'status' => 'Proposed', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
36
36
  end
37
37
 
38
38
  class Kitchen < RGen::MetamodelBuilder::MMMultiple(HouseMetamodel::MeetingPlace, Room)
39
- annotation 'complexity' => '1', 'date_created' => '2005-11-30 19:26:13', 'date_modified' => '2006-06-22 21:15:34', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_F9D8C6E3_4DAD_4aa2_AD47_D0ABA4E93E08', 'package_name' => 'Rooms', 'phase' => '1.0', 'status' => 'Proposed', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
39
+ annotation 'complexity' => '1', 'date_created' => '2005-11-30 19:26:13', 'date_modified' => '2006-06-22 21:15:34', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_F9D8C6E3_4DAD_4aa2_AD47_D0ABA4E93E08', 'package_name' => 'Rooms', 'phase' => '1.0', 'status' => 'Proposed', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
40
40
  end
41
41
 
42
42
  class Bathroom < Room
43
- annotation 'complexity' => '1', 'date_created' => '2006-06-27 08:32:25', 'date_modified' => '2006-06-27 08:34:23', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_F9D8C6E3_4DAD_4aa2_AD47_D0ABA4E93E08', 'package_name' => 'Rooms', 'phase' => '1.0', 'status' => 'Proposed', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
43
+ annotation 'complexity' => '1', 'date_created' => '2006-06-27 08:32:25', 'date_modified' => '2006-06-27 08:34:23', 'ea_ntype' => '0', 'ea_stype' => 'Class', 'gentype' => 'Java', 'isSpecification' => 'false', 'package' => 'EAPK_F9D8C6E3_4DAD_4aa2_AD47_D0ABA4E93E08', 'package_name' => 'Rooms', 'phase' => '1.0', 'status' => 'Proposed', 'style' => 'BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=0;HSwimLanes=0;BorderStyle=0;', 'tagged' => '0', 'version' => '1.0'
44
44
  end
45
45
 
46
46
  end
@@ -56,14 +56,14 @@ module HouseMetamodel
56
56
  end
57
57
  end
58
58
 
59
- HouseMetamodel::Person.has_many 'home', HouseMetamodel::House do
60
- annotation 'containment' => 'Unspecified'
61
- end
62
59
  HouseMetamodel::House.has_one 'bathroom', HouseMetamodel::Rooms::Bathroom, :transient => true, :lowerBound => 1
63
60
  HouseMetamodel::House.one_to_one 'kitchen', HouseMetamodel::Rooms::Kitchen, 'house', :lowerBound => 1, :opposite_lowerBound => 1 do
64
- annotation 'containment' => 'Unspecified'
65
- opposite_annotation 'containment' => 'Unspecified'
61
+ annotation 'containment' => 'Unspecified'
62
+ opposite_annotation 'containment' => 'Unspecified'
66
63
  end
67
64
  HouseMetamodel::House.contains_many 'room', HouseMetamodel::Rooms::Room, 'house', :lowerBound => 1 do
68
- opposite_annotation 'containment' => 'Unspecified'
65
+ opposite_annotation 'containment' => 'Unspecified'
66
+ end
67
+ HouseMetamodel::Person.has_many 'home', HouseMetamodel::House do
68
+ annotation 'containment' => 'Unspecified'
69
69
  end
@@ -1,20 +1,35 @@
1
1
  <ecore:EPackage xmi:version="2.0" name="HouseMetamodel" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
2
- <eClassifiers name="SexEnum" instanceClassName="HouseMetamodel::SexEnum" ePackage="#/" xsi:type="ecore:EEnum">
3
- <eLiterals name="male" xsi:type="ecore:EEnumLiteral" eEnum="#//SexEnum"/>
4
- <eLiterals name="female" xsi:type="ecore:EEnumLiteral" eEnum="#//SexEnum"/>
5
- </eClassifiers>
6
- <eClassifiers name="Person" abstract="false" instanceClassName="HouseMetamodel::Person" interface="false" ePackage="#/" xsi:type="ecore:EClass">
7
- <eStructuralFeatures name="sex" derived="false" transient="false" changeable="true" eContainingClass="#//Person" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" eType="#//SexEnum" unique="true"/>
8
- <eStructuralFeatures name="home" derived="false" containment="false" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//Person" unsettable="false" xsi:type="ecore:EReference" upperBound="-1" ordered="true" volatile="false" lowerBound="0" eType="#//House" unique="true">
9
- <eAnnotations eModelElement="#//Person/home" xsi:type="ecore:EAnnotation">
2
+ <eClassifiers name="House" abstract="false" instanceClassName="HouseMetamodel::House" interface="false" ePackage="#/" xsi:type="ecore:EClass">
3
+ <eStructuralFeatures name="size" derived="false" transient="false" changeable="true" eContainingClass="#//House" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" unique="true"/>
4
+ <eStructuralFeatures name="module" derived="false" transient="false" changeable="true" eContainingClass="#//House" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" unique="true"/>
5
+ <eStructuralFeatures name="address" derived="false" transient="false" changeable="false" eContainingClass="#//House" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" unique="true">
6
+ <eAnnotations eModelElement="#//House/address" xsi:type="ecore:EAnnotation">
7
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="derived"/>
8
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Not Specified" key="containment"/>
9
+ <details xsi:type="ecore:EStringToStringMapEntry" value="{A8DF581B-9AC6-4f75-AB48-8FAEDFC6E068}" key="ea_guid"/>
10
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="duplicates"/>
11
+ <details xsi:type="ecore:EStringToStringMapEntry" value="false" key="collection"/>
12
+ <details xsi:type="ecore:EStringToStringMapEntry" value="String" key="type"/>
13
+ <details xsi:type="ecore:EStringToStringMapEntry" value="volatile=0;" key="styleex"/>
14
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="upperBound"/>
15
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ordered"/>
16
+ <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="lowerBound"/>
17
+ <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="position"/>
18
+ </eAnnotations>
19
+ </eStructuralFeatures>
20
+ <eStructuralFeatures name="bathroom" derived="false" containment="false" transient="true" changeable="true" resolveProxies="true" eContainingClass="#//House" unsettable="false" xsi:type="ecore:EReference" upperBound="1" ordered="true" volatile="false" lowerBound="1" eType="#//Rooms/Bathroom" unique="true"/>
21
+ <eStructuralFeatures name="kitchen" derived="false" containment="false" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//House" eOpposite="#//Rooms/Kitchen/house" unsettable="false" xsi:type="ecore:EReference" upperBound="1" ordered="true" volatile="false" lowerBound="1" eType="#//Rooms/Kitchen" unique="true">
22
+ <eAnnotations eModelElement="#//House/kitchen" xsi:type="ecore:EAnnotation">
10
23
  <details xsi:type="ecore:EStringToStringMapEntry" value="Unspecified" key="containment"/>
11
24
  </eAnnotations>
12
25
  </eStructuralFeatures>
13
- <eAnnotations eModelElement="#//Person" xsi:type="ecore:EAnnotation">
26
+ <eStructuralFeatures name="room" derived="false" containment="true" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//House" eOpposite="#//Rooms/Room/house" unsettable="false" xsi:type="ecore:EReference" upperBound="-1" ordered="true" volatile="false" lowerBound="1" eType="#//Rooms/Room" unique="true"/>
27
+ <eAnnotations eModelElement="#//House" xsi:type="ecore:EAnnotation">
28
+ <details xsi:type="ecore:EStringToStringMapEntry" value="dummy" key="stereotype"/>
14
29
  <details xsi:type="ecore:EStringToStringMapEntry" value="Proposed" key="status"/>
15
- <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-27 08:34:23" key="date_created"/>
30
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2005-09-16 19:52:18" key="date_created"/>
16
31
  <details xsi:type="ecore:EStringToStringMapEntry" value="Class" key="ea_stype"/>
17
- <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-27 08:34:26" key="date_modified"/>
32
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-02-28 08:29:19" key="date_modified"/>
18
33
  <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="tagged"/>
19
34
  <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ea_ntype"/>
20
35
  <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="version"/>
@@ -27,12 +42,18 @@
27
42
  <details xsi:type="ecore:EStringToStringMapEntry" value="Java" key="gentype"/>
28
43
  </eAnnotations>
29
44
  </eClassifiers>
30
- <eClassifiers name="MeetingPlace" abstract="false" instanceClassName="HouseMetamodel::MeetingPlace" interface="false" ePackage="#/" xsi:type="ecore:EClass" eSubTypes="#//Rooms/Kitchen">
31
- <eAnnotations eModelElement="#//MeetingPlace" xsi:type="ecore:EAnnotation" source="testmodel">
45
+ <eClassifiers name="Person" abstract="false" instanceClassName="HouseMetamodel::Person" interface="false" ePackage="#/" xsi:type="ecore:EClass">
46
+ <eStructuralFeatures name="sex" derived="false" transient="false" changeable="true" eContainingClass="#//Person" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" eType="#//SexEnum" unique="true"/>
47
+ <eStructuralFeatures name="home" derived="false" containment="false" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//Person" unsettable="false" xsi:type="ecore:EReference" upperBound="-1" ordered="true" volatile="false" lowerBound="0" eType="#//House" unique="true">
48
+ <eAnnotations eModelElement="#//Person/home" xsi:type="ecore:EAnnotation">
49
+ <details xsi:type="ecore:EStringToStringMapEntry" value="Unspecified" key="containment"/>
50
+ </eAnnotations>
51
+ </eStructuralFeatures>
52
+ <eAnnotations eModelElement="#//Person" xsi:type="ecore:EAnnotation">
32
53
  <details xsi:type="ecore:EStringToStringMapEntry" value="Proposed" key="status"/>
33
- <details xsi:type="ecore:EStringToStringMapEntry" value="2006-07-12 08:40:46" key="date_created"/>
54
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-27 08:34:23" key="date_created"/>
34
55
  <details xsi:type="ecore:EStringToStringMapEntry" value="Class" key="ea_stype"/>
35
- <details xsi:type="ecore:EStringToStringMapEntry" value="2006-07-12 08:44:02" key="date_modified"/>
56
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-06-27 08:34:26" key="date_modified"/>
36
57
  <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="tagged"/>
37
58
  <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ea_ntype"/>
38
59
  <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="version"/>
@@ -45,37 +66,16 @@
45
66
  <details xsi:type="ecore:EStringToStringMapEntry" value="Java" key="gentype"/>
46
67
  </eAnnotations>
47
68
  </eClassifiers>
48
- <eClassifiers name="House" abstract="false" instanceClassName="HouseMetamodel::House" interface="false" ePackage="#/" xsi:type="ecore:EClass">
49
- <eStructuralFeatures name="size" derived="false" transient="false" changeable="true" eContainingClass="#//House" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" unique="true"/>
50
- <eStructuralFeatures name="module" derived="false" transient="false" changeable="true" eContainingClass="#//House" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" unique="true"/>
51
- <eStructuralFeatures name="address" derived="false" transient="false" changeable="false" eContainingClass="#//House" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" unique="true">
52
- <eAnnotations eModelElement="#//House/address" xsi:type="ecore:EAnnotation">
53
- <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="derived"/>
54
- <details xsi:type="ecore:EStringToStringMapEntry" value="Not Specified" key="containment"/>
55
- <details xsi:type="ecore:EStringToStringMapEntry" value="{A8DF581B-9AC6-4f75-AB48-8FAEDFC6E068}" key="ea_guid"/>
56
- <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="duplicates"/>
57
- <details xsi:type="ecore:EStringToStringMapEntry" value="false" key="collection"/>
58
- <details xsi:type="ecore:EStringToStringMapEntry" value="String" key="type"/>
59
- <details xsi:type="ecore:EStringToStringMapEntry" value="volatile=0;" key="styleex"/>
60
- <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="upperBound"/>
61
- <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ordered"/>
62
- <details xsi:type="ecore:EStringToStringMapEntry" value="1" key="lowerBound"/>
63
- <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="position"/>
64
- </eAnnotations>
65
- </eStructuralFeatures>
66
- <eStructuralFeatures name="bathroom" derived="false" containment="false" transient="true" changeable="true" resolveProxies="true" eContainingClass="#//House" unsettable="false" xsi:type="ecore:EReference" upperBound="1" ordered="true" volatile="false" lowerBound="1" eType="#//Rooms/Bathroom" unique="true"/>
67
- <eStructuralFeatures name="kitchen" derived="false" containment="false" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//House" eOpposite="#//Rooms/Kitchen/house" unsettable="false" xsi:type="ecore:EReference" upperBound="1" ordered="true" volatile="false" lowerBound="1" eType="#//Rooms/Kitchen" unique="true">
68
- <eAnnotations eModelElement="#//House/kitchen" xsi:type="ecore:EAnnotation">
69
- <details xsi:type="ecore:EStringToStringMapEntry" value="Unspecified" key="containment"/>
70
- </eAnnotations>
71
- </eStructuralFeatures>
72
- <eStructuralFeatures name="room" derived="false" containment="true" transient="false" changeable="true" resolveProxies="true" eContainingClass="#//House" eOpposite="#//Rooms/Room/house" unsettable="false" xsi:type="ecore:EReference" upperBound="-1" ordered="true" volatile="false" lowerBound="1" eType="#//Rooms/Room" unique="true"/>
73
- <eAnnotations eModelElement="#//House" xsi:type="ecore:EAnnotation">
74
- <details xsi:type="ecore:EStringToStringMapEntry" value="dummy" key="stereotype"/>
69
+ <eClassifiers name="SexEnum" instanceClassName="HouseMetamodel::SexEnum" ePackage="#/" xsi:type="ecore:EEnum">
70
+ <eLiterals name="male" xsi:type="ecore:EEnumLiteral" eEnum="#//SexEnum"/>
71
+ <eLiterals name="female" xsi:type="ecore:EEnumLiteral" eEnum="#//SexEnum"/>
72
+ </eClassifiers>
73
+ <eClassifiers name="MeetingPlace" abstract="false" instanceClassName="HouseMetamodel::MeetingPlace" interface="false" ePackage="#/" xsi:type="ecore:EClass" eSubTypes="#//Rooms/Kitchen">
74
+ <eAnnotations eModelElement="#//MeetingPlace" xsi:type="ecore:EAnnotation" source="testmodel">
75
75
  <details xsi:type="ecore:EStringToStringMapEntry" value="Proposed" key="status"/>
76
- <details xsi:type="ecore:EStringToStringMapEntry" value="2005-09-16 19:52:18" key="date_created"/>
76
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-07-12 08:40:46" key="date_created"/>
77
77
  <details xsi:type="ecore:EStringToStringMapEntry" value="Class" key="ea_stype"/>
78
- <details xsi:type="ecore:EStringToStringMapEntry" value="2006-02-28 08:29:19" key="date_modified"/>
78
+ <details xsi:type="ecore:EStringToStringMapEntry" value="2006-07-12 08:44:02" key="date_modified"/>
79
79
  <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="tagged"/>
80
80
  <details xsi:type="ecore:EStringToStringMapEntry" value="0" key="ea_ntype"/>
81
81
  <details xsi:type="ecore:EStringToStringMapEntry" value="1.0" key="version"/>