Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -54,6 +56,8 @@ public Usage getTarget() {

/**
* @satisfies validateUsageIsReferential
* @satisfies validateAttributeDefinitionFeature
* @satisfies validateAttributeUsageFeature
*/
@Override
public void postProcess () {
Expand All @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.eclipse.emf.ecore.InternalEObject;
import org.omg.sysml.lang.sysml.Feature;
import org.omg.sysml.lang.sysml.FeatureMembership;
import org.omg.sysml.lang.sysml.ReferenceSubsetting;
import org.omg.sysml.lang.sysml.ViewRenderingMembership;

public class RenderingUsage_namingFeature_InvocationDelegate extends Feature_namingFeature_InvocationDelegate {
Expand All @@ -35,19 +36,21 @@ public RenderingUsage_namingFeature_InvocationDelegate(EOperation operation) {
super(operation);
}

/**
* TODO: Update RenderingUsage with namingFeature redefinition.
*
* See SYSML21-302
*/
@Override
public Object dynamicInvoke(InternalEObject target, EList<?> arguments) throws InvocationTargetException {
Feature self = (Feature) target;

FeatureMembership membership = self.getOwningFeatureMembership();
return membership instanceof ViewRenderingMembership?
((ViewRenderingMembership)membership).getReferencedRendering():
super.dynamicInvoke(target, arguments);
if (membership instanceof ViewRenderingMembership) {
ReferenceSubsetting reference = self.getOwnedReferenceSubsetting();
if (reference != null) {
Feature referencedFeature = reference.getReferencedFeature();
if (referencedFeature != null) {
return referencedFeature.getFeatureTarget();
}
}
}
return super.dynamicInvoke(target, arguments);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,10 @@ public static RequirementConstraintKind getRequirementConstraintKindOf(Constrain

public static boolean isSubrequirement(RequirementUsage requirement) {
Type owningType = requirement.getOwningType();
/*
* TODO: Update checkRequirementUsageSubrequirementSpecialization
*
* !isAssumptionConstraint is not in the OCL
* See SYSML21-300
*
*/
return !isAssumptionConstraint(requirement) && requirement.isComposite() &&
return requirement.isComposite() &&
(owningType instanceof RequirementDefinition ||
owningType instanceof RequirementUsage);
owningType instanceof RequirementUsage) &&
!(requirement.getOwningFeatureMembership() instanceof RequirementConstraintMembership);
}

public static boolean isObjective(RequirementUsage requirement) {
Expand Down Expand Up @@ -346,7 +340,7 @@ public static <T extends RequirementConstraintMembership> Stream<ConstraintUsage
public static Stream<ConstraintUsage> getRequirementConstraints(Type owner, RequirementConstraintKind kind) {
return getRequirementConstraints(owner, RequirementConstraintMembership.class, kind);
}

public static Stream<RequirementUsage> getVerifiedRequirements(Type owner) {
return owner.getOwnedFeatureMembership().stream().
filter(RequirementVerificationMembership.class::isInstance).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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());
Expand All @@ -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());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion sysml.library/Systems Library/Actions.sysml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading