Skip to content

Commit 8b77636

Browse files
committed
Added SysML Association Examples based on KerML Association Examples.
- Updated the repository save test to include example with cross subsetting.
1 parent 92e5317 commit 8b77636

4 files changed

Lines changed: 106 additions & 0 deletions

File tree

org.omg.sysml.xtext/src/org/omg/sysml/xtext/util/SysMLRepositorySaveTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public class SysMLRepositorySaveTest extends SysMLRepositorySaveUtil {
6262
"17-Sequence Modeling/17b-Sequence-Modeling.sysml",
6363
"18-Use Case/18-Use Case.sysml",
6464
"../training/19. Terminate Actions/Terminate Actions Example-1.sysml",
65+
"../examples/Association Examples/ProductSelection_UnownedEnds.sysml",
6566
"../examples/Geometry Examples/SimpleQuadcopter.sysml"
6667
};
6768

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package ProductSelection_N_ary_SysML {
2+
3+
item def ShoppingCart;
4+
item def Product;
5+
item def Account;
6+
7+
// User-specified connection defiation definition
8+
connection def ProductSelection {
9+
end [0..1] item cart: ShoppingCart[1];
10+
end [0..*] item selectedProduct: Product[1];
11+
end [1..1] item account : Account[1];
12+
}
13+
14+
// Equivalent connection defiation definition with named end items.
15+
connection def ProductSelection1 {
16+
end inCart[0..1] item cart: ShoppingCart[1];
17+
end selectedProducts[0..*] item selectedProduct: Product[1];
18+
end withAccount[1..1] item account : Account[1];
19+
}
20+
21+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package ProductSelection_OwnedEnds_SysML {
2+
3+
item def SelectionInfo;
4+
item def ShoppingCart;
5+
item def Product;
6+
7+
// User-specified connection defiation definition
8+
connection def ProductSelection {
9+
item info: SelectionInfo;
10+
11+
end [0..1] item cart: ShoppingCart[1];
12+
end [0..*] nonunique item selectedProduct: Product[1];
13+
}
14+
15+
// Equivalent connection defiation definition with named end items.
16+
connection def ProductSelection1 {
17+
item info: SelectionInfo;
18+
19+
end inCart[0..1] item cart: ShoppingCart[1];
20+
end selectedProducts[0..*] item selectedProduct: Product[1];
21+
}
22+
23+
connection def SingleProductSelection specializes ProductSelection {
24+
end [0..1] item cart: ShoppingCart[1];
25+
end [0..1] item selectedProduct: Product[1];
26+
}
27+
28+
connection def SingleProductSelection1 specializes ProductSelection1 {
29+
end inCart1 [0..1] item cart: ShoppingCart[1];
30+
end selectedProduct1 [0..1] item selectedProduct: Product[1];
31+
}
32+
33+
item def OnlineCustomer {
34+
item info1: SelectionInfo;
35+
item myCart: ShoppingCart[1];
36+
item products: Product[0..*];
37+
38+
connection ps1 : ProductSelection connect myCart to products {
39+
:>> info = info1;
40+
}
41+
42+
connection ps2 : ProductSelection connect [1] myCart to [1] products {
43+
:>> info = info1;
44+
}
45+
}
46+
47+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package ProductSelection_UnownedEnds_SysML {
2+
3+
item def SelectionInfo;
4+
item def ShoppingCart {
5+
item selectedProducts : Product[0..*];
6+
}
7+
item def Product {
8+
item inCart: ShoppingCart[0..1];
9+
}
10+
11+
connection def ProductSelection {
12+
item info: SelectionInfo[1];
13+
14+
end item cart: ShoppingCart[1] crosses selectedProduct.inCart;
15+
end item selectedProduct: Product[1] crosses cart.selectedProducts;
16+
}
17+
18+
connection def SingleProductSelection :> ProductSelection {
19+
end item cart: ShoppingCart[1];
20+
end [0..1] item selectedProduct: Product[1];
21+
}
22+
23+
item def OnlineCustomer {
24+
item info1: SelectionInfo;
25+
item myCart: ShoppingCart[1];
26+
item products: Product[0..*];
27+
28+
connection ps1 : ProductSelection connect myCart to products {
29+
:>> info = info1;
30+
}
31+
32+
connection ps2 : ProductSelection connect [1] myCart to [1] products {
33+
:>> info = info1;
34+
}
35+
}
36+
37+
}

0 commit comments

Comments
 (0)