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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2020 California Institute of Technology/Jet Propulsion Laboratory
* Copyright (c) 2020-2023 Model Driven Solutions, Inc.
* Copyright (c) 2020-2025 Model Driven Solutions, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -143,11 +143,15 @@ import org.omg.sysml.lang.sysml.FlowUsage
*/
class SysMLValidator extends KerMLValidator {

public static val INVALID_DEFINITION_VARIATION_IS_ABSTRACT = "validateDefinitionVariationIsAbstract"
public static val INVALID_DEFINITION_VARIATION_IS_ABSTRACT_MSG = "A variation must be abstract."
public static val INVALID_DEFINITION_VARIATION_MEMBERSHIP = "validateDefinitionVariationMembership"
public static val INVALID_DEFINITION_VARIATION_MEMBERSHIP_MSG = "An owned usage of a variation must be a variant."
public static val INVALID_DEFINITION_VARIATION_SPECIALIZATION = "validateDefinitionVariationSpecialization"
public static val INVALID_DEFINITION_VARIATION_SPECIALIZATION_MSG = "A variation must not specialize another variation."

public static val INVALID_USAGE_VARIATION_IS_ABSTRACT = "validateUsageVariationIsAbstract"
public static val INVALID_USAGE_VARIATION_IS_ABSTRACT_MSG = "A variation must be abstract."
public static val INVALID_USAGE_VARIATION_MEMBERSHIP = "validateUsageVariationMembership"
public static val INVALID_USAGE_VARIATION_MEMBERSHIP_MSG = "An owned usage of a variation must be a variant."
public static val INVALID_USAGE_VARIATION_SPECIALIZATION = "validateUsageVariationSpecialization"
Expand Down Expand Up @@ -476,6 +480,11 @@ class SysMLValidator extends KerMLValidator {
// validateUsageIsReferential is satisfied automatically

if (usage.isVariation) {
// validateUsageVariationIsAbstract
if (!usage.isAbstract) {
error(INVALID_USAGE_VARIATION_IS_ABSTRACT_MSG, usage, null, INVALID_USAGE_VARIATION_IS_ABSTRACT)
}

// validateUsageVariationOwnedFeatureMembership
for (mem: usage.ownedFeatureMembership) {
// NOTE: Need to allow parameters and objectives because they are currently physically inserted by transform implementation.
Expand Down
11 changes: 10 additions & 1 deletion org.omg.sysml/src/org/omg/sysml/adapter/DefinitionAdapter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2021, 2024 Model Driven Solutions, Inc.
* Copyright (c) 2021, 2024, 2025 Model Driven Solutions, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -34,4 +34,13 @@ public Definition getTarget() {
return (Definition)super.getTarget();
}

@Override
public void postProcess() {
super.postProcess();
Definition target = getTarget();
if (target.isVariation()) {
target.setIsAbstract(true);
}
}

}
19 changes: 17 additions & 2 deletions org.omg.sysml/src/org/omg/sysml/adapter/UsageAdapter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2021-2024 Model Driven Solutions, Inc.
* Copyright (c) 2021-2025 Model Driven Solutions, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -53,6 +53,15 @@ public Usage getTarget() {

// Post-processing

@Override
public void postProcess () {
super.postProcess();
Usage target = getTarget();
if (target.isVariation()) {
target.setIsAbstract(true);
}
}

@Override
protected void setIsVariableIfConstant() {
}
Expand Down Expand Up @@ -197,8 +206,14 @@ protected void computeValueConnector() {
@Override
public void doTransform() {
super.doTransform();
if (UsageUtil.isVariant(getTarget())) {
Usage target = getTarget();
if (UsageUtil.isVariant(target)) {
addImplicitFeaturingTypesIfNecessary();
}

// Note: This cannot be done in postProcess, because of mayTimeVary computation.
if (target.isEnd() && mayTimeVary()) {
target.setIsConstant(true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -784,15 +784,6 @@ public EList<VariantMembership> getVariantMembership() {
return (EList<VariantMembership>)VARIANT_MEMBERSHIP__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false);
}

// Additional Overrides

@Override
public boolean isAbstract() {
return isVariation() || super.isAbstract();
}

//

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,21 +1046,11 @@ public boolean isSetIsVariable() {

// Additional overrides

@Override
public boolean isAbstract() {
return isVariation() || super.isAbstract();
}

@Override
public boolean isComposite() {
return UsageUtil.isComposite(this, isComposite);
}

@Override
public boolean isConstant() {
return isConstant || isEnd() && isMayTimeVary();
}

//

/**
Expand Down