Skip to content

Commit 8074029

Browse files
committed
Merge pull request #608 from Systems-Modeling/ST6RI-808
Cross Features (KERML_-18, KERML_-140, SYSML2_-416)
2 parents 814e887 + 974eb4b commit 8074029

288 files changed

Lines changed: 142367 additions & 97702 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

kerml/src/examples/Association Examples/ProductSelection.kerml

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
package ProductSelection_N_ary {
2+
3+
class ShoppingCart;
4+
class Product;
5+
class Account;
6+
7+
// User-specified association definition
8+
assoc ProductSelection {
9+
end [0..1] feature cart: ShoppingCart[1];
10+
end [0..*] feature selectedProduct: Product[1];
11+
end [1..1] feature account : Account[1];
12+
}
13+
14+
// Equivalent association definition with named end features.
15+
assoc ProductSelection1 {
16+
end inCart[0..1] feature cart: ShoppingCart[1];
17+
end selectedProducts[0..*] feature selectedProduct: Product[1];
18+
end withAccount[1..1] feature account : Account[1];
19+
}
20+
21+
// Equivalent association definition with nested cross features.
22+
assoc ProductSelection2 {
23+
end feature cart: ShoppingCart[1] {
24+
member feature inCart[0..1]; // owned cross feature
25+
}
26+
end feature selectedProduct: Product[1] {
27+
member feature selectedProducts[0..*]; // owned cross feature
28+
}
29+
end feature account : Account[1] {
30+
member feature withAccount[1..1]; // owned cross feature
31+
}
32+
}
33+
34+
// Equivalent association definition showing library model specialization
35+
// implied cross subsetting, and "Cartesian product" features.
36+
assoc ProductSelection3 specializes Links::Link {
37+
end cart: ShoppingCart[1] crosses cart::product_account.inCart {
38+
member feature inCart: ShoppingCart[0..1] featured by Product_Account {
39+
// Represents the "Cartesian product" of Product X Account.
40+
member feature Product_Account : Account featured by Product;
41+
}
42+
member feature product_account : inCart::Product_Account featured by ProductSelection3 {
43+
public import inCart;
44+
}
45+
}
46+
end selectedProduct: Product[1] crosses selectedProduct::cart_account.selectedProducts {
47+
member feature selectedProducts: Product[0..*] featured by Cart_Account {
48+
// Represents the "Cartesian product" of ShoppingCart X Account.
49+
member feature Cart_Account : Account featured by ShoppingCart;
50+
}
51+
member feature cart_account : selectedProducts::Cart_Account featured by ProductSelection3 {
52+
public import selectedProducts;
53+
}
54+
}
55+
end feature account : Account[1] crosses account::cart_product.withAccount {
56+
member feature withAccount[1..1] : Account featured by Cart_Product {
57+
// Represents the "Cartesian product" of ShoppingCart X Product.
58+
member feature Cart_Product : Product featured by ShoppingCart;
59+
}
60+
member feature cart_product : withAccount::Cart_Product featured by ProductSelection3 {
61+
public import withAccount;
62+
}
63+
}
64+
}
65+
66+
assoc SingleProductSelection specializes ProductSelection {
67+
end [0..1] feature cart: ShoppingCart[1];
68+
end [0..1] feature selectedProduct: Product[1];
69+
end [1..1] feature account : Account[1];
70+
}
71+
72+
assoc SingleProductSelection1 specializes ProductSelection1 {
73+
end inCart1 [0..1] feature cart: ShoppingCart[1];
74+
end selectedProduct1 [0..1] feature selectedProduct: Product[1];
75+
end withAccount1 [1..1] feature account : Account[1];
76+
}
77+
78+
assoc SingleProductSelection2 specializes ProductSelection2 {
79+
end feature cart: ShoppingCart[1] {
80+
member feature inCart1[0..1]; // owned crossing feature
81+
}
82+
end feature selectedProduct: Product[1] {
83+
member feature selectedProducts1[0..*]; // owned crossing feature
84+
}
85+
end feature account : Account[1] {
86+
member feature withAccount1[0..*]; // owned crossing feature
87+
}
88+
}
89+
90+
assoc SingleProductSelection3 specializes ProductSelection3 {
91+
end cart: ShoppingCart[1] redefines cart crosses cart::product_account1.inCart1 {
92+
member feature inCart1: ShoppingCart[0..1] featured by Product_Account1 {
93+
member feature Product_Account1 subsets Product_Account : Account featured by Product;
94+
}
95+
member feature product_account1 : inCart1::Product_Account1 featured by ProductSelection3 {
96+
public import inCart1;
97+
}
98+
}
99+
end selectedProduct: Product[1] redefines selectedProduct crosses selectedProduct::cart_account1.selectedProduct1 {
100+
member feature selectedProduct1: Product[1..1] featured by Cart_Account1 {
101+
member feature Cart_Account1 subsets Cart_Account : Account featured by ShoppingCart;
102+
}
103+
member feature cart_account1 : selectedProduct1::Cart_Account1 featured by ProductSelection3 {
104+
public import selectedProduct1;
105+
}
106+
}
107+
end feature account : Account[1] crosses account::cart_product1.withAccount1 {
108+
member feature withAccount1[1..1] : Account featured by cart_product1 {
109+
member feature Cart_Product1 subsets Cart_Product : Product featured by ShoppingCart;
110+
}
111+
member feature cart_product1 : withAccount1::Cart_Product1 featured by ProductSelection3 {
112+
public import withAccount1;
113+
}
114+
}
115+
}
116+
117+
class OnlineCustomer {
118+
feature myCart: ShoppingCart[1];
119+
feature products: Product[0..*];
120+
feature myAccount : Account[1];
121+
122+
connector ps1 : ProductSelection (myCart, products, myAccount);
123+
124+
connector ps2 : ProductSelection ([1] myCart, [0..1] products, [1] myAccount);
125+
}
126+
127+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
package ProductSelection_OwnedEnds {
2+
3+
class SelectionInfo;
4+
class ShoppingCart;
5+
class Product;
6+
7+
// User-specified association definition
8+
assoc ProductSelection {
9+
feature info: SelectionInfo;
10+
11+
end [0..1] feature cart: ShoppingCart[1];
12+
end [0..*] nonunique feature selectedProduct: Product[1];
13+
}
14+
15+
// Equivalent association definition with named end features.
16+
assoc ProductSelection1 {
17+
feature info: SelectionInfo;
18+
19+
end inCart[0..1] feature cart: ShoppingCart[1];
20+
end selectedProducts[0..*] feature selectedProduct: Product[1];
21+
}
22+
23+
// Equivalent association definition with nested cross features.
24+
assoc ProductSelection2 {
25+
feature info: SelectionInfo;
26+
27+
end feature cart: ShoppingCart[1] {
28+
member feature inCart[0..1]; // owned cross feature
29+
}
30+
end feature selectedProduct: Product[1] {
31+
member feature selectedProducts[0..*]; // owned cross feature
32+
}
33+
}
34+
35+
// Equivalent association definition showing library model specialization
36+
// and implied cross subsetting.
37+
assoc ProductSelection3 specializes Links::BinaryLink {
38+
feature info: SelectionInfo;
39+
40+
end cart: ShoppingCart[1] redefines source crosses selectedProduct.inCart {
41+
member feature inCart: ShoppingCart[0..1] featured by Product;
42+
public import selectedProduct::selectedProducts;
43+
}
44+
end selectedProduct: Product[1] redefines target crosses cart.selectedProducts {
45+
member feature selectedProducts: Product[0..*] featured by ShoppingCart;
46+
public import cart::inCart;
47+
}
48+
}
49+
50+
assoc SingleProductSelection specializes ProductSelection {
51+
end [0..1] feature cart: ShoppingCart[1];
52+
end [0..1] feature selectedProduct: Product[1];
53+
}
54+
55+
assoc SingleProductSelection1 specializes ProductSelection1 {
56+
end inCart1 [0..1] feature cart: ShoppingCart[1];
57+
end selectedProduct1 [0..1] feature selectedProduct: Product[1];
58+
}
59+
60+
assoc SingleProductSelection2 specializes ProductSelection2 {
61+
end feature cart: ShoppingCart[1] {
62+
member feature inCart1[0..1]; // owned crossing feature
63+
}
64+
end feature selectedProduct: Product[1] {
65+
member feature selectedProduct1[0..1]; // owned crossing feature
66+
}
67+
}
68+
69+
assoc SingleProductSelection3 specializes ProductSelection3 {
70+
end cart: ShoppingCart[1] redefines cart crosses selectedProduct.inCart1 {
71+
member feature inCart1[0..1] subsets inCart featured by Product;
72+
public import selectedProduct::selectedProduct1;
73+
}
74+
end selectedProduct: Product[1] redefines selectedProduct crosses cart.selectedProduct1 {
75+
member feature selectedProduct1[0..1] subsets selectedProducts featured by ShoppingCart;
76+
public import cart::inCart1;
77+
}
78+
}
79+
80+
class OnlineCustomer {
81+
feature info1: SelectionInfo;
82+
feature myCart: ShoppingCart[1];
83+
feature products: Product[0..*];
84+
85+
connector ps1 : ProductSelection from myCart to products {
86+
:>> info = info1;
87+
}
88+
89+
connector ps2 : ProductSelection from [1] myCart to [1] products {
90+
:>> info = info1;
91+
}
92+
}
93+
94+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package ProductSelection_UnownedEnds {
2+
3+
class SelectionInfo;
4+
class ShoppingCart {
5+
feature selectedProducts : Product[0..*];
6+
}
7+
class Product {
8+
feature inCart: ShoppingCart[0..1];
9+
}
10+
11+
assoc ProductSelection {
12+
feature info: SelectionInfo[1];
13+
14+
end feature cart: ShoppingCart[1] crosses selectedProduct.inCart;
15+
end feature selectedProduct: Product[1] crosses cart.selectedProducts;
16+
}
17+
18+
assoc SingleProductSelection :> ProductSelection {
19+
end feature cart: ShoppingCart[1];
20+
end [0..1] feature selectedProduct: Product[1];
21+
}
22+
23+
// Equivalent association showing implied relationships explicitly.
24+
assoc SingleProductSelection1 :> ProductSelection {
25+
end feature cart: ShoppingCart[1] redefines cart {
26+
public import selectedProduct::selectedProduct1;
27+
}
28+
end feature selectedProduct: Product[1] redefines selectedProduct crosses cart.selectedProduct1 {
29+
member feature selectedProduct1[0..1] subsets ShoppingCart::selectedProducts featured by ShoppingCart;
30+
}
31+
}
32+
33+
class OnlineCustomer {
34+
feature info1: SelectionInfo;
35+
feature myCart: ShoppingCart[1];
36+
feature products: Product[0..*];
37+
38+
connector ps1 : ProductSelection from myCart to products {
39+
:>> info = info1;
40+
}
41+
42+
connector ps2 : ProductSelection from [1] myCart to [1] products {
43+
:>> info = info1;
44+
}
45+
}
46+
47+
}

kerml/src/examples/KerML Spec Annex A Examples/A-3-3-OneToOneConnectors.kerml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package OneToOneConnectorsModelToBeExecuted {
1010
classifier Bicycle {
1111
feature rollsOn : Wheel [2];
1212
feature holdsWheel : BikeFork [*];
13-
connector fixWheel : BikeWheelFixed from rollsOn [1] to holdsWheel [1];
13+
connector fixWheel : BikeWheelFixed from [1] rollsOn to [1] holdsWheel;
1414
}
1515
assoc BikeWheelFixed {
1616
end feature wheel : Wheel;
@@ -53,6 +53,6 @@ package OneToOneConnectorsExecution {
5353
classifier MyBike specializes Bicycle {
5454
feature redefines rollsOn : MyWheel;
5555
feature redefines holdsWheel : MyBikeFork;
56-
connector redefines fixWheel : MyBikeWheel_Fork_BWF_Link [2] from rollsOn [1] to holdsWheel [1];
56+
connector redefines fixWheel : MyBikeWheel_Fork_BWF_Link [2] from [1] rollsOn to [1] holdsWheel;
5757
}
5858
}

kerml/src/examples/KerML Spec Annex A Examples/A-3-4-OneToUnrestrictedConnectors.kerml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package OneToUnrestrictedConnectorsModelToBeExecuted {
99
classifier Bicycle {
1010
feature carrier : BikeBasket [*];
1111
feature holdsWheel : BikeFork [*];
12-
connector carrierFixed : BikeBasketFixed from carrier [*] to holdsWheel [1];
12+
connector carrierFixed : BikeBasketFixed from [*] carrier to [1] holdsWheel;
1313
}
1414
classifier BikeBasket;
1515

@@ -54,6 +54,6 @@ package OneToUnrestrictedConnectorsExecution {
5454
classifier MyBike specializes Bicycle {
5555
feature redefines carrier : MyBikeBasket [2];
5656
feature redefines holdsWheel : MyBikeFork [2];
57-
connector redefines carrierFixed : MyBikeBasket_Fork_BBF_Link [2] from carrier [*] to holdsWheel [1];
57+
connector redefines carrierFixed : MyBikeBasket_Fork_BBF_Link [2] from [*] carrier to [1] holdsWheel;
5858
}
5959
}

kerml/src/examples/KerML Spec Annex A Examples/A-3-5-TimingForStructures.kerml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ package TimingForStructuresModelToBeExecuted2 {
5050
feature rollsOn : Wheel [2];
5151
feature holdsWheel : BikeFork [2];
5252
feature allParts : Occurrence unions rollsOn, holdsWheel;
53-
connector b_during_ap : HappensDuring from self [1] to allParts [*];
53+
connector b_during_ap : HappensDuring from [1] self to [*] allParts;
5454
}
5555
}
5656

@@ -104,7 +104,7 @@ package TimingForStructuresExecution2 {
104104

105105
feature redefines self : MyBike;
106106
connector redefines b_during_ap : MyBike_During_Parts_Link [4]
107-
from self [1] to allParts [*];
107+
from [1] self to [*] allParts;
108108
}
109109
}
110110

@@ -123,7 +123,7 @@ package TimingForStructuresModelToBeExecuted3 {
123123
feature holdsWheel : BikeFork [2];
124124
feature allParts : Occurrence unions rollsOn, holdsWheel;
125125
feature redefines endShot : Bicycle;
126-
connector be_while_pe : HappensWhile from endShot [1] to endShot.allParts.endShot[*];
126+
connector be_while_pe : HappensWhile from [1] endShot to [*] endShot.allParts.endShot;
127127
}
128128
}
129129

@@ -195,6 +195,6 @@ package TimingForStructuresExecution3 {
195195
struct MyBike specializes Bicycle {
196196
feature redefines endShot : MyBikeEnd;
197197
connector redefines be_while_pe : MyBikeEnd_While_PartsEnd_Link [4]
198-
from endShot [1] to endShot.allParts.endShot[*];
198+
from [1] endShot to [*] endShot.allParts.endShot;
199199
}
200200
}

0 commit comments

Comments
 (0)