Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 72a5db7ef2ad856c47c3cfcfd34a32861e5c91d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
source _source : 'SourceMM1.ecore#/'
target _target : 'TargetMM1.ecore#/'

mappings {
	map _target::TRoot from SRoot {
		ownedA := ownedX.resolve;
	}
	
	map _target::A1 from X when isA1 {
		name := name;
		ownsB := ownsY.oclAsType(Y1).resolve;
	}
	
	
	map _target::A2 from X when isA2 {
		name := name;
		ownsC := ownsY.oclAsType(Y2).resolve;
	}

	map _target::A3 from X when isA3 {
		name := name;
		ownsC := ownsY.oclAsType(Y2).resolve;
	}
	
	map _target::B from Y1 {
		name := name;
		ownsD := ownsZ.resolve;
	}	

	map _target::C from Y2 {
		name := name;
		ownsD := ownsZ.resolve;
	}
	
	map _target::D from Z when parentIsY1 {
		toA := toY.oclAsType(_'source'::Y1).resolve.toA1;
		refsB := if refers = null then null else resolve.lookup(B,refers) endif;
	}
	
	
	map _target::D from Z when parentIsY2{
		toA := toY.oclAsType(_'source'::Y2).resolve.toA2;
		refsC := if refers = null then null else resolve.lookup(C,refers) endif;
	}
}

disambiguation {
	X {
		isA1 := isA1;
		isA2 := isA2;
		isA3 := not(isA1 or isA2);
	}
	
	Z {
		parentIsY1 := oclContainer().oclIsTypeOf(Y1);
		parentIsY2 := oclContainer().oclIsTypeOf(Y2);		
	}
}

nameresolution {
	
	named-element NamedElement name-property name; 	  /*from target */
	name-referencer PathElementCS name-property name; /*from source */
	name-qualifier PathNameCS name-segments-property path; /*from source */
		
	TRoot {
		scopes-resetting A1, A2 using ownedA;
	}
	
	A1 {
		named-element /*name-property name*/
			qualifies B using ownsB;
		
		for ownsB
			scopes B using following ownsB;
	}
	
	A2 {
		named-element
			qualifies C using ownsC;		
		
		for ownsC
			scopes C using following ownsC;
	}
	
	B {
		named-element;
	}
	
	C {
		named-element;
	}
	
	--D{} -- FIXME, just to generate the env method
}

Back to the top