Skip to main content
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEd Willink2014-08-20 06:10:39 +0000
committerEd Willink2014-08-20 06:10:39 +0000
commit294a8fb95d1ed743aec02efa070ab1a15b98d263 (patch)
tree1a72e7e48a771ae819ebd8e13a81bbc7d9e603ab /tests
parent7d9e3b98a2c536db16120e12df3342e4ae6e4edf (diff)
downloadorg.eclipse.qvtd-294a8fb95d1ed743aec02efa070ab1a15b98d263.tar.gz
org.eclipse.qvtd-294a8fb95d1ed743aec02efa070ab1a15b98d263.tar.xz
org.eclipse.qvtd-294a8fb95d1ed743aec02efa070ab1a15b98d263.zip
[unrelated] Convert line delimiters to Unix
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/ClassToRDBMS/ClassToRDBMSSchedule.qvti1206
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Expressions/Expressions.qvti46
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti136
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphMinimal/Graph2GraphMinimal.qvti66
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/HSV2HLS/HSV2HLS.qvti194
5 files changed, 824 insertions, 824 deletions
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/ClassToRDBMS/ClassToRDBMSSchedule.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/ClassToRDBMS/ClassToRDBMSSchedule.qvti
index b8aabf8e9..4490f2446 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/ClassToRDBMS/ClassToRDBMSSchedule.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/ClassToRDBMS/ClassToRDBMSSchedule.qvti
@@ -1,603 +1,603 @@
-import SimpleUML: 'SimpleUML.ecore'::simpleuml;
-import SimpleRDBMS: 'SimpleRDBMS.ecore'::simplerdbms;
-import UMLtoRDBMS: 'UMLtoRDBMS.ecore'::umltordbms;
-
-transformation umlRdbms {
- uml imports SimpleUML;
- rdbms imports SimpleRDBMS;
- middle imports UMLtoRDBMS;
-}
-
-map packageToSchemaLM in umlRdbms {
- check uml (p:Package) { }
- enforce middle () {
- realize p2s:PackageToSchema
- }
- where () {
- p2s.umlPackage := p;
- p2s.name := p.name;
- }
- /* L to M */
- -- A package has elements, elements can be Classifiers or Associations. A
- -- classifier can be a Class or a PrimitiveDataType
-
- -- PrimitiveDataType
- for child in p.elements {
- call integerToNumberLM {
- p := p;
- prim := child;
- p2s := p2s;
- }
- call booleanToBooleanLM {
- p := p;
- prim := child;
- p2s := p2s;
- }
- call stringToVarcharLM {
- p := p;
- prim := child;
- p2s := p2s;
- }
- -- Class
- call classToTableLM {
- p := p;
- c := child;
- p2s := p2s;
- }
- -- Associations
- call associationToForeignKeyLM {
- p := p;
- a := child;
- p2s := p2s;
- }
- }
-
- /* M to M */
-
-
- /* M to R */
- call packageToSchemaMR {
- p2s := p2s;
- }
-
-}
-
-map packageToSchemaMR in umlRdbms {
- check middle (p2s:PackageToSchema) {}
- enforce rdbms () {
- realize s:Schema
- }
- where () {
- p2s.schema := s;
- }
- call packageToSchemaMR_1 {
- s_1 := s;
- p2s_1 := p2s;
- }
- for child in p2s.primitivesToNames {
- call integerToNumberMR {
- p2s := p2s;
- p2n := child;
- }
- call booleanToBooleanMR {
- p2s := p2s;
- p2n := child;
- }
- call stringToVarcharMR {
- p2s := p2s;
- p2n := child;
- }
- }
- for child in p2s.classesToTables {
- call classToTableMR {
- p2s := p2s;
- c2t := child;
- s := s;
- }
- }
-}
-
-map packageToSchemaMR_1 in umlRdbms {
- check middle (p2s_1:PackageToSchema) {}
- enforce rdbms (s_1:Schema) {}
- where () {
- s_1.name := p2s_1.name;
- }
-}
-
-map integerToNumberLM in umlRdbms {
- check uml (p:Package, prim:PrimitiveDataType) {}
- enforce middle (p2s:PackageToSchema) {
- realize p2n:PrimitiveToName
- }
- where (prim.namespace = p;
- prim.name = 'Integer';
- p2s.umlPackage=p;
- ) {
- p2n.owner := p2s;
- p2n.primitive := prim;
- p2n.name := prim.name + '2' + 'NUMBER';
- }
-}
-
-map integerToNumberMR in umlRdbms {
- check middle (p2s:PackageToSchema, p2n:PrimitiveToName) {}
- enforce rdbms () {}
- where (
- p2n.owner = p2s;
- p2n.name = 'Integer' + '2' + 'NUMBER';
- ) {}
-}
-
-map booleanToBooleanLM in umlRdbms {
- check uml (p:Package, prim:PrimitiveDataType) { }
- enforce middle (p2s:PackageToSchema) {
- realize p2n:PrimitiveToName
- }
- where (
- prim.namespace = p;
- prim.name = 'Boolean';
- p2s.umlPackage=p;
- ) {
- p2n.owner := p2s;
- p2n.primitive := prim;
- p2n.name := prim.name + '2' + 'BOOLEAN';
- }
-}
-
-map booleanToBooleanMR in umlRdbms {
- check middle (p2s:PackageToSchema, p2n:PrimitiveToName) {}
- enforce rdbms () {}
- where (
- p2n.owner = p2s;
- p2n.name = 'Boolean' + '2' + 'BOOLEAN';
- ) {}
-}
-
-map stringToVarcharLM in umlRdbms {
- check uml (p:Package, prim:PrimitiveDataType) { }
- enforce middle (p2s:PackageToSchema) {
- realize p2n:PrimitiveToName
- }
- where (
- prim.namespace = p;
- prim.name = 'String';
- p2s.umlPackage=p;
- ) {
- p2n.owner := p2s;
- p2n.primitive := prim;
- p2n.name := prim.name + '2' + 'VARCHAR';
- }
-}
-
-map stringToVarcharMR in umlRdbms {
- check middle (p2s:PackageToSchema, p2n:PrimitiveToName) {}
- enforce rdbms () {}
- where (
- p2n.owner = p2s;
- p2n.name = 'String' + '2' + 'VARCHAR';
- ) {}
-}
-
-query umlRdbms::getAllSupers(cls : SimpleUML::Class) : Set(SimpleUML::Class) {
- cls.general->collect(gen | getAllSupers(gen))->including(cls)->asSet()
-}
-
-query umlRdbms::getAllAttributes(cls : SimpleUML::Class) : Set( SimpleUML::Attribute) {
- getAllSupers(cls).attributes -- ->collect(c | c.attribute)
-}
-
-query umlRdbms::getAllForwards(cls : SimpleUML::Class) : Set( SimpleUML::Association) {
- getAllSupers(cls).forward
-}
-
-map classToTableLM in umlRdbms {
- check uml (p:Package, c:Class) { }
- enforce middle (p2s:PackageToSchema) {
- realize c2t:ClassToTable
- }
- where (
- c.kind = 'persistent';
- c.namespace = p;
- p2s.umlPackage=p;
- ) {
- c2t.owner := p2s;
- c2t.umlClass := c;
- c2t.name := c.name;
- }
- -- A Class has attributes
- for anAttribute in c.attributes {
- call classPrimitiveAttributesLM {
- c := c;
- a := anAttribute;
- fao := c2t;
- }
- call classComplexAttributesLM {
- c := c;
- a := anAttribute;
- fao := c2t;
- }
- call complexAttributePrimitiveAttributesLM {
- ca := anAttribute;
- c := anAttribute.type;
- }
- call complexAttributeComplexAttributesLM {
- ca := anAttribute;
- c := anAttribute.type;
- }
- }
-}
-
-map classToTableMR in umlRdbms {
- check middle (p2s:PackageToSchema, c2t:ClassToTable) {}
- enforce rdbms (s:Schema) {
- realize t:Table
- }
- where (
- c2t.owner = p2s;
- ) {
- t.kind := 'base';
- t.schema := s;
- }
- call classToTableMR_1 {
- c2t_1 := c2t;
- t_1 := t;
- }
- call classToTableMR_2 {
- t_2 := t;
- c2t_2 := c2t;
- }
- for child in c2t.associationsToForeignKeys {
- call associationToForeignKeyMR {
- p2s := p2s;
- dt := t;
- -- sc2t := c2t;
- -- dc2t <= c2t.associationsToForeignKeys.referenced;
- a2f := child;
- s := s;
- st := t;
- rk := c2t.primaryKey;
- }
- }
- -- A Class has attributes
- for child in c2t.fromAttributes->union(c2t.fromAttributes->selectByKind(umltordbms::NonLeafAttribute).fromAttributes) {
- call attributeColumnsMR {
- c2t := c2t;
- a2c := child;
- t := t;
- }
- }
-}
-
-map classToTableMR_1 in umlRdbms {
- check middle (c2t_1:ClassToTable) {}
- enforce rdbms (t_1:Table) { }
- where () {
- c2t_1.table := t_1;
- t_1.name := c2t_1.name;
- }
-}
-
-map classToTableMR_2 in umlRdbms {
- check middle (c2t_2:ClassToTable) {}
- enforce rdbms (t_2:Table) {
- realize pk:Key,
- realize pc:Column
- }
- where () {
- pk.owner := t_2;
- pk.kind := 'primary';
- pc.owner := t_2;
- pc.key := OrderedSet(Key){pk};
- pc.type := 'NUMBER';
- }
- call classToTableMR_2_1 {
- c2t_2_1 := c2t_2;
- pk_2_1 := pk;
- pc_2_1 := pc; -- TODO Check this
- }
- call classToTableMR_2_2 {
- pk_2_2 := pk;
- pc_2_2 := pc;
- t_2_2 := t_2;
- }
-}
-
-map classToTableMR_2_1 in umlRdbms {
- check middle (c2t_2_1:ClassToTable) {}
- enforce rdbms (pk_2_1:Key, pc_2_1:Column) {}
- where () {
- c2t_2_1.primaryKey := pk_2_1;
- c2t_2_1.column := pc_2_1;
- }
-}
-
-map classToTableMR_2_2 in umlRdbms {
- check middle () {}
- enforce rdbms (pk_2_2:Key, pc_2_2:Column, t_2_2:Table) {}
- where () {
- pc_2_2.name := t_2_2.name+'_tid';
- pk_2_2.name := t_2_2.name+'_pk';
- }
-}
-
-map associationToForeignKeyLM in umlRdbms {
- check uml (p:Package, sc:Class, dc:Class, a:Association) {
--- sc.namespace = p;
- }
- enforce middle (p2s:PackageToSchema, sc2t:ClassToTable, dc2t:ClassToTable) {
- realize a2f:AssociationToForeignKey
- }
- where (
- a.namespace = p;
- sc := a.source;
- dc := a.destination;
- sc.namespace = p;
- -- getAllForwards(sc)->includes(a);
- -- getAllSupers(dc)->includes(a.destination);
- p2s.umlPackage = p;
- sc2t := sc.ClassToTable;
- dc2t := dc.ClassToTable;
- ) {
- sc2t.owner := p2s;
- a2f.owner := sc2t;
- a2f.referenced := dc2t;
- a2f.association := a;
- a2f.name := if a.destination=dc and a.source=sc
- then a.name
- else if a.destination<>dc and a.source=sc
- then dc.name+'_'+a.name
- else if a.destination=dc and a.source<>sc
- then a.name+'_'+sc.name
- else dc.name+'_'+a.name+'_'+sc.name
- endif endif endif;
- }
-}
-
-map associationToForeignKeyMR in umlRdbms {
- check middle (p2s:PackageToSchema, sc2t:ClassToTable, dc2t:ClassToTable, a2f:AssociationToForeignKey) {}
- enforce rdbms (s:Schema, st:Table, dt:Table, rk:Key) {
- realize fk:ForeignKey,
- realize fc:Column
- }
- where (
- a2f.owner = sc2t;
- a2f.referenced = dc2t;
- p2s.schema = s;
- --sc2t.table = st;
- --dc2t.table = dt;
- sc2t := st.ClassToTable;
- dc2t := dt.ClassToTable;
- st.schema = s;
- -- rk.owner = dt;
- -- rk.kind = 'primary';
- ) {
- sc2t.owner = p2s;
- fk.name := a2f.name;
- fc.name := a2f.name +'_tid';
- fk.owner := st;
- fc.owner := st;
- }
- call associationToForeignKeyMR_1 {
- fk := fk;
- fc := fc;
- dt := a2f.referenced.table;
- rk := rk;
- }
- call associationToForeignKeyMR_2 {
- a2f_1 := a2f;
- fk_1 := fk;
- fc_1 := fc;
- }
-}
-
-map associationToForeignKeyMR_1 in umlRdbms {
- check middle () {}
- enforce rdbms (fk:ForeignKey, fc:Column, dt:Table, rk:Key) {}
- where () {
- fk.refersTo := rk;
- fc.foreignKeys := OrderedSet(ForeignKey){fk};
- fc.type := rk.column->first().type;
- }
-}
-
-map associationToForeignKeyMR_2 in umlRdbms {
- check middle (a2f_1:AssociationToForeignKey) {}
- enforce rdbms (fk_1:ForeignKey, fc_1:Column) {}
- where () {
- a2f_1.foreignKey := fk_1;
- a2f_1.column := fc_1;
- }
-}
-
-map classPrimitiveAttributesLM in umlRdbms {
- check uml (c:Class, t:PrimitiveDataType, a:Attribute) {
- }
- enforce middle (fao:ClassToTable, p2n:PrimitiveToName) {
- realize atc:AttributeToColumn
- }
- where (
- a.owner = c;
- --getAllAttributes(c)->includes(a);
- t := a.type;
- fao.umlClass = c;
- p2n := t.PrimitiveToName;
-
- ) {
- atc.attribute := a;
- atc.owner := fao;
- atc.type := p2n;
- atc.kind := a.kind;
- atc.name := a.name;
- atc.leafs := Set(AttributeToColumn) {atc};
- }
-}
-
-map classComplexAttributesLM in umlRdbms {
- check uml (c:Class, t:Class, a:Attribute) {
- }
- enforce middle (fao:ClassToTable) {
- realize fa:NonLeafAttribute
- }
- where (
- a.owner = c;
- --getAllAttributes(c)->includes(a);
- t := a.type;
- fao.umlClass=c;
- ) {
- fa.attribute := a;
- fa.owner := fao;
- fa.kind := a.kind;
- fa.name := a.name;
- fa.leafs := fao.fromAttributes.leafs->asSet();
- }
-}
-
-map complexAttributePrimitiveAttributesLM in umlRdbms {
- check uml (c:Class, ca:Attribute) {
- }
- enforce middle (fao:NonLeafAttribute) {}
- where (
- ca.type = c;
- -- getAllAttributes(c)->includes(a);
- fao := ca.FromAttribute;
- ) {}
- for anAttribute in c.attributes {
- call complexAttributePrimitiveAttributesLM_1 {
- c_1 := c;
- ca_1 := ca;
- fao_1 := fao;
- a_1 := anAttribute;
- }
- }
-}
-
-map complexAttributePrimitiveAttributesLM_1 in umlRdbms {
- check uml (c_1:Class, t_1:PrimitiveDataType, a_1:Attribute, ca_1:Attribute) {
- }
- enforce middle (fao_1:NonLeafAttribute, p2n_1:PrimitiveToName)
- {
- realize fa:AttributeToColumn
- }
- where (
- t_1 := a_1.type;
- --getAllAttributes(c)->includes(a);
- p2n_1 := t_1.PrimitiveToName;
- ) {
- fa.owner := fao_1;
- fa.leafs := Set(AttributeToColumn) {fa};
- fa.attribute := a_1;
- fa.type := p2n_1;
- fa.kind := a_1.kind;
- fa.name := ca_1.name + '_' + a_1.name;
- }
-}
-
-map complexAttributeComplexAttributesLM in umlRdbms {
- check uml (c:Class, ca:Attribute) {
- }
- enforce middle (fao:NonLeafAttribute) {}
- where (
- ca.type = c;
- --getAllAttributes(c)->includes(a);
- fao := ca.FromAttribute;
- ) {}
- for anAttribute in c.attributes {
- call complexAttributeComplexAttributesLM_1 {
- ca_1 := ca;
- a_1 := anAttribute;
- c_1 := c;
- fao_1 := fao;
- }
- }
-}
-
-map complexAttributeComplexAttributesLM_1 in umlRdbms {
- check uml (c_1:Class, ca_1:Attribute, t_1:Class, a_1:Attribute) {
- }
- enforce middle (fao_1:NonLeafAttribute) {
- realize fa:NonLeafAttribute
- }
- where (
- a_1.owner = c_1;
- --getAllAttributes(c)->includes(a);
- t_1 := a_1.type;
- ) {
- fa.owner := fao_1;
- fa.leafs := fao_1.fromAttributes.leafs->asSet();
- fa.attribute := a_1;
- fa.kind := a_1.kind;
- fa.name := ca_1.name + '_' + a_1.name;
--- fa.attribute := t_1;
- }
-}
-
-
-map attributeColumnsMR in umlRdbms {
- check middle (c2t:ClassToTable, a2c:AttributeToColumn, p2n:PrimitiveToName) {}
- enforce rdbms (t:Table, ct:String) {
- realize c:Column
- }
- where (
- -- c2t.fromAttributes.leafs->includes(a2c); -- need to go deeper in the recursion
- -- a2c.owner = c2t; NOT ALL a2c are owned by c2t (complex attributes)
- c2t.table = t;
- p2n := a2c.type;
- ct := p2n.typeName;
- ) {
- c.owner := t;
- }
- call attributeColumnsMR_1 {
- a2c_1 := a2c;
- c_1 := c;
- }
- call attributeColumnsMR_2 {
- a2c_2 := a2c;
- c_2 := c;
- p2n_2 := p2n;
- ct_2 := ct;
- }
- call attributeColumnsMR_3 {
- c_3 := c;
- a2c_3 := a2c;
- }
-}
-
-map attributeColumnsMR_1 in umlRdbms {
- check middle (a2c_1:AttributeToColumn) {}
- enforce rdbms (c_1:Column) {}
- where () {
- a2c_1.column := c_1;
- }
-}
-
-map attributeColumnsMR_2 in umlRdbms {
- check middle (p2n_2:PrimitiveToName, a2c_2:AttributeToColumn) {}
- enforce rdbms (c_2:Column, ct_2:String) {}
- where (
- a2c_2.type = p2n_2;
- ) {
- c_2.type := ct_2;
- }
- call attributeColumnsMR_2_1 {
- p2n_2_1 := p2n_2;
- ct_2_1 := ct_2;
- }
-}
-
-map attributeColumnsMR_2_1 in umlRdbms {
- check middle (p2n_2_1:PrimitiveToName) {}
- enforce rdbms (ct_2_1:String) {}
- where () {
- p2n_2_1.typeName := ct_2_1;
- }
-}
-
-map attributeColumnsMR_3 in umlRdbms {
- check middle (a2c_3:AttributeToColumn) {}
- enforce rdbms (c_3:Column) { }
- where () {
- c_3.name := a2c_3.name;
- c_3.kind := a2c_3.kind;
- }
-}
+import SimpleUML: 'SimpleUML.ecore'::simpleuml;
+import SimpleRDBMS: 'SimpleRDBMS.ecore'::simplerdbms;
+import UMLtoRDBMS: 'UMLtoRDBMS.ecore'::umltordbms;
+
+transformation umlRdbms {
+ uml imports SimpleUML;
+ rdbms imports SimpleRDBMS;
+ middle imports UMLtoRDBMS;
+}
+
+map packageToSchemaLM in umlRdbms {
+ check uml (p:Package) { }
+ enforce middle () {
+ realize p2s:PackageToSchema
+ }
+ where () {
+ p2s.umlPackage := p;
+ p2s.name := p.name;
+ }
+ /* L to M */
+ -- A package has elements, elements can be Classifiers or Associations. A
+ -- classifier can be a Class or a PrimitiveDataType
+
+ -- PrimitiveDataType
+ for child in p.elements {
+ call integerToNumberLM {
+ p := p;
+ prim := child;
+ p2s := p2s;
+ }
+ call booleanToBooleanLM {
+ p := p;
+ prim := child;
+ p2s := p2s;
+ }
+ call stringToVarcharLM {
+ p := p;
+ prim := child;
+ p2s := p2s;
+ }
+ -- Class
+ call classToTableLM {
+ p := p;
+ c := child;
+ p2s := p2s;
+ }
+ -- Associations
+ call associationToForeignKeyLM {
+ p := p;
+ a := child;
+ p2s := p2s;
+ }
+ }
+
+ /* M to M */
+
+
+ /* M to R */
+ call packageToSchemaMR {
+ p2s := p2s;
+ }
+
+}
+
+map packageToSchemaMR in umlRdbms {
+ check middle (p2s:PackageToSchema) {}
+ enforce rdbms () {
+ realize s:Schema
+ }
+ where () {
+ p2s.schema := s;
+ }
+ call packageToSchemaMR_1 {
+ s_1 := s;
+ p2s_1 := p2s;
+ }
+ for child in p2s.primitivesToNames {
+ call integerToNumberMR {
+ p2s := p2s;
+ p2n := child;
+ }
+ call booleanToBooleanMR {
+ p2s := p2s;
+ p2n := child;
+ }
+ call stringToVarcharMR {
+ p2s := p2s;
+ p2n := child;
+ }
+ }
+ for child in p2s.classesToTables {
+ call classToTableMR {
+ p2s := p2s;
+ c2t := child;
+ s := s;
+ }
+ }
+}
+
+map packageToSchemaMR_1 in umlRdbms {
+ check middle (p2s_1:PackageToSchema) {}
+ enforce rdbms (s_1:Schema) {}
+ where () {
+ s_1.name := p2s_1.name;
+ }
+}
+
+map integerToNumberLM in umlRdbms {
+ check uml (p:Package, prim:PrimitiveDataType) {}
+ enforce middle (p2s:PackageToSchema) {
+ realize p2n:PrimitiveToName
+ }
+ where (prim.namespace = p;
+ prim.name = 'Integer';
+ p2s.umlPackage=p;
+ ) {
+ p2n.owner := p2s;
+ p2n.primitive := prim;
+ p2n.name := prim.name + '2' + 'NUMBER';
+ }
+}
+
+map integerToNumberMR in umlRdbms {
+ check middle (p2s:PackageToSchema, p2n:PrimitiveToName) {}
+ enforce rdbms () {}
+ where (
+ p2n.owner = p2s;
+ p2n.name = 'Integer' + '2' + 'NUMBER';
+ ) {}
+}
+
+map booleanToBooleanLM in umlRdbms {
+ check uml (p:Package, prim:PrimitiveDataType) { }
+ enforce middle (p2s:PackageToSchema) {
+ realize p2n:PrimitiveToName
+ }
+ where (
+ prim.namespace = p;
+ prim.name = 'Boolean';
+ p2s.umlPackage=p;
+ ) {
+ p2n.owner := p2s;
+ p2n.primitive := prim;
+ p2n.name := prim.name + '2' + 'BOOLEAN';
+ }
+}
+
+map booleanToBooleanMR in umlRdbms {
+ check middle (p2s:PackageToSchema, p2n:PrimitiveToName) {}
+ enforce rdbms () {}
+ where (
+ p2n.owner = p2s;
+ p2n.name = 'Boolean' + '2' + 'BOOLEAN';
+ ) {}
+}
+
+map stringToVarcharLM in umlRdbms {
+ check uml (p:Package, prim:PrimitiveDataType) { }
+ enforce middle (p2s:PackageToSchema) {
+ realize p2n:PrimitiveToName
+ }
+ where (
+ prim.namespace = p;
+ prim.name = 'String';
+ p2s.umlPackage=p;
+ ) {
+ p2n.owner := p2s;
+ p2n.primitive := prim;
+ p2n.name := prim.name + '2' + 'VARCHAR';
+ }
+}
+
+map stringToVarcharMR in umlRdbms {
+ check middle (p2s:PackageToSchema, p2n:PrimitiveToName) {}
+ enforce rdbms () {}
+ where (
+ p2n.owner = p2s;
+ p2n.name = 'String' + '2' + 'VARCHAR';
+ ) {}
+}
+
+query umlRdbms::getAllSupers(cls : SimpleUML::Class) : Set(SimpleUML::Class) {
+ cls.general->collect(gen | getAllSupers(gen))->including(cls)->asSet()
+}
+
+query umlRdbms::getAllAttributes(cls : SimpleUML::Class) : Set( SimpleUML::Attribute) {
+ getAllSupers(cls).attributes -- ->collect(c | c.attribute)
+}
+
+query umlRdbms::getAllForwards(cls : SimpleUML::Class) : Set( SimpleUML::Association) {
+ getAllSupers(cls).forward
+}
+
+map classToTableLM in umlRdbms {
+ check uml (p:Package, c:Class) { }
+ enforce middle (p2s:PackageToSchema) {
+ realize c2t:ClassToTable
+ }
+ where (
+ c.kind = 'persistent';
+ c.namespace = p;
+ p2s.umlPackage=p;
+ ) {
+ c2t.owner := p2s;
+ c2t.umlClass := c;
+ c2t.name := c.name;
+ }
+ -- A Class has attributes
+ for anAttribute in c.attributes {
+ call classPrimitiveAttributesLM {
+ c := c;
+ a := anAttribute;
+ fao := c2t;
+ }
+ call classComplexAttributesLM {
+ c := c;
+ a := anAttribute;
+ fao := c2t;
+ }
+ call complexAttributePrimitiveAttributesLM {
+ ca := anAttribute;
+ c := anAttribute.type;
+ }
+ call complexAttributeComplexAttributesLM {
+ ca := anAttribute;
+ c := anAttribute.type;
+ }
+ }
+}
+
+map classToTableMR in umlRdbms {
+ check middle (p2s:PackageToSchema, c2t:ClassToTable) {}
+ enforce rdbms (s:Schema) {
+ realize t:Table
+ }
+ where (
+ c2t.owner = p2s;
+ ) {
+ t.kind := 'base';
+ t.schema := s;
+ }
+ call classToTableMR_1 {
+ c2t_1 := c2t;
+ t_1 := t;
+ }
+ call classToTableMR_2 {
+ t_2 := t;
+ c2t_2 := c2t;
+ }
+ for child in c2t.associationsToForeignKeys {
+ call associationToForeignKeyMR {
+ p2s := p2s;
+ dt := t;
+ -- sc2t := c2t;
+ -- dc2t <= c2t.associationsToForeignKeys.referenced;
+ a2f := child;
+ s := s;
+ st := t;
+ rk := c2t.primaryKey;
+ }
+ }
+ -- A Class has attributes
+ for child in c2t.fromAttributes->union(c2t.fromAttributes->selectByKind(umltordbms::NonLeafAttribute).fromAttributes) {
+ call attributeColumnsMR {
+ c2t := c2t;
+ a2c := child;
+ t := t;
+ }
+ }
+}
+
+map classToTableMR_1 in umlRdbms {
+ check middle (c2t_1:ClassToTable) {}
+ enforce rdbms (t_1:Table) { }
+ where () {
+ c2t_1.table := t_1;
+ t_1.name := c2t_1.name;
+ }
+}
+
+map classToTableMR_2 in umlRdbms {
+ check middle (c2t_2:ClassToTable) {}
+ enforce rdbms (t_2:Table) {
+ realize pk:Key,
+ realize pc:Column
+ }
+ where () {
+ pk.owner := t_2;
+ pk.kind := 'primary';
+ pc.owner := t_2;
+ pc.key := OrderedSet(Key){pk};
+ pc.type := 'NUMBER';
+ }
+ call classToTableMR_2_1 {
+ c2t_2_1 := c2t_2;
+ pk_2_1 := pk;
+ pc_2_1 := pc; -- TODO Check this
+ }
+ call classToTableMR_2_2 {
+ pk_2_2 := pk;
+ pc_2_2 := pc;
+ t_2_2 := t_2;
+ }
+}
+
+map classToTableMR_2_1 in umlRdbms {
+ check middle (c2t_2_1:ClassToTable) {}
+ enforce rdbms (pk_2_1:Key, pc_2_1:Column) {}
+ where () {
+ c2t_2_1.primaryKey := pk_2_1;
+ c2t_2_1.column := pc_2_1;
+ }
+}
+
+map classToTableMR_2_2 in umlRdbms {
+ check middle () {}
+ enforce rdbms (pk_2_2:Key, pc_2_2:Column, t_2_2:Table) {}
+ where () {
+ pc_2_2.name := t_2_2.name+'_tid';
+ pk_2_2.name := t_2_2.name+'_pk';
+ }
+}
+
+map associationToForeignKeyLM in umlRdbms {
+ check uml (p:Package, sc:Class, dc:Class, a:Association) {
+-- sc.namespace = p;
+ }
+ enforce middle (p2s:PackageToSchema, sc2t:ClassToTable, dc2t:ClassToTable) {
+ realize a2f:AssociationToForeignKey
+ }
+ where (
+ a.namespace = p;
+ sc := a.source;
+ dc := a.destination;
+ sc.namespace = p;
+ -- getAllForwards(sc)->includes(a);
+ -- getAllSupers(dc)->includes(a.destination);
+ p2s.umlPackage = p;
+ sc2t := sc.ClassToTable;
+ dc2t := dc.ClassToTable;
+ ) {
+ sc2t.owner := p2s;
+ a2f.owner := sc2t;
+ a2f.referenced := dc2t;
+ a2f.association := a;
+ a2f.name := if a.destination=dc and a.source=sc
+ then a.name
+ else if a.destination<>dc and a.source=sc
+ then dc.name+'_'+a.name
+ else if a.destination=dc and a.source<>sc
+ then a.name+'_'+sc.name
+ else dc.name+'_'+a.name+'_'+sc.name
+ endif endif endif;
+ }
+}
+
+map associationToForeignKeyMR in umlRdbms {
+ check middle (p2s:PackageToSchema, sc2t:ClassToTable, dc2t:ClassToTable, a2f:AssociationToForeignKey) {}
+ enforce rdbms (s:Schema, st:Table, dt:Table, rk:Key) {
+ realize fk:ForeignKey,
+ realize fc:Column
+ }
+ where (
+ a2f.owner = sc2t;
+ a2f.referenced = dc2t;
+ p2s.schema = s;
+ --sc2t.table = st;
+ --dc2t.table = dt;
+ sc2t := st.ClassToTable;
+ dc2t := dt.ClassToTable;
+ st.schema = s;
+ -- rk.owner = dt;
+ -- rk.kind = 'primary';
+ ) {
+ sc2t.owner = p2s;
+ fk.name := a2f.name;
+ fc.name := a2f.name +'_tid';
+ fk.owner := st;
+ fc.owner := st;
+ }
+ call associationToForeignKeyMR_1 {
+ fk := fk;
+ fc := fc;
+ dt := a2f.referenced.table;
+ rk := rk;
+ }
+ call associationToForeignKeyMR_2 {
+ a2f_1 := a2f;
+ fk_1 := fk;
+ fc_1 := fc;
+ }
+}
+
+map associationToForeignKeyMR_1 in umlRdbms {
+ check middle () {}
+ enforce rdbms (fk:ForeignKey, fc:Column, dt:Table, rk:Key) {}
+ where () {
+ fk.refersTo := rk;
+ fc.foreignKeys := OrderedSet(ForeignKey){fk};
+ fc.type := rk.column->first().type;
+ }
+}
+
+map associationToForeignKeyMR_2 in umlRdbms {
+ check middle (a2f_1:AssociationToForeignKey) {}
+ enforce rdbms (fk_1:ForeignKey, fc_1:Column) {}
+ where () {
+ a2f_1.foreignKey := fk_1;
+ a2f_1.column := fc_1;
+ }
+}
+
+map classPrimitiveAttributesLM in umlRdbms {
+ check uml (c:Class, t:PrimitiveDataType, a:Attribute) {
+ }
+ enforce middle (fao:ClassToTable, p2n:PrimitiveToName) {
+ realize atc:AttributeToColumn
+ }
+ where (
+ a.owner = c;
+ --getAllAttributes(c)->includes(a);
+ t := a.type;
+ fao.umlClass = c;
+ p2n := t.PrimitiveToName;
+
+ ) {
+ atc.attribute := a;
+ atc.owner := fao;
+ atc.type := p2n;
+ atc.kind := a.kind;
+ atc.name := a.name;
+ atc.leafs := Set(AttributeToColumn) {atc};
+ }
+}
+
+map classComplexAttributesLM in umlRdbms {
+ check uml (c:Class, t:Class, a:Attribute) {
+ }
+ enforce middle (fao:ClassToTable) {
+ realize fa:NonLeafAttribute
+ }
+ where (
+ a.owner = c;
+ --getAllAttributes(c)->includes(a);
+ t := a.type;
+ fao.umlClass=c;
+ ) {
+ fa.attribute := a;
+ fa.owner := fao;
+ fa.kind := a.kind;
+ fa.name := a.name;
+ fa.leafs := fao.fromAttributes.leafs->asSet();
+ }
+}
+
+map complexAttributePrimitiveAttributesLM in umlRdbms {
+ check uml (c:Class, ca:Attribute) {
+ }
+ enforce middle (fao:NonLeafAttribute) {}
+ where (
+ ca.type = c;
+ -- getAllAttributes(c)->includes(a);
+ fao := ca.FromAttribute;
+ ) {}
+ for anAttribute in c.attributes {
+ call complexAttributePrimitiveAttributesLM_1 {
+ c_1 := c;
+ ca_1 := ca;
+ fao_1 := fao;
+ a_1 := anAttribute;
+ }
+ }
+}
+
+map complexAttributePrimitiveAttributesLM_1 in umlRdbms {
+ check uml (c_1:Class, t_1:PrimitiveDataType, a_1:Attribute, ca_1:Attribute) {
+ }
+ enforce middle (fao_1:NonLeafAttribute, p2n_1:PrimitiveToName)
+ {
+ realize fa:AttributeToColumn
+ }
+ where (
+ t_1 := a_1.type;
+ --getAllAttributes(c)->includes(a);
+ p2n_1 := t_1.PrimitiveToName;
+ ) {
+ fa.owner := fao_1;
+ fa.leafs := Set(AttributeToColumn) {fa};
+ fa.attribute := a_1;
+ fa.type := p2n_1;
+ fa.kind := a_1.kind;
+ fa.name := ca_1.name + '_' + a_1.name;
+ }
+}
+
+map complexAttributeComplexAttributesLM in umlRdbms {
+ check uml (c:Class, ca:Attribute) {
+ }
+ enforce middle (fao:NonLeafAttribute) {}
+ where (
+ ca.type = c;
+ --getAllAttributes(c)->includes(a);
+ fao := ca.FromAttribute;
+ ) {}
+ for anAttribute in c.attributes {
+ call complexAttributeComplexAttributesLM_1 {
+ ca_1 := ca;
+ a_1 := anAttribute;
+ c_1 := c;
+ fao_1 := fao;
+ }
+ }
+}
+
+map complexAttributeComplexAttributesLM_1 in umlRdbms {
+ check uml (c_1:Class, ca_1:Attribute, t_1:Class, a_1:Attribute) {
+ }
+ enforce middle (fao_1:NonLeafAttribute) {
+ realize fa:NonLeafAttribute
+ }
+ where (
+ a_1.owner = c_1;
+ --getAllAttributes(c)->includes(a);
+ t_1 := a_1.type;
+ ) {
+ fa.owner := fao_1;
+ fa.leafs := fao_1.fromAttributes.leafs->asSet();
+ fa.attribute := a_1;
+ fa.kind := a_1.kind;
+ fa.name := ca_1.name + '_' + a_1.name;
+-- fa.attribute := t_1;
+ }
+}
+
+
+map attributeColumnsMR in umlRdbms {
+ check middle (c2t:ClassToTable, a2c:AttributeToColumn, p2n:PrimitiveToName) {}
+ enforce rdbms (t:Table, ct:String) {
+ realize c:Column
+ }
+ where (
+ -- c2t.fromAttributes.leafs->includes(a2c); -- need to go deeper in the recursion
+ -- a2c.owner = c2t; NOT ALL a2c are owned by c2t (complex attributes)
+ c2t.table = t;
+ p2n := a2c.type;
+ ct := p2n.typeName;
+ ) {
+ c.owner := t;
+ }
+ call attributeColumnsMR_1 {
+ a2c_1 := a2c;
+ c_1 := c;
+ }
+ call attributeColumnsMR_2 {
+ a2c_2 := a2c;
+ c_2 := c;
+ p2n_2 := p2n;
+ ct_2 := ct;
+ }
+ call attributeColumnsMR_3 {
+ c_3 := c;
+ a2c_3 := a2c;
+ }
+}
+
+map attributeColumnsMR_1 in umlRdbms {
+ check middle (a2c_1:AttributeToColumn) {}
+ enforce rdbms (c_1:Column) {}
+ where () {
+ a2c_1.column := c_1;
+ }
+}
+
+map attributeColumnsMR_2 in umlRdbms {
+ check middle (p2n_2:PrimitiveToName, a2c_2:AttributeToColumn) {}
+ enforce rdbms (c_2:Column, ct_2:String) {}
+ where (
+ a2c_2.type = p2n_2;
+ ) {
+ c_2.type := ct_2;
+ }
+ call attributeColumnsMR_2_1 {
+ p2n_2_1 := p2n_2;
+ ct_2_1 := ct_2;
+ }
+}
+
+map attributeColumnsMR_2_1 in umlRdbms {
+ check middle (p2n_2_1:PrimitiveToName) {}
+ enforce rdbms (ct_2_1:String) {}
+ where () {
+ p2n_2_1.typeName := ct_2_1;
+ }
+}
+
+map attributeColumnsMR_3 in umlRdbms {
+ check middle (a2c_3:AttributeToColumn) {}
+ enforce rdbms (c_3:Column) { }
+ where () {
+ c_3.name := a2c_3.name;
+ c_3.kind := a2c_3.kind;
+ }
+}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Expressions/Expressions.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Expressions/Expressions.qvti
index 2398f87fc..187a9f809 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Expressions/Expressions.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Expressions/Expressions.qvti
@@ -1,23 +1,23 @@
-import ecore : 'http://www.eclipse.org/emf/2002/Ecore';
-
-transformation Expressions {
- source imports ecore;
- target imports ecore;
- middle imports ecore;
-}
-
-map expressionsLM in Expressions {
- check source(dummy:EPackage) {}
- enforce middle() {}
- where () {}
- call expressionsMR {
- binaryPrecedence := (1 + 2) * (3*5 + 4);
- unaryPrecedence := -1 * - -1;
- }
-}
-
-map expressionsMR in Expressions {
- check middle(binaryPrecedence:OclAny, unaryPrecedence:OclAny) { }
- enforce target() {}
- where () {}
-}
+import ecore : 'http://www.eclipse.org/emf/2002/Ecore';
+
+transformation Expressions {
+ source imports ecore;
+ target imports ecore;
+ middle imports ecore;
+}
+
+map expressionsLM in Expressions {
+ check source(dummy:EPackage) {}
+ enforce middle() {}
+ where () {}
+ call expressionsMR {
+ binaryPrecedence := (1 + 2) * (3*5 + 4);
+ unaryPrecedence := -1 * - -1;
+ }
+}
+
+map expressionsMR in Expressions {
+ check middle(binaryPrecedence:OclAny, unaryPrecedence:OclAny) { }
+ enforce target() {}
+ where () {}
+}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti
index 79b56edd4..b0ed28503 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti
@@ -1,68 +1,68 @@
-import SimpleGraph : '../Graph2GraphMinimal/SimpleGraph.ecore'::simplegraph;
-import SimpleGraph2Graph : '../Graph2GraphMinimal/SimpleGraph2Graph.ecore'::simplegraph2graph;
-
-transformation CopyGraph {
- upperGraph imports SimpleGraph;
- lowerGraph imports SimpleGraph;
- middle imports SimpleGraph2Graph;
-}
-
-map Graph2Middle in CopyGraph { -- L to M for G
- check upperGraph(g1:Graph) {}
- enforce middle() {
- realize middleG2G:Graph2Graph
- }
- where () {
- middleG2G.graph1 := g1;
- middleG2G.name := g1.name.toLowerCase();
- }
- for child in g1.element->select(e | e.oclIsTypeOf(simplegraph::Node)) {
- call Node2Middle {
- n1 := child;
- middleParent := middleG2G;
- }
- }
- call Middle2Graph {
- g2Gmiddle := middleG2G;
- }
-}
-
-map Node2Middle in CopyGraph { -- L to M for N
- check upperGraph(n1:Node) { }
- enforce middle(middleParent:Graph2Graph) {
- realize n2n:Node2Node
- }
- where () {
- n2n.owner := middleParent;
- n2n.node1 := n1;
- n2n.label := n1.label.toLowerCase();
- }
-}
-
-map Middle2Graph in CopyGraph { -- M to R for G
- check middle(g2Gmiddle:Graph2Graph) {}
- enforce lowerGraph() {
- realize g2:Graph
- }
- where () {
- g2Gmiddle.graph2 := g2;
- g2.name := g2Gmiddle.name;
- }
- for child in g2Gmiddle.element2Element->select(e2e | e2e.oclIsTypeOf(simplegraph2graph::Node2Node)) {
- call Middle2Node {
- n2n := child;
- }
- }
-}
-
-map Middle2Node in CopyGraph { -- M to R for N
- check middle(n2n:Node2Node) {}
- enforce lowerGraph () {
- realize n2:Node
- }
- where () {
- n2n.node2 := n2;
- n2.graph := n2n.owner.graph2;
- n2.label := n2n.label;
- }
-}
+import SimpleGraph : '../Graph2GraphMinimal/SimpleGraph.ecore'::simplegraph;
+import SimpleGraph2Graph : '../Graph2GraphMinimal/SimpleGraph2Graph.ecore'::simplegraph2graph;
+
+transformation CopyGraph {
+ upperGraph imports SimpleGraph;
+ lowerGraph imports SimpleGraph;
+ middle imports SimpleGraph2Graph;
+}
+
+map Graph2Middle in CopyGraph { -- L to M for G
+ check upperGraph(g1:Graph) {}
+ enforce middle() {
+ realize middleG2G:Graph2Graph
+ }
+ where () {
+ middleG2G.graph1 := g1;
+ middleG2G.name := g1.name.toLowerCase();
+ }
+ for child in g1.element->select(e | e.oclIsTypeOf(simplegraph::Node)) {
+ call Node2Middle {
+ n1 := child;
+ middleParent := middleG2G;
+ }
+ }
+ call Middle2Graph {
+ g2Gmiddle := middleG2G;
+ }
+}
+
+map Node2Middle in CopyGraph { -- L to M for N
+ check upperGraph(n1:Node) { }
+ enforce middle(middleParent:Graph2Graph) {
+ realize n2n:Node2Node
+ }
+ where () {
+ n2n.owner := middleParent;
+ n2n.node1 := n1;
+ n2n.label := n1.label.toLowerCase();
+ }
+}
+
+map Middle2Graph in CopyGraph { -- M to R for G
+ check middle(g2Gmiddle:Graph2Graph) {}
+ enforce lowerGraph() {
+ realize g2:Graph
+ }
+ where () {
+ g2Gmiddle.graph2 := g2;
+ g2.name := g2Gmiddle.name;
+ }
+ for child in g2Gmiddle.element2Element->select(e2e | e2e.oclIsTypeOf(simplegraph2graph::Node2Node)) {
+ call Middle2Node {
+ n2n := child;
+ }
+ }
+}
+
+map Middle2Node in CopyGraph { -- M to R for N
+ check middle(n2n:Node2Node) {}
+ enforce lowerGraph () {
+ realize n2:Node
+ }
+ where () {
+ n2n.node2 := n2;
+ n2.graph := n2n.owner.graph2;
+ n2.label := n2n.label;
+ }
+}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphMinimal/Graph2GraphMinimal.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphMinimal/Graph2GraphMinimal.qvti
index 3d3fcaa80..1ab24ae2c 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphMinimal/Graph2GraphMinimal.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/Graph2GraphMinimal/Graph2GraphMinimal.qvti
@@ -1,33 +1,33 @@
-import SimpleGraph : 'SimpleGraph.ecore'::simplegraph;
-import SimpleGraph2Graph : 'SimpleGraph2Graph.ecore'::simplegraph2graph;
-
-transformation CopyGraphMinimal {
- upperGraph imports SimpleGraph;
- lowerGraph imports SimpleGraph;
- middle imports SimpleGraph2Graph;
-}
-
-map upper2lowerLM in CopyGraphMinimal {
- check upperGraph(g1:Graph) {}
- enforce middle() {
- realize g2g:Graph2Graph
- }
- where () {
- g2g.graph1 := g1;
- g2g.name := g1.name;
- }
- call upper2lowerMR {
- g2gout := g2g;
- }
-}
-
-map upper2lowerMR in CopyGraphMinimal {
- check middle(g2gout:Graph2Graph) { }
- enforce lowerGraph() {
- realize g2:Graph
- }
- where () { -- M to R for G
- g2gout.graph2 := g2;
- g2.name := g2gout.name;
- }
-}
+import SimpleGraph : 'SimpleGraph.ecore'::simplegraph;
+import SimpleGraph2Graph : 'SimpleGraph2Graph.ecore'::simplegraph2graph;
+
+transformation CopyGraphMinimal {
+ upperGraph imports SimpleGraph;
+ lowerGraph imports SimpleGraph;
+ middle imports SimpleGraph2Graph;
+}
+
+map upper2lowerLM in CopyGraphMinimal {
+ check upperGraph(g1:Graph) {}
+ enforce middle() {
+ realize g2g:Graph2Graph
+ }
+ where () {
+ g2g.graph1 := g1;
+ g2g.name := g1.name;
+ }
+ call upper2lowerMR {
+ g2gout := g2g;
+ }
+}
+
+map upper2lowerMR in CopyGraphMinimal {
+ check middle(g2gout:Graph2Graph) { }
+ enforce lowerGraph() {
+ realize g2:Graph
+ }
+ where () { -- M to R for G
+ g2gout.graph2 := g2;
+ g2.name := g2gout.name;
+ }
+}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/HSV2HLS/HSV2HLS.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/HSV2HLS/HSV2HLS.qvti
index 6230c7561..6c44dc6e0 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/HSV2HLS/HSV2HLS.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/models/HSV2HLS/HSV2HLS.qvti
@@ -1,98 +1,98 @@
--- modeltype HSVTree: '../../model/HSVTree.ecore'; -- modeltype instead of import to match QVTo
-import 'HSVTree.ecore'::HSVTree; -- modeltype instead of import to match QVTo
-import 'HLSTree.ecore'::HLSTree; -- No name because we defined the package
-import hsv2hls_0 : 'HSV2HLS.ecore'::HSV2HLS; -- A name is useful to define an alias for the same metamodel
-
--- library '../../myOclHelper.ocl'; -- Import a complete OCL with helpers
-
-transformation hsv2hls {
- hsv imports HSVTree; -- Should specify the correct package
- hls imports HLSTree; --
- -- hls imports "strict" HLSTree; --
- -- hls imports HLSTree{strict}; -- The model has to strictly conform to the HLSTree mm, without strict the model can have classes that match the name but not completely conform to the mm
- middle imports HSV2HLS;
-}
-
-query hsv2hls::hls2rgb(color : HLSTree::HLS) : HSV2HLS::RGB;
-query hsv2hls::hsv2rgb(color : HSVTree::HSV) : HSV2HLS::RGB;
-query hsv2hls::rgb2hls(color : HSV2HLS::RGB) : HLSTree::HLS;
-query hsv2hls::rgb2hsv(color : HSV2HLS::RGB) : HSVTree::HSV;
-
-
-map HSV2MiddleRoot in hsv2hls { -- Mapping root nodes L to M
- check hsv(hsvRoot : HSVNode) { }
- enforce middle() {
- realize middleRoot : HSVNode2HLSNode
- }
- where(
- hsvRoot.parent = null;
- ) {
- middleRoot.hsv := hsvRoot;
- middleRoot.name := hsvRoot.name;
- --middleRoot.rgb := hsv2rgb(hsvRoot.hsv);
- }
- for hsvChild in hsvRoot.children { -- recursive call to visit children
- call HSV2MiddleRecursion {
- hsvNode := hsvChild;
- middleParent := middleRoot;
- }
- }
- call Middle2HLSRoot { -- invoke middle to output mapping
- middleNode := middleRoot;
- }
-}
-
-map HSV2MiddleRecursion in hsv2hls { -- Mapping child nodes L to M
- check hsv(hsvNode : HSVNode) {}
- enforce middle(middleParent : HSVNode2HLSNode) {
- realize middleNode : HSVNode2HLSNode
- }
- where() {
- middleNode.parent := middleParent;
- middleNode.hsv := hsvNode;
- middleNode.name := hsvNode.name;
- --middleNode.rgb := hsv2rgb(hsvNode.hsv);
- }
- for hsvChild in hsvNode.children { -- recursive call to visit children
- call HSV2MiddleRecursion {
- hsvNode := hsvChild;
- middleParent := middleNode;
- }
- }
-}
-
-map Middle2HLSRoot in hsv2hls { -- Mapping root nodes M to R
- check middle(middleNode : HSVNode2HLSNode) {}
- enforce hls() {
- realize hlsNode : HLSNode
- }
- where() {
- hlsNode.parent := null;
- middleNode.hls := hlsNode;
- hlsNode.name := middleNode.name;
- --hlsNode.hls := rgb2hls(middleNode.rgb);
- }
- for middleChild in middleNode.children { -- recursive call to visit children
- call Middle2HLSRecursion {
- middleNode := middleChild;
- }
- }
-}
-
-map Middle2HLSRecursion in hsv2hls { -- Mapping child nodes M to R
- check middle(middleNode : HSVNode2HLSNode) {}
- enforce hls() {
- realize hlsNode : HLSNode
- }
- where() {
- hlsNode.parent := middleNode.parent.hls;
- middleNode.hls := hlsNode;
- hlsNode.name := middleNode.name;
- --hlsNode.hls := rgb2hls(middleNode.rgb);
- }
- for middleChild in middleNode.children { -- recursive call to visit children
- call Middle2HLSRecursion {
- middleNode := middleChild;
- }
- }
+-- modeltype HSVTree: '../../model/HSVTree.ecore'; -- modeltype instead of import to match QVTo
+import 'HSVTree.ecore'::HSVTree; -- modeltype instead of import to match QVTo
+import 'HLSTree.ecore'::HLSTree; -- No name because we defined the package
+import hsv2hls_0 : 'HSV2HLS.ecore'::HSV2HLS; -- A name is useful to define an alias for the same metamodel
+
+-- library '../../myOclHelper.ocl'; -- Import a complete OCL with helpers
+
+transformation hsv2hls {
+ hsv imports HSVTree; -- Should specify the correct package
+ hls imports HLSTree; --
+ -- hls imports "strict" HLSTree; --
+ -- hls imports HLSTree{strict}; -- The model has to strictly conform to the HLSTree mm, without strict the model can have classes that match the name but not completely conform to the mm
+ middle imports HSV2HLS;
+}
+
+query hsv2hls::hls2rgb(color : HLSTree::HLS) : HSV2HLS::RGB;
+query hsv2hls::hsv2rgb(color : HSVTree::HSV) : HSV2HLS::RGB;
+query hsv2hls::rgb2hls(color : HSV2HLS::RGB) : HLSTree::HLS;
+query hsv2hls::rgb2hsv(color : HSV2HLS::RGB) : HSVTree::HSV;
+
+
+map HSV2MiddleRoot in hsv2hls { -- Mapping root nodes L to M
+ check hsv(hsvRoot : HSVNode) { }
+ enforce middle() {
+ realize middleRoot : HSVNode2HLSNode
+ }
+ where(
+ hsvRoot.parent = null;
+ ) {
+ middleRoot.hsv := hsvRoot;
+ middleRoot.name := hsvRoot.name;
+ --middleRoot.rgb := hsv2rgb(hsvRoot.hsv);
+ }
+ for hsvChild in hsvRoot.children { -- recursive call to visit children
+ call HSV2MiddleRecursion {
+ hsvNode := hsvChild;
+ middleParent := middleRoot;
+ }
+ }
+ call Middle2HLSRoot { -- invoke middle to output mapping
+ middleNode := middleRoot;
+ }
+}
+
+map HSV2MiddleRecursion in hsv2hls { -- Mapping child nodes L to M
+ check hsv(hsvNode : HSVNode) {}
+ enforce middle(middleParent : HSVNode2HLSNode) {
+ realize middleNode : HSVNode2HLSNode
+ }
+ where() {
+ middleNode.parent := middleParent;
+ middleNode.hsv := hsvNode;
+ middleNode.name := hsvNode.name;
+ --middleNode.rgb := hsv2rgb(hsvNode.hsv);
+ }
+ for hsvChild in hsvNode.children { -- recursive call to visit children
+ call HSV2MiddleRecursion {
+ hsvNode := hsvChild;
+ middleParent := middleNode;
+ }
+ }
+}
+
+map Middle2HLSRoot in hsv2hls { -- Mapping root nodes M to R
+ check middle(middleNode : HSVNode2HLSNode) {}
+ enforce hls() {
+ realize hlsNode : HLSNode
+ }
+ where() {
+ hlsNode.parent := null;
+ middleNode.hls := hlsNode;
+ hlsNode.name := middleNode.name;
+ --hlsNode.hls := rgb2hls(middleNode.rgb);
+ }
+ for middleChild in middleNode.children { -- recursive call to visit children
+ call Middle2HLSRecursion {
+ middleNode := middleChild;
+ }
+ }
+}
+
+map Middle2HLSRecursion in hsv2hls { -- Mapping child nodes M to R
+ check middle(middleNode : HSVNode2HLSNode) {}
+ enforce hls() {
+ realize hlsNode : HLSNode
+ }
+ where() {
+ hlsNode.parent := middleNode.parent.hls;
+ middleNode.hls := hlsNode;
+ hlsNode.name := middleNode.name;
+ --hlsNode.hls := rgb2hls(middleNode.rgb);
+ }
+ for middleChild in middleNode.children { -- recursive call to visit children
+ call Middle2HLSRecursion {
+ middleNode := middleChild;
+ }
+ }
} \ No newline at end of file

Back to the top