Skip to content

Commit 2bc7981

Browse files
authored
Merge pull request #788 from Systems-Modeling/ST6RI-960
ST6RI-960 SysML 2.1 Ballot #3 - Library Models
2 parents 7720eae + f463a05 commit 2bc7981

5 files changed

Lines changed: 38 additions & 10 deletions

File tree

Binary file not shown.

org.omg.sysml.logic/src/main/java/org/omg/sysml/adapter/UsageAdapter.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2021-2025, 2026 Model Driven Solutions, Inc.
3+
* Copyright (c) 2021-2026 Model Driven Solutions, Inc.
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the Eclipse Public License as published by
@@ -22,6 +22,8 @@
2222

2323
import org.omg.sysml.lang.sysml.ActionDefinition;
2424
import org.omg.sysml.lang.sysml.ActionUsage;
25+
import org.omg.sysml.lang.sysml.AttributeDefinition;
26+
import org.omg.sysml.lang.sysml.AttributeUsage;
2527
import org.omg.sysml.lang.sysml.Definition;
2628
import org.omg.sysml.lang.sysml.Feature;
2729
import org.omg.sysml.lang.sysml.FeatureMembership;
@@ -54,6 +56,8 @@ public Usage getTarget() {
5456

5557
/**
5658
* @satisfies validateUsageIsReferential
59+
* @satisfies validateAttributeDefinitionFeature
60+
* @satisfies validateAttributeUsageFeature
5761
*/
5862
@Override
5963
public void postProcess () {
@@ -62,7 +66,9 @@ public void postProcess () {
6266
if (target.isVariation()) {
6367
target.setIsAbstract(true);
6468
}
65-
if (target.getDirection() != null || target.isEnd() || !UsageUtil.hasFeaturingType(target)) {
69+
Type featuringType = UsageUtil.getExpectedFeaturingTypeOf(target);
70+
if (target.getDirection() != null || target.isEnd() || featuringType == null ||
71+
featuringType instanceof AttributeDefinition || featuringType instanceof AttributeUsage) {
6672
target.setIsComposite(false);
6773
}
6874
}

org.omg.sysml.logic/src/test/java/org/omg/sysml/logic/UsagePostProcessTest.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.eclipse.emf.ecore.EClass;
2929
import org.junit.BeforeClass;
3030
import org.junit.Test;
31+
import org.omg.sysml.lang.sysml.Definition;
3132
import org.omg.sysml.lang.sysml.Element;
3233
import org.omg.sysml.lang.sysml.FeatureDirectionKind;
3334
import org.omg.sysml.lang.sysml.Namespace;
@@ -70,6 +71,12 @@ public void settingCompositeToFalse() throws InvocationTargetException {
7071
* variation part q {
7172
* variant part r;
7273
* }
74+
* attribute def B {
75+
* part p1;
76+
* }
77+
* attribute b {
78+
* part p2;
79+
* }
7380
* }
7481
*/
7582
Package test = (Package) createElement(SysMLPackage.Literals.PACKAGE, "test", null);
@@ -88,8 +95,15 @@ public void settingCompositeToFalse() throws InvocationTargetException {
8895
q.setIsVariation(true);
8996
Usage r = (Usage) createElement(SysMLPackage.Literals.PART_USAGE, "r", q);
9097

98+
Definition B = SysMLFactory.eINSTANCE.createAttributeDefinition();
99+
Usage p1 = SysMLFactory.eINSTANCE.createPartUsage();
100+
TypeUtil.addOwnedFeatureTo(B, p1);
101+
Usage b = SysMLFactory.eINSTANCE.createAttributeUsage();
102+
Usage p2 = SysMLFactory.eINSTANCE.createPartUsage();
103+
TypeUtil.addOwnedFeatureTo(b, p2);
104+
91105
// Post-process after creating the entire model.
92-
postProcess(p, a, x, y, z, u, v, w, q, r);
106+
postProcess(p, a, x, y, z, u, v, w, q, r, B, p1, b, p2);
93107

94108
assertTrue(p.isReference());
95109
assertTrue(a.isReference());
@@ -101,6 +115,10 @@ public void settingCompositeToFalse() throws InvocationTargetException {
101115
assertTrue(w.isReference());
102116
assertTrue(q.isReference());
103117
assertTrue(r.isReference());
118+
119+
assertTrue(p1.isReference());
120+
assertTrue(b.isReference());
121+
assertTrue(p2.isReference());
104122
}
105123

106124
/**

org.omg.sysml.xtext/src/org/omg/sysml/xtext/validation/SysMLValidator.xtend

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -549,11 +549,10 @@ class SysMLValidator extends KerMLValidator {
549549

550550
@Check
551551
def checkAttributeDefinition(AttributeDefinition defn) {
552-
// Not implemented for now, until resolution of KerML issues on composite semantics. (See KERML-4.)
553-
// TODO: Check validateAttributeDefinitionFeatures
552+
// Check validateAttributeDefinitionFeatures
554553
// NOTE: Only check owned features, for efficiency and to avoid redundancy.
555554
// (This should be sufficient, unless a composite feature is inherited from a KerML data type.)
556-
// checkAllNotComposite(defn.ownedFeature, INVALID_ATTRIBUTE_DEFINITION_FEATURES_MSG, INVALID_ATTRIBUTE_DEFINITION_FEATURES)
555+
checkAllNotComposite(defn.ownedFeature, INVALID_ATTRIBUTE_DEFINITION_FEATURES_MSG, INVALID_ATTRIBUTE_DEFINITION_FEATURES)
557556
}
558557

559558
@Check
@@ -573,11 +572,10 @@ class SysMLValidator extends KerMLValidator {
573572
error(INVALID_REFERENCE_USAGE_IS_REFERENCE_MSG, usg, null, INVALID_REFERENCE_USAGE_IS_REFERENCE)
574573
}
575574

576-
// Not implemented for now, until resolution of KerML issues on composite semantics. (See KerML-4.)
577-
// TODO: Check validateAttributeUsageFeatures
575+
// Check validateAttributeUsageFeatures
578576
// NOTE: Only check owned features, for efficiency and to avoid redundancy.
579577
// (This should be sufficient, unless a composite feature is inherited from a KerML data type.)
580-
// checkAllNotComposite(usg.ownedFeature, INVALID_ATTRIBUTE_USAGE_FEATURES_MSG, INVALID_ATTRIBUTE_USAGE_FEATURES)
578+
checkAllNotComposite(usg.ownedFeature, INVALID_ATTRIBUTE_USAGE_FEATURES_MSG, INVALID_ATTRIBUTE_USAGE_FEATURES)
581579
}
582580

583581
@Check

sysml.library/Systems Library/Actions.sysml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,13 @@ standard library package Actions {
145145
* The subactions of this Action that are AssignmentActions.
146146
*/
147147

148-
in target;
148+
in target {
149+
doc
150+
/*
151+
* This provides an implicit redefining feature for AssignmentAction::target and
152+
* assignmentActions::target, ensuring "target" remains the first parameter.
153+
*/
154+
}
149155
}
150156

151157
abstract action ifSubactions : IfThenAction[0..*] :> subactions, ifThenActions {

0 commit comments

Comments
 (0)