diff --git a/org.omg.sysml.logic.bundle/lib/org.omg.sysml.logic-0.61.0-SNAPSHOT.jar b/org.omg.sysml.logic.bundle/lib/org.omg.sysml.logic-0.61.0-SNAPSHOT.jar index 2ef1bdbe0..e7a459d4e 100644 Binary files a/org.omg.sysml.logic.bundle/lib/org.omg.sysml.logic-0.61.0-SNAPSHOT.jar and b/org.omg.sysml.logic.bundle/lib/org.omg.sysml.logic-0.61.0-SNAPSHOT.jar differ diff --git a/org.omg.sysml.logic/src/main/java/org/omg/sysml/adapter/UsageAdapter.java b/org.omg.sysml.logic/src/main/java/org/omg/sysml/adapter/UsageAdapter.java index 97f23f2d4..2072d544c 100644 --- a/org.omg.sysml.logic/src/main/java/org/omg/sysml/adapter/UsageAdapter.java +++ b/org.omg.sysml.logic/src/main/java/org/omg/sysml/adapter/UsageAdapter.java @@ -1,6 +1,6 @@ /******************************************************************************* * SysML 2 Pilot Implementation - * Copyright (c) 2021-2025, 2026 Model Driven Solutions, Inc. + * Copyright (c) 2021-2026 Model Driven Solutions, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the Eclipse Public License as published by @@ -22,6 +22,8 @@ import org.omg.sysml.lang.sysml.ActionDefinition; import org.omg.sysml.lang.sysml.ActionUsage; +import org.omg.sysml.lang.sysml.AttributeDefinition; +import org.omg.sysml.lang.sysml.AttributeUsage; import org.omg.sysml.lang.sysml.Definition; import org.omg.sysml.lang.sysml.Feature; import org.omg.sysml.lang.sysml.FeatureMembership; @@ -54,6 +56,8 @@ public Usage getTarget() { /** * @satisfies validateUsageIsReferential + * @satisfies validateAttributeDefinitionFeature + * @satisfies validateAttributeUsageFeature */ @Override public void postProcess () { @@ -62,7 +66,9 @@ public void postProcess () { if (target.isVariation()) { target.setIsAbstract(true); } - if (target.getDirection() != null || target.isEnd() || !UsageUtil.hasFeaturingType(target)) { + Type featuringType = UsageUtil.getExpectedFeaturingTypeOf(target); + if (target.getDirection() != null || target.isEnd() || featuringType == null || + featuringType instanceof AttributeDefinition || featuringType instanceof AttributeUsage) { target.setIsComposite(false); } } diff --git a/org.omg.sysml.logic/src/test/java/org/omg/sysml/logic/UsagePostProcessTest.java b/org.omg.sysml.logic/src/test/java/org/omg/sysml/logic/UsagePostProcessTest.java index db261dac0..065ce7108 100644 --- a/org.omg.sysml.logic/src/test/java/org/omg/sysml/logic/UsagePostProcessTest.java +++ b/org.omg.sysml.logic/src/test/java/org/omg/sysml/logic/UsagePostProcessTest.java @@ -28,6 +28,7 @@ import org.eclipse.emf.ecore.EClass; import org.junit.BeforeClass; import org.junit.Test; +import org.omg.sysml.lang.sysml.Definition; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.FeatureDirectionKind; import org.omg.sysml.lang.sysml.Namespace; @@ -70,6 +71,12 @@ public void settingCompositeToFalse() throws InvocationTargetException { * variation part q { * variant part r; * } + * attribute def B { + * part p1; + * } + * attribute b { + * part p2; + * } * } */ Package test = (Package) createElement(SysMLPackage.Literals.PACKAGE, "test", null); @@ -88,8 +95,15 @@ public void settingCompositeToFalse() throws InvocationTargetException { q.setIsVariation(true); Usage r = (Usage) createElement(SysMLPackage.Literals.PART_USAGE, "r", q); + Definition B = SysMLFactory.eINSTANCE.createAttributeDefinition(); + Usage p1 = SysMLFactory.eINSTANCE.createPartUsage(); + TypeUtil.addOwnedFeatureTo(B, p1); + Usage b = SysMLFactory.eINSTANCE.createAttributeUsage(); + Usage p2 = SysMLFactory.eINSTANCE.createPartUsage(); + TypeUtil.addOwnedFeatureTo(b, p2); + // Post-process after creating the entire model. - postProcess(p, a, x, y, z, u, v, w, q, r); + postProcess(p, a, x, y, z, u, v, w, q, r, B, p1, b, p2); assertTrue(p.isReference()); assertTrue(a.isReference()); @@ -101,6 +115,10 @@ public void settingCompositeToFalse() throws InvocationTargetException { assertTrue(w.isReference()); assertTrue(q.isReference()); assertTrue(r.isReference()); + + assertTrue(p1.isReference()); + assertTrue(b.isReference()); + assertTrue(p2.isReference()); } /** diff --git a/org.omg.sysml.xtext/src/org/omg/sysml/xtext/validation/SysMLValidator.xtend b/org.omg.sysml.xtext/src/org/omg/sysml/xtext/validation/SysMLValidator.xtend index a465839e0..cb988f95a 100644 --- a/org.omg.sysml.xtext/src/org/omg/sysml/xtext/validation/SysMLValidator.xtend +++ b/org.omg.sysml.xtext/src/org/omg/sysml/xtext/validation/SysMLValidator.xtend @@ -549,11 +549,10 @@ class SysMLValidator extends KerMLValidator { @Check def checkAttributeDefinition(AttributeDefinition defn) { - // Not implemented for now, until resolution of KerML issues on composite semantics. (See KERML-4.) - // TODO: Check validateAttributeDefinitionFeatures + // Check validateAttributeDefinitionFeatures // NOTE: Only check owned features, for efficiency and to avoid redundancy. // (This should be sufficient, unless a composite feature is inherited from a KerML data type.) - // checkAllNotComposite(defn.ownedFeature, INVALID_ATTRIBUTE_DEFINITION_FEATURES_MSG, INVALID_ATTRIBUTE_DEFINITION_FEATURES) + checkAllNotComposite(defn.ownedFeature, INVALID_ATTRIBUTE_DEFINITION_FEATURES_MSG, INVALID_ATTRIBUTE_DEFINITION_FEATURES) } @Check @@ -573,11 +572,10 @@ class SysMLValidator extends KerMLValidator { error(INVALID_REFERENCE_USAGE_IS_REFERENCE_MSG, usg, null, INVALID_REFERENCE_USAGE_IS_REFERENCE) } - // Not implemented for now, until resolution of KerML issues on composite semantics. (See KerML-4.) - // TODO: Check validateAttributeUsageFeatures + // Check validateAttributeUsageFeatures // NOTE: Only check owned features, for efficiency and to avoid redundancy. // (This should be sufficient, unless a composite feature is inherited from a KerML data type.) - // checkAllNotComposite(usg.ownedFeature, INVALID_ATTRIBUTE_USAGE_FEATURES_MSG, INVALID_ATTRIBUTE_USAGE_FEATURES) + checkAllNotComposite(usg.ownedFeature, INVALID_ATTRIBUTE_USAGE_FEATURES_MSG, INVALID_ATTRIBUTE_USAGE_FEATURES) } @Check diff --git a/sysml.library/Systems Library/Actions.sysml b/sysml.library/Systems Library/Actions.sysml index 65a3b108e..cc78878b8 100644 --- a/sysml.library/Systems Library/Actions.sysml +++ b/sysml.library/Systems Library/Actions.sysml @@ -145,7 +145,13 @@ standard library package Actions { * The subactions of this Action that are AssignmentActions. */ - in target; + in target { + doc + /* + * This provides an implicit redefining feature for AssignmentAction::target and + * assignmentActions::target, ensuring "target" remains the first parameter. + */ + } } abstract action ifSubactions : IfThenAction[0..*] :> subactions, ifThenActions {