Skip to content

Commit 6372ada

Browse files
committed
SYSML2_-173 Separated library model FlowConnections from Connections.
- Updated implicit generalization mapping for flow connections. - Updated SysML Xpect tests. - Updated SysML semantics tests.
1 parent 9bb1d29 commit 6372ada

19 files changed

Lines changed: 13979 additions & 13887 deletions

File tree

org.omg.sysml.interactive.tests/resources/org/omg/sysml/semantics/tests/sysml-simple-specializations.csv

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ true,checkItemDefinitionSpecialization,ItemDefinition,Items::Item,Package,Owning
33
true,checkPartDefinitionSpecialization,PartDefinition,Parts::Part,Package,OwningMembership
44
true,checkPortDefinitionSpecialization,PortDefinition,Ports::Port,Package,OwningMembership
55
true,checkConnectionDefinitionSpecialization,ConnectionDefinition,Connections::Connection,Package,OwningMembership
6-
false,checkFlowConnectionDefinitionSpecialization,FlowConnectionDefinition,Connections::MessageConnection,Package,OwningMembership
6+
false,checkFlowConnectionDefinitionSpecialization,FlowConnectionDefinition,FlowConnections::MessageConnection,Package,OwningMembership
77
true,checkInterfaceDefinitionSpecialization,InterfaceDefinition,Interfaces::Interface,Package,OwningMembership
88
true,checkAllocationDefinitionSpecialization,AllocationDefinition,Allocations::Allocation,Package,OwningMembership
99
true,checkActionDefinitionSpecialization,ActionDefinition,Actions::Action,Package,OwningMembership
@@ -42,7 +42,8 @@ true,checkPortUsageSpecialization,PortUsage,Ports::ports,Package,OwningMembershi
4242
true,checkPortSubportSpecialization,PortUsage,Ports::Port::subports,PortUsage,FeatureMembership
4343
true,checkPortSubportSpecialization,PortUsage,Ports::Port::subports,PortDefinition,FeatureMembership
4444
true,checkConnectionUsageSpecialization,ConnectionUsage,Connections::connections,Package,OwningMembership
45-
true,checkSuccessionFlowConnectionUsageSpecialization,SuccessionFlowConnectionUsage,Connections::successionFlowConnections,Package,OwningMembership
45+
true,checkFlowConnectionUsageSpecialization,FlowConnectionUsage,FlowConnections::messageConnections,Package,OwningMembership
46+
true,checkSuccessionFlowConnectionUsageSpecialization,SuccessionFlowConnectionUsage,FlowConnections::successionFlowConnections,Package,OwningMembership
4647
true,checkInterfaceUsageSpecialization,InterfaceUsage,Interfaces::interfaces,Package,OwningMembership
4748
true,checkAllocationUsageSpecialization,AllocationUsage,Allocations::allocations,Package,OwningMembership
4849
true,checkActionUsageSpecialization,ActionUsage,Actions::actions,Package,OwningMembership

org.omg.sysml.interactive.tests/src/org/omg/sysml/semantics/tests/SysMLBinaryRelationTest.java

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,31 +69,47 @@ public void checkInterfaceDefinitionBinarySpecialization() {
6969
@Test
7070
public void checkConnectionUsageBinarySpecialization() {
7171
var resource = getResource();
72-
var interfaceDefinition = SysMLFactory.eINSTANCE.createConnectionUsage();
72+
var connectionUsage = SysMLFactory.eINSTANCE.createConnectionUsage();
7373

74-
resource.getContents().add(interfaceDefinition);
74+
resource.getContents().add(connectionUsage);
7575

76-
addEndTo(interfaceDefinition);
77-
addEndTo(interfaceDefinition);
76+
addEndTo(connectionUsage);
77+
addEndTo(connectionUsage);
7878

79-
ElementUtil.transformAll(interfaceDefinition, true);
79+
ElementUtil.transformAll(connectionUsage, true);
8080

81-
assertTrue(specializes(interfaceDefinition, "Connections::binaryConnections"));
81+
assertTrue(specializes(connectionUsage, "Connections::binaryConnections"));
8282
}
8383

8484
@Test
8585
public void checkInterfaceUsageBinarySpecialization() {
8686
var resource = getResource();
87-
var interfaceDefinition = SysMLFactory.eINSTANCE.createInterfaceUsage();
87+
var interfaceUsage = SysMLFactory.eINSTANCE.createInterfaceUsage();
8888

89-
resource.getContents().add(interfaceDefinition);
89+
resource.getContents().add(interfaceUsage);
9090

91-
addEndTo(interfaceDefinition);
92-
addEndTo(interfaceDefinition);
91+
addEndTo(interfaceUsage);
92+
addEndTo(interfaceUsage);
9393

94-
ElementUtil.transformAll(interfaceDefinition, true);
94+
ElementUtil.transformAll(interfaceUsage, true);
95+
96+
assertTrue(specializes(interfaceUsage, "Interfaces::binaryInterfaces"));
97+
}
98+
99+
@Test
100+
public void checkFlowConnectionUsageFlowSpecialization() {
101+
//Succession flow connection is always binary, no base case
102+
var resource = getResource();
103+
var flowConnectionUsage = SysMLFactory.eINSTANCE.createFlowConnectionUsage();
104+
105+
resource.getContents().add(flowConnectionUsage);
106+
107+
addEndTo(flowConnectionUsage);
108+
addEndTo(flowConnectionUsage);
109+
110+
ElementUtil.transformAll(flowConnectionUsage, true);
95111

96-
assertTrue(specializes(interfaceDefinition, "Interfaces::binaryInterfaces"));
112+
assertTrue(specializes(flowConnectionUsage, "FlowConnections::flowConnections"));
97113
}
98114

99115
@Test
@@ -109,7 +125,7 @@ public void checkSuccessionFlowConnectionUsageSpecialization() {
109125

110126
ElementUtil.transformAll(interfaceDefinition, true);
111127

112-
assertTrue(specializes(interfaceDefinition, "Connections::successionFlowConnections"));
128+
assertTrue(specializes(interfaceDefinition, "FlowConnections::successionFlowConnections"));
113129
}
114130

115131
//Utility methods

org.omg.sysml.xpect.tests/library.systems/Actions.sysml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ standard library package Actions {
2727
private import TransitionPerformances::TransitionPerformance;
2828
private import TransitionPerformances::NonStateTransitionPerformance;
2929
private import Transfers::MessageTransfer;
30-
private import Connections::MessageConnection;
30+
private import FlowConnections::MessageConnection;
3131
private import OccurrenceFunctions::destroy;
3232

3333
abstract action def Action :> Performance {
@@ -239,9 +239,14 @@ standard library package Actions {
239239
* is the base type for all TerminateActionUsages.
240240
*/
241241

242-
in occurrence terminatedOccurrence[1];
242+
in occurrence terminatedOccurrence[1] {
243+
doc
244+
/*
245+
* The Occurrence to be terminated.
246+
*/
247+
}
243248

244-
action terminateOccurrence : destroy {
249+
action terminateOccurrence : destroy[1] {
245250
in occ = terminatedOccurrence;
246251
}
247252
}

org.omg.sysml.xpect.tests/library.systems/Connections.sysml

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -44,68 +44,6 @@ standard library package Connections {
4444
end target: Anything[0..*] :>> BinaryLinkObject::target;
4545
}
4646

47-
abstract flow def MessageConnection :> BinaryConnection, Transfer, Action {
48-
doc
49-
/*
50-
* MessageConnection is the class of binary connections that represent a transfer
51-
* of objects or values between two occurrences. It is the base type of all
52-
* FlowConnectionDefinitions.
53-
*/
54-
55-
end occurrence source: Occurrence[0..*] :>> BinaryConnection::source, Transfer::source;
56-
end occurrence target: Occurrence[0..*] :>> BinaryConnection::target, Transfer::target;
57-
58-
ref payload :>> 'item';
59-
60-
private ref part thisConnection = self;
61-
62-
in event occurrence sourceEvent [1] default thisConnection.start {
63-
doc
64-
/*
65-
* An occurrence happening during the source of this flow connection
66-
* that is either the start of the connection or happens before it.
67-
*/
68-
}
69-
in event occurrence targetEvent [1] default thisConnection.done {
70-
doc
71-
/*
72-
* An occurrence happening during the target of this flow connection
73-
* that is either the end of the connection or happens after it.
74-
*/
75-
}
76-
77-
connection :HappensDuring connect sourceEvent to source[1];
78-
connection :HappensDuring connect targetEvent to target[1];
79-
80-
private attribute seBeforeNum: Natural[1] = if sourceEvent==thisConnection.start ? 0 else 1;
81-
private attribute teAfterNum: Natural[1] = if targetEvent==thisConnection.done ? 0 else 1;
82-
succession [seBeforeNum] first sourceEvent[0..1] then self[0..1];
83-
succession [teAfterNum] first self[0..1] then targetEvent[0..1];
84-
}
85-
86-
abstract flow def FlowConnection :> MessageConnection, FlowTransfer {
87-
doc
88-
/*
89-
* FlowConnection is the subclass of message connections that a alsow flow transfers.
90-
* It is the base type for FlowConnectionUsages that identify their source output and
91-
* target input.
92-
*/
93-
94-
end occurrence source: Occurrence[0..*] :>> MessageConnection::source, FlowTransfer::source;
95-
end occurrence target: Occurrence[0..*] :>> MessageConnection::target, FlowTransfer::target;
96-
}
97-
98-
abstract flow def SuccessionFlowConnection :> FlowConnection, FlowTransferBefore {
99-
doc
100-
/*
101-
* SuccessionFlowConnection is the subclass of flow connections that represent
102-
* temporally ordered transfers. It is the base type for all SuccessionFlowConnectionUsages.
103-
*/
104-
105-
end occurrence source: Occurrence[0..*] :>> FlowConnection::source, FlowTransferBefore::source;
106-
end occurrence target: Occurrence[0..*] :>> FlowConnection::target, FlowTransferBefore::target;
107-
}
108-
10947
abstract connection connections: Connection[0..*] nonunique :> linkObjects, parts {
11048
doc
11149
/*
@@ -119,35 +57,4 @@ standard library package Connections {
11957
* binaryConnections is the base feature of all binary ConnectionUsages.
12058
*/
12159
}
122-
123-
abstract message messageConnections: MessageConnection[0..*] nonunique :> binaryConnections, transfers, actions {
124-
doc
125-
/*
126-
* messageConnections is the base feature of all FlowConnectionUsages.
127-
*/
128-
129-
end occurrence source: Occurrence[0..*] :>> MessageConnection::source, binaryConnections::source, transfers::source;
130-
end occurrence target: Occurrence[0..*] :>> MessageConnection::target, binaryConnections::target, transfers::target;
131-
}
132-
133-
abstract message flowConnections: FlowConnection[0..*] nonunique :> messageConnections, flowTransfers {
134-
doc
135-
/*
136-
* flowConnections is the base feature of all FlowConnectionUsages that identify their source output
137-
* and target input.
138-
*/
139-
140-
end occurrence source: Occurrence[0..*] :>> FlowConnection::source, messageConnections::source, flowTransfers::source;
141-
end occurrence target: Occurrence[0..*] :>> FlowConnection::target, messageConnections::target, flowTransfers::target;
142-
}
143-
144-
abstract message successionFlowConnections: SuccessionFlowConnection[0..*] nonunique :> flowConnections, flowTransfersBefore {
145-
doc
146-
/*
147-
* successionFlowConnections is the base feature of all SuccessionFlowConnectionUsages.
148-
*/
149-
150-
end occurrence source: Occurrence[0..*] :>> SuccessionFlowConnection::source, flowConnections::source, flowTransfersBefore::source;
151-
end occurrence target: Occurrence[0..*] :>> SuccessionFlowConnection::target, flowConnections::target, flowTransfersBefore::target;
152-
}
15360
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
standard library package FlowConnections {
2+
doc
3+
/*
4+
* This package defines the base types for flow connections and related behavioral elements
5+
* in the SysML language.
6+
*/
7+
8+
private import Links::Link;
9+
private import Occurrences::Occurrence;
10+
private import Occurrences::HappensDuring;
11+
private import Objects::binaryLinkObjects;
12+
private import Transfers::Transfer;
13+
private import Transfers::transfers;
14+
private import Transfers::FlowTransfer;
15+
private import Transfers::flowTransfers;
16+
private import Transfers::FlowTransferBefore;
17+
private import Transfers::flowTransfersBefore;
18+
private import Actions::Action;
19+
private import Actions::actions;
20+
private import ScalarValues::Natural;
21+
22+
abstract flow def MessageConnection :> Action, Link {
23+
doc
24+
/*
25+
* MessageConnection is the most general class of actions that represent
26+
* interactions between linked things. It is the base type of all
27+
* FlowConnectionDefinitions.
28+
*/
29+
30+
ref payload [0..*] {
31+
doc
32+
/*
33+
* A payload that may be transferred during the interaction.
34+
*/
35+
}
36+
}
37+
38+
abstract flow def MessageTransferConnection :> MessageConnection, Transfer {
39+
doc
40+
/*
41+
* MessageTransferConnection is the subclass of message connections that represent
42+
* a transfer of objects or values between two occurrences. It is the base type of all
43+
* FlowConnectionUsages.
44+
*/
45+
46+
end occurrence source: Occurrence[0..*] :>> Transfer::source;
47+
end occurrence target: Occurrence[0..*] :>> Transfer::target;
48+
49+
ref :>> payload :>> 'item';
50+
51+
private ref action thisConnection = self;
52+
53+
in event occurrence sourceEvent [1] default thisConnection.start {
54+
doc
55+
/*
56+
* An occurrence happening during the source of this flow connection
57+
* that is either the start of the connection or happens before it.
58+
*/
59+
}
60+
in event occurrence targetEvent [1] default thisConnection.done {
61+
doc
62+
/*
63+
* An occurrence happening during the target of this flow connection
64+
* that is either the end of the connection or happens after it.
65+
*/
66+
}
67+
68+
connection :HappensDuring connect sourceEvent to source[1];
69+
connection :HappensDuring connect targetEvent to target[1];
70+
71+
private attribute seBeforeNum: Natural[1] = if sourceEvent==thisConnection.start ? 0 else 1;
72+
private attribute teAfterNum: Natural[1] = if targetEvent==thisConnection.done ? 0 else 1;
73+
succession [seBeforeNum] first sourceEvent[0..1] then self[0..1];
74+
succession [teAfterNum] first self[0..1] then targetEvent[0..1];
75+
}
76+
77+
abstract flow def FlowConnection :> MessageTransferConnection, FlowTransfer {
78+
doc
79+
/*
80+
* FlowConnection is the subclass of message connections that are also flow transfers.
81+
* It is the base type for FlowConnectionUsages that identify their source output and
82+
* target input.
83+
*/
84+
85+
end occurrence source: Occurrence[0..*] :>> MessageTransferConnection::source, FlowTransfer::source;
86+
end occurrence target: Occurrence[0..*] :>> MessageTransferConnection::target, FlowTransfer::target;
87+
}
88+
89+
abstract flow def SuccessionFlowConnection :> FlowConnection, FlowTransferBefore {
90+
doc
91+
/*
92+
* SuccessionFlowConnection is the subclass of flow connections that represent
93+
* temporally ordered transfers. It is the base type for all SuccessionFlowConnectionUsages.
94+
*/
95+
96+
end occurrence source: Occurrence[0..*] :>> FlowConnection::source, FlowTransferBefore::source;
97+
end occurrence target: Occurrence[0..*] :>> FlowConnection::target, FlowTransferBefore::target;
98+
}
99+
100+
abstract message messageConnections: MessageTransferConnection[0..*] nonunique :> transfers, actions {
101+
doc
102+
/*
103+
* messageConnections is the base feature of all FlowConnectionUsages.
104+
*/
105+
106+
end occurrence source: Occurrence[0..*] :>> MessageTransferConnection::source, transfers::source;
107+
end occurrence target: Occurrence[0..*] :>> MessageTransferConnection::target, transfers::target;
108+
}
109+
110+
abstract message flowConnections: FlowConnection[0..*] nonunique :> messageConnections, flowTransfers {
111+
doc
112+
/*
113+
* flowConnections is the base feature for FlowConnectionUsages that identify their source output
114+
* and target input.
115+
*/
116+
117+
end occurrence source: Occurrence[0..*] :>> FlowConnection::source, messageConnections::source, flowTransfers::source;
118+
end occurrence target: Occurrence[0..*] :>> FlowConnection::target, messageConnections::target, flowTransfers::target;
119+
}
120+
121+
abstract message successionFlowConnections: SuccessionFlowConnection[0..*] nonunique :> flowConnections, flowTransfersBefore {
122+
doc
123+
/*
124+
* successionFlowConnections is the base feature of all SuccessionFlowConnectionUsages.
125+
*/
126+
127+
end occurrence source: Occurrence[0..*] :>> SuccessionFlowConnection::source, flowConnections::source, flowTransfersBefore::source;
128+
end occurrence target: Occurrence[0..*] :>> SuccessionFlowConnection::target, flowConnections::target, flowTransfersBefore::target;
129+
}
130+
}

0 commit comments

Comments
 (0)