Skip to content
Closed
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
Expand Up @@ -2,6 +2,7 @@
* SysML 2 Pilot Implementation
* Copyright (c) 2024, 2025 Model Driven Solutions, Inc.
* Copyright (c) 2024 Budapest University of Technology and Economics
* Copyright (c) 2026 Obeo
*
* 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 @@ -21,10 +22,7 @@

package org.omg.sysml.adapter;

import org.omg.sysml.lang.sysml.AnnotatingElement;
import org.omg.sysml.lang.sysml.Annotation;
import org.omg.sysml.lang.sysml.Element;
import org.omg.sysml.lang.sysml.SysMLPackage;

public class AnnotationAdapter extends RelationshipAdapter {

Expand All @@ -39,16 +37,7 @@ public Annotation getTarget() {

@Override
public void postProcess() {
Annotation obj = getTarget();

// If the Annotation is not owned by an AnnotatingElement, then the annotatedElement is the owningRelatedElement.
Object annotatedElement = obj.eGet(SysMLPackage.Literals.ANNOTATION__ANNOTATED_ELEMENT, false);
if (annotatedElement == null) {
Element owningRelatedElement = obj.getOwningRelatedElement();
if (!(owningRelatedElement instanceof AnnotatingElement)) {
obj.setAnnotatedElement(owningRelatedElement);
}
}
getStructuralModelCompletionService().caseAnnotation(getTarget());
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Model Driven Solutions, Inc.
* Copyright (c) 2026 Obeo
*
* 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 @@ -19,7 +20,6 @@
package org.omg.sysml.adapter;

import org.omg.sysml.lang.sysml.Comment;
import org.omg.sysml.util.ElementUtil;

public class CommentAdapter extends AnnotatingElementAdapter {

Expand All @@ -35,8 +35,6 @@ public Comment getTarget() {
@Override
public void postProcess() {
super.postProcess();
Comment target = getTarget();
target.setLocale(ElementUtil.unescapeString(target.getLocale()));
target.setBody(ElementUtil.processCommentBody(target.getBody()));
getLexicalNormalizationService().caseComment(getTarget());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* SysML 2 Pilot Implementation
* Copyright (c) 2024 Model Driven Solutions, Inc.
* Copyright (c) 2024 Budapest University of Technology and Economics
* Copyright (c) 2026 Obeo
*
* 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 @@ -21,11 +22,7 @@

package org.omg.sysml.adapter;

import org.eclipse.emf.common.util.EList;
import org.omg.sysml.lang.sysml.Conjugation;
import org.omg.sysml.lang.sysml.Element;
import org.omg.sysml.lang.sysml.SysMLPackage;
import org.omg.sysml.lang.sysml.Type;

public class ConjugationAdapter extends RelationshipAdapter {

Expand All @@ -40,31 +37,7 @@ public Conjugation getTarget() {

@Override
public void postProcess() {
Conjugation obj = getTarget();

// If the conjugatedType is not set, then set it to the owningRelatedElement, if this is a Type,
// otherwise set it to the first ownedRelatedElement.
Object conjugatedType = obj.eGet(SysMLPackage.Literals.CONJUGATION__CONJUGATED_TYPE, false);
if (conjugatedType == null) {
Element owner = obj.getOwningRelatedElement();
if (owner instanceof Type) {
obj.setConjugatedType((Type)owner);
} else {
EList<Element> ownedRelatedElements = obj.getOwnedRelatedElement();
if (!ownedRelatedElements.isEmpty()) {
obj.setConjugatedType((Type)ownedRelatedElements.get(0));
}
}
}

// If the originalType is not set, set it to the last ownedRelatedElement.
Object originalType = obj.eGet(SysMLPackage.Literals.CONJUGATION__ORIGINAL_TYPE, false);
if (originalType == null) {
EList<Element> ownedRelatedElements = obj.getOwnedRelatedElement();
if (!ownedRelatedElements.isEmpty()) {
obj.setOriginalType((Type)ownedRelatedElements.get(ownedRelatedElements.size() - 1));
}
}
getStructuralModelCompletionService().caseConjugation(getTarget());
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2021, 2024, 2025 Model Driven Solutions, Inc.
* Copyright (c) 2026 Obeo
*
* 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 Down Expand Up @@ -36,10 +37,7 @@ public Definition getTarget() {
@Override
public void postProcess() {
super.postProcess();
Definition target = getTarget();
if (target.isVariation()) {
target.setIsAbstract(true);
}
getStructuralModelCompletionService().caseDefinition(getTarget());
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2024 Model Driven Solutions, Inc.
* Copyright (c) 2026 Obeo
*
* 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 @@ -20,10 +21,7 @@

package org.omg.sysml.adapter;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.omg.sysml.lang.sysml.Dependency;
import org.omg.sysml.lang.sysml.Element;

public class DependencyAdapter extends RelationshipAdapter {

Expand All @@ -36,12 +34,7 @@ public Dependency getTarget() {
}

public void postProcess() {
Dependency target = getTarget();

// Add all ownedRelatedElements to supplier.
EObjectResolvingEList<Element> suppliers = (EObjectResolvingEList<Element>)target.getSupplier();
EList<Element> ownedRelatedElements = target.getOwnedRelatedElement();
ownedRelatedElements.stream().forEachOrdered(suppliers::addUnique);
getStructuralModelCompletionService().caseDependency(getTarget());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* SysML 2 Pilot Implementation
* Copyright (c) 2024 Model Driven Solutions, Inc.
* Copyright (c) 2024 Budapest University of Technology and Economics
* Copyright (c) 2026 Obeo
*
* 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 @@ -21,11 +22,7 @@

package org.omg.sysml.adapter;

import org.eclipse.emf.common.util.EList;
import org.omg.sysml.lang.sysml.Differencing;
import org.omg.sysml.lang.sysml.Element;
import org.omg.sysml.lang.sysml.Feature;
import org.omg.sysml.lang.sysml.SysMLPackage;

public class DifferencingAdapter extends RelationshipAdapter {

Expand All @@ -40,19 +37,7 @@ public Differencing getTarget() {

@Override
public void postProcess() {
Differencing obj = getTarget();

// If a Differencing is parsed targeting a Feature chain, then the differencingType will be empty,
// but the Differencing will own the differencingType. So, in this case, the differencingType should
// be set to the (last) ownedRelatedelement.
Object differencingType = obj.eGet(SysMLPackage.Literals.DIFFERENCING__DIFFERENCING_TYPE, false);
if (differencingType == null) {
// Handle a differencingType that is a Feature chain.
EList<Element> ownedRelatedElements = obj.getOwnedRelatedElement();
if (!ownedRelatedElements.isEmpty()) {
obj.setDifferencingType((Feature)ownedRelatedElements.get(ownedRelatedElements.size() - 1));
}
}
getStructuralModelCompletionService().caseDifferencing(getTarget());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* SysML 2 Pilot Implementation
* Copyright (c) 2024 Model Driven Solutions, Inc.
* Copyright (c) 2024 Budapest University of Technology and Economics
* Copyright (c) 2026 Obeo
*
* 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 @@ -21,12 +22,7 @@

package org.omg.sysml.adapter;

import org.eclipse.emf.common.util.EList;
import org.omg.sysml.lang.sysml.Disjoining;
import org.omg.sysml.lang.sysml.Element;
import org.omg.sysml.lang.sysml.Feature;
import org.omg.sysml.lang.sysml.SysMLPackage;
import org.omg.sysml.lang.sysml.Type;

public class DisjoiningAdapter extends RelationshipAdapter {

Expand All @@ -41,37 +37,7 @@ public Disjoining getTarget() {

@Override
public void postProcess() {
Disjoining obj = getTarget();

// If a Disjoining is parsed targeting a Feature chain, then the disjoiningType will be empty,
// but the Disjoining will own the disjoiningType. So, in this case, the disjoiningType should
// be set to the (last) ownedRelatedelement.
Object disjoiningType = obj.eGet(SysMLPackage.Literals.DISJOINING__DISJOINING_TYPE, false);
if (disjoiningType == null) {
// Handle a disjoiningType that is a Feature chain.
EList<Element> ownedRelatedElements = obj.getOwnedRelatedElement();
if (!ownedRelatedElements.isEmpty()) {
obj.setDisjoiningType((Feature)ownedRelatedElements.get(ownedRelatedElements.size() - 1));
}
}

// If the typedDisjoined (source) is empty, set it to the owningRelatedElement, if it is a Type.
// Otherwise, set it to the first ownedRelatedElement, to the first ownedRelatedElement,
// which will be a Feature chain.
Object typeDisjoined = obj.eGet(SysMLPackage.Literals.DISJOINING__TYPE_DISJOINED, false);
if (typeDisjoined == null) {
Element owner = obj.getOwningRelatedElement();
if (owner instanceof Type) {
// Handle a Disjoining owned by the typeDisjoined.
obj.setTypeDisjoined((Type)owner);
} else {
// Handle a typeDisjoined that is a Feature chain.
EList<Element> ownedRelatedElements = obj.getOwnedRelatedElement();
if (!ownedRelatedElements.isEmpty()) {
obj.setTypeDisjoined((Feature)ownedRelatedElements.get(0));
}
}
}
getStructuralModelCompletionService().caseDisjoining(getTarget());
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2021-2022, 2026 Model Driven Solutions, Inc.
* Copyright (c) 2026 Obeo
*
* 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 Down Expand Up @@ -30,9 +31,14 @@
import org.omg.sysml.lang.sysml.Namespace;
import org.omg.sysml.lang.sysml.SysMLFactory;
import org.omg.sysml.lang.sysml.Type;
import org.omg.sysml.logic.LexicalNormalizationService;
import org.omg.sysml.logic.StructuralModelCompletionService;
import org.omg.sysml.util.ElementUtil;

public class ElementAdapter extends AdapterImpl {

private final StructuralModelCompletionService structuralModelCompletionService = new StructuralModelCompletionService();
private final LexicalNormalizationService lexicalNormalizationService = new LexicalNormalizationService();

protected Class<?> kind;
protected boolean isTransformed = false;
Expand Down Expand Up @@ -111,9 +117,15 @@ public MetadataFeature getMetaclassFeature() {
// Parse post-processing

public void postProcess() {
Element target = getTarget();
target.setDeclaredName(ElementUtil.unescapeString(target.getDeclaredName()));
target.setDeclaredShortName(ElementUtil.unescapeString(target.getDeclaredShortName()));
getLexicalNormalizationService().caseElement(getTarget());
}

protected StructuralModelCompletionService getStructuralModelCompletionService() {
return structuralModelCompletionService;
}

protected LexicalNormalizationService getLexicalNormalizationService() {
return lexicalNormalizationService;
}

// Transformation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Model Driven Solutions, Inc.
* Copyright (c) 2026 Obeo
*
* 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 @@ -21,7 +22,6 @@
package org.omg.sysml.adapter;

import org.omg.sysml.lang.sysml.EndFeatureMembership;
import org.omg.sysml.lang.sysml.Feature;

public class EndFeatureMembershipAdapter extends FeatureMembershipAdapter {

Expand All @@ -40,11 +40,7 @@ public EndFeatureMembership getTarget() {
@Override
public void postProcess() {
super.postProcess();
EndFeatureMembership target = getTarget();
Feature endFeature = target.getOwnedMemberFeature();
if (endFeature != null) {
endFeature.setIsEnd(true);
}
getStructuralModelCompletionService().caseEndFeatureMembership(getTarget());
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2021-2026 Model Driven Solutions, Inc.
* Copyright (c) 2026 Obeo
*
* 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 Down Expand Up @@ -85,10 +86,7 @@ public void postProcess() {

// Note: Can be individually overridden.
protected void setIsVariableIfConstant() {
Feature target = getTarget();
if (target.isConstant()) {
target.setIsVariable(true);
}
getStructuralModelCompletionService().caseFeature(getTarget());
}

// Caching
Expand Down
Loading
Loading