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
74 changes: 74 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,78 @@
- Add diagram tool to duplicate graphical nodes in diagrams

=== Breaking changes
- https://github.com/eclipse-syson/syson/issues/1384[#1384] [metamodel] Align metamodel to SysMLv2 2025-04 specification released on April 2025 (see https://www.omg.org/spec/SysML/ for more details) and KerML 2025-04 specification released on April 2025 (see https://www.omg.org/spec/KerML/ for more details).

**Please download all your models/projects before upgrading to 2025.8.0.**

The new concepts are:

* `InstantiationExpression` (inherits from `Expression`)
* `ConstructorExpression` (inherits from `InstantiationExpression`)

The new attributes are:

* on `Feature`
** `isConstant : EBoolean`
* on `Usage`
** `mayTimeVary : EBoolean`

The new operations are:

* on `Element`
** `path() : EString`
* on `Feature`
** `isFeaturingType(Type) : EBoolean`
** `canAccess(Feature) : EBoolean`
* on `Type`
** `isCompatibleWith(Type) : EBoolean`
** `allRedefinedFeaturesOf(Membership) : Feature`

The new references are:

* on `Connector`
** `defaultFeaturingType : Type`
* on `InstantiationExpression`
** `argument : Expression`

The updates are:

* concept `FlowConnectionDefinition` has been renamed to `FlowDefinition`
* concept `FlowConnectionUsage` has been renamed to `FlowUsage`
* concept `SuccessionFlowConnectionUsage` has been renamed to `SuccessionFlowUsage`
* concept `ItemFlow` has been renamed to `Flow`
** reference `itemFlowEnd : ItemFlowEnd` has been renamed to `flowEnd : FlowEnd`
* concept `ItemFlowEnd` has been renamed to `FlowEnd`
* concept `SuccessionItemFlow` has been renamed to `SuccessionFlow`TypeFeaturing
** reference `featuringType : Type` doesn't redefine `type` anymore
** reference `featureOfType : Feature` doesn't redefine `feature` anymore
* concept `ItemFeature` has been renamed to `PayloadFeature`
* on `MetadataAccessExpression`
** reference `referencedElement : Element` is now derived and subsets `member`
** on `FeatureMembership`
** reference `owningType : Type` doesn't redefine `type` anymore
** reference `ownedMemberFeature : Feature` doesn't redefine `feature` anymore
* on `Feature`
** attribute `isReadOnly : EBoolean` has been renamed to `isVariable : EBoolean`

The deletions are:

* concept `Featuring`
* concept `LifeClass`
* on `Membership`
** operation `allRedefinedFeature() : Feature`
* on `Feature`
** reference `valuation : FeatureValue`
* on `OccurrenceDefinition`
** reference `lifeClass : LifeClass`
* on `Succession`
** reference `effectStep : Step`
** reference `guardExpression : Expression`
** reference `transitionStep : Step`
** reference `triggerStep : Step`

All standard libraries have been updated to comply with the SysMLv2 2025-04 specification.
All validation rules have been updated to comply with the SysMLv2 2025-04 specification.

- https://github.com/eclipse-syson/syson/issues/893[#893] [explorer] Fix _Expand All_ tool in SysON _Explorer_ view
* `ISysONExplorerFragment` implementations now need to implement `getKind()` and `getParent()`.
Expand All @@ -33,6 +105,8 @@

=== Improvements

- https://github.com/eclipse-syson/syson/issues/1384[#1384] [metamodel] Align metamodel to SysMLv2 2025-04 specification released on April 2025(see https://www.omg.org/spec/SysML/ for more details) and KerML 2025-04 specification released on April 2024(see https://www.omg.org/spec/KerML/ for more details).

=== New features

- https://github.com/eclipse-syson/syson/issues/1396[#1396] [general-view] Add a graphical edge representation for `IncludeUseCaseUsage` in the _General View_ diagram.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ public class StandardLibrariesElementsDiagramMigrationParticipant implements IRe

private final IObjectSearchService objectSearchService;

public StandardLibrariesElementsDiagramMigrationParticipant(IObjectSearchService objectSearchService) {
private final StandardLibrariesIdsResourceToMapParser standardLibrariesIdsResourceToMapParser;

public StandardLibrariesElementsDiagramMigrationParticipant(IObjectSearchService objectSearchService, StandardLibrariesIdsResourceToMapParser standardLibrariesIdsResourceToMapParser) {
this.objectSearchService = Objects.requireNonNull(objectSearchService);
this.standardLibrariesIdsResourceToMapParser = Objects.requireNonNull(standardLibrariesIdsResourceToMapParser);
}

@Override
Expand All @@ -64,14 +67,20 @@ public String getKind() {
@Override
public void replaceJsonNode(IEditingContext editingContext, ObjectNode root, String currentAttribute, JsonNode currentValue) {
if (currentAttribute.equals("targetObjectId") && currentValue instanceof TextNode textNode) {
var optElement = this.objectSearchService.getObject(editingContext, textNode.asText())
String oldId = textNode.asText();
var optElement = this.objectSearchService.getObject(editingContext, oldId)
.filter(Element.class::isInstance)
.map(Element.class::cast);
if (optElement.isPresent()) {
var element = optElement.get();
if (ElementUtil.isStandardLibraryResource(element.eResource())) {
root.put("targetObjectId", element.getElementId());
}
} else {
var elementId = this.standardLibrariesIdsResourceToMapParser.getOldIdToElementIdMap().get(oldId);
if (elementId != null) {
root.put("targetObjectId", elementId);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*******************************************************************************/
package org.eclipse.syson.application.migration;

import java.util.Objects;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
Expand Down Expand Up @@ -42,13 +44,20 @@ public class StandardLibrariesElementsReferencesMigrationParticipant implements

private static final String PARTICIPANT_VERSION = "2025.8.0-202506301600";

private final StandardLibrariesIdsResourceToMapParser standardLibrariesIdsResourceToMapParser;

public StandardLibrariesElementsReferencesMigrationParticipant(StandardLibrariesIdsResourceToMapParser standardLibrariesIdsResourceToMapParser) {
this.standardLibrariesIdsResourceToMapParser = Objects.requireNonNull(standardLibrariesIdsResourceToMapParser);
}

@Override
public String getVersion() {
return PARTICIPANT_VERSION;
}

@Override
public String getEObjectUri(JsonResource resource, EObject eObject, EReference eReference, String uri) {
String migratedURI = uri;
if (!eReference.isContainment() && (uri.contains(ElementUtil.SYSML_LIBRARY_SCHEME) || uri.contains(ElementUtil.KERML_LIBRARY_SCHEME))) {
ResourceSet resourceSet = resource.getResourceSet();
String uriWithoutPrefixedType = uri;
Expand All @@ -63,12 +72,18 @@ public String getEObjectUri(JsonResource resource, EObject eObject, EReference e
}
URI uriAsURI = URI.createURI(uriWithoutPrefixedType);
EObject referencedEObject = resourceSet.getEObject(uriAsURI, false);
int uriFragmentIndex = uri.indexOf('#');
var prefix = uri.substring(0, uriFragmentIndex + 1);
if (referencedEObject instanceof Element element) {
int uriFragmentIndex = uri.indexOf('#');
var prefix = uri.substring(0, uriFragmentIndex + 1);
return prefix + element.getElementId();
migratedURI = prefix + element.getElementId();
} else {
var oldId = uri.substring(uriFragmentIndex + 1);
var elementId = this.standardLibrariesIdsResourceToMapParser.getOldIdToElementIdMap().get(oldId);
if (elementId != null) {
migratedURI = prefix + elementId;
}
}
}
return uri;
return migratedURI;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.syson.application.migration;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.time.Duration;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.stereotype.Service;

/**
* Allows to load the /syson-application-configuration/src/main/resources/migration/stdlib_oldId_to_elementId.txt file
* and put all entries in a map. This map contains old Ids to elementIds of all standard libraries elements prior to
* SysMLv2 2025-04 metamodel update.
*
* @author arichard
*/
@Service
public class StandardLibrariesIdsResourceToMapParser {

private final Logger logger = LoggerFactory.getLogger(StandardLibrariesIdsResourceToMapParser.class);

private final Map<String, String> oldIdToElementIdMap;

public StandardLibrariesIdsResourceToMapParser(ResourceLoader resourceLoader) {
Objects.requireNonNull(resourceLoader);
Resource resource = resourceLoader.getResource(ResourcePatternResolver.CLASSPATH_URL_PREFIX + "migration/stdlib_oldId_to_elementId.txt");
this.oldIdToElementIdMap = this.resourceToMap(resource);
}

public Map<String, String> getOldIdToElementIdMap() {
return this.oldIdToElementIdMap;
}

private Map<String, String> resourceToMap(Resource resource) {
Instant start = Instant.now();
Map<String, String> map = new HashMap<>();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.getInputStream()))) {
String line;
while ((line = reader.readLine()) != null) {
String[] parts = line.split("=");
if (parts.length == 2) {
map.put(parts[0].trim(), parts[1].trim());
}
}
} catch (IOException e) {
}
Instant finish = Instant.now();
long timeElapsed = Duration.between(start, finish).toMillis();
this.logger.info("Initialization of StandardLibrariesIdsResourceToMapParser completed in %sms".formatted(timeElapsed));
return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.eclipse.syson.application.configuration.SysMLv2PropertiesConfigurer;
import org.eclipse.syson.services.ElementInitializerSwitch;
import org.eclipse.syson.services.ImportService;
import org.eclipse.syson.services.UtilService;
import org.eclipse.syson.sysml.AcceptActionUsage;
import org.eclipse.syson.sysml.ActionUsage;
import org.eclipse.syson.sysml.Annotation;
Expand All @@ -50,7 +51,6 @@
import org.eclipse.syson.sysml.Expression;
import org.eclipse.syson.sysml.Feature;
import org.eclipse.syson.sysml.FeatureDirectionKind;
import org.eclipse.syson.sysml.FeatureMembership;
import org.eclipse.syson.sysml.FeatureReferenceExpression;
import org.eclipse.syson.sysml.FeatureTyping;
import org.eclipse.syson.sysml.FeatureValue;
Expand Down Expand Up @@ -91,6 +91,8 @@ public class DetailsViewService {

private final IReadOnlyObjectPredicate readOnlyObjectPredicate;

private final UtilService utilService;

public DetailsViewService(ComposedAdapterFactory composedAdapterFactory, IFeedbackMessageService feedbackMessageService,
final IReadOnlyObjectPredicate readOnlyObjectPredicate) {
this.composedAdapterFactory = Objects.requireNonNull(composedAdapterFactory);
Expand All @@ -101,6 +103,7 @@ public DetailsViewService(ComposedAdapterFactory composedAdapterFactory, IFeedba
this.unsetEnumLiteral = EcoreFactory.eINSTANCE.createEEnumLiteral();
this.unsetEnumLiteral.setName("unset");
this.unsetEnumLiteral.setLiteral("unset");
this.utilService = new UtilService();
}

public String getDetailsViewLabel(Element element, EStructuralFeature eStructuralFeature) {
Expand Down Expand Up @@ -194,8 +197,6 @@ public boolean isReadOnly(Element element, EStructuralFeature eStructuralFeature
if ((element instanceof StateUsage && SysmlPackage.eINSTANCE.getStateUsage_IsParallel().equals(eStructuralFeature))
|| (element instanceof StateDefinition && SysmlPackage.eINSTANCE.getStateDefinition_IsParallel().equals(eStructuralFeature))) {
isReadOnly = isReadOnly || ((Type) element).getOwnedFeature().stream().anyMatch(TransitionUsage.class::isInstance);
} else if (element instanceof FeatureMembership && SysmlPackage.eINSTANCE.getFeaturing_Feature().equals(eStructuralFeature)) {
isReadOnly = true;
} else if (element instanceof ViewUsage && SysmlPackage.eINSTANCE.getViewUsage_ExposedElement().equals(eStructuralFeature)) {
isReadOnly = true;
}
Expand Down Expand Up @@ -569,7 +570,7 @@ public Element setNewDocumentationValue(Element self, String newValue) {
}

/**
* Gets the {@link FeatureValue} from a {@link Feature} with a {@link FeatureValue} or a {@link FeatureValue}.
* Gets the {@link FeatureValue} from a {@link Feature} or a {@link FeatureValue}.
*
* @param self
* a {@link FeatureValue} or {@link Feature}
Expand All @@ -579,8 +580,8 @@ public Element getFeatureValue(Element self) {
Element result = null;
if (self instanceof FeatureValue featureValue && featureValue.getValue() != null) {
result = featureValue;
} else if (self instanceof Feature feature && feature.getValuation() != null && feature.getValuation().getValue() != null) {
result = feature.getValuation();
} else if (self instanceof Feature feature && this.utilService.getValuation(feature) != null && this.utilService.getValuation(feature).getValue() != null) {
result = this.utilService.getValuation(feature);
}
return result;
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading