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,24 +1,34 @@
package org.omg.kerml.xpect.tests;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.omg.kerml.xpect.tests.imports.global.KerMLImportGlobalTest;
import org.omg.kerml.xpect.tests.imports.local.KerMLImportLocalTest;
import org.omg.kerml.xpect.tests.imports.recursive.KerMLImportRecursiveTest;
import org.omg.kerml.xpect.tests.indexing.KerMLIndexerTest;
import org.omg.kerml.xpect.tests.linking.KerMLLinkingTest;
import org.omg.kerml.xpect.tests.parsing.KerMLParsingTest;
import org.omg.kerml.xpect.tests.scoping.KerMLScopingTest;
import org.omg.kerml.xpect.tests.testsuite.KerMLXtextTest;
import org.omg.kerml.xpect.tests.validation.KerMLValidationTest;
import org.omg.kerml.xpect.tests.visibility.KerMLVisibilityTest;

@SuiteClasses({
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Obeo
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.omg.kerml.xpect.tests;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.omg.kerml.xpect.tests.imports.global.KerMLImportGlobalTest;
import org.omg.kerml.xpect.tests.imports.local.KerMLImportLocalTest;
import org.omg.kerml.xpect.tests.imports.recursive.KerMLImportRecursiveTest;
import org.omg.kerml.xpect.tests.indexing.KerMLIndexerTest;
import org.omg.kerml.xpect.tests.linking.KerMLLinkingTest;
import org.omg.kerml.xpect.tests.parsing.KerMLParsingTest;
import org.omg.kerml.xpect.tests.scoping.KerMLScopingTest;
import org.omg.kerml.xpect.tests.testsuite.KerMLXtextTest;
import org.omg.kerml.xpect.tests.validation.KerMLValidationTest;
import org.omg.kerml.xpect.tests.visibility.KerMLVisibilityTest;

@SuiteClasses({
KerMLImportGlobalTest.class, //
KerMLImportLocalTest.class, //
KerMLImportRecursiveTest.class, //
KerMLLinkingTest.class,//
KerMLLinkingTest.class,//
KerMLParsingTest.class, //
KerMLScopingTest.class, //
KerMLXtextTest.class, //
Expand Down
1 change: 1 addition & 0 deletions org.omg.kerml.xtext/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Require-Bundle: org.eclipse.xtext,
org.eclipse.xtext.common.types,
org.objectweb.asm;bundle-version="9.3.0";resolution:=optional
Export-Package: org.omg.kerml.xtext,
org.omg.kerml.xtext.postprocessing,
org.omg.kerml.xtext.conversion,
org.omg.kerml.xtext.generator,
org.omg.kerml.xtext.library,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
*
*******************************************************************************/

package org.omg.kerml.xtext.postprocessing;

import org.omg.sysml.lang.sysml.AnnotatingElement;

public class AnnotatingElementParserPostProcessor extends ElementParserPostProcessor {

public AnnotatingElementParserPostProcessor(AnnotatingElement element) {
super(element);
}

public AnnotatingElement getTarget() {
return (AnnotatingElement)super.getTarget();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Obeo
* Copyright (c) 2026 Model Driven Solutions, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

package org.omg.kerml.xtext.postprocessing;

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 AnnotationParserPostProcessor extends RelationshipParserPostProcessor {

public AnnotationParserPostProcessor(Annotation element) {
super(element);
}

@Override
public Annotation getTarget() {
return (Annotation)super.getTarget();
}

@Override
public void postProcess() {
super.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);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Model Driven Solutions, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

package org.omg.kerml.xtext.postprocessing;

import org.omg.sysml.lang.sysml.Classifier;

public class ClassifierParserPostProcessor extends TypeParserPostProcessor {

public ClassifierParserPostProcessor(Classifier element) {
super(element);
}

@Override
public Classifier getTarget() {
return (Classifier)super.getTarget();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Obeo
* Copyright (c) 2026 Model Driven Solutions, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

package org.omg.kerml.xtext.postprocessing;

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

public class CommentParserPostProcessor extends AnnotatingElementParserPostProcessor {

public CommentParserPostProcessor(Comment element) {
super(element);
}

@Override
public Comment getTarget() {
return (Comment)super.getTarget();
}

@Override
public void postProcess() {
super.postProcess();
Comment target = getTarget();
target.setLocale(ElementUtil.unescapeString(target.getLocale()));
target.setBody(ElementUtil.processCommentBody(target.getBody()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Obeo
* Copyright (c) 2026 Model Driven Solutions, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

package org.omg.kerml.xtext.postprocessing;

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 ConjugationParserPostProcessor extends RelationshipParserPostProcessor {

public ConjugationParserPostProcessor(Conjugation element) {
super(element);
}

@Override
public Conjugation getTarget() {
return (Conjugation)super.getTarget();
}

@Override
public void postProcess() {
super.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));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Obeo
* Copyright (c) 2026 Model Driven Solutions, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

package org.omg.kerml.xtext.postprocessing;

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 DependencyParserPostProcessor extends RelationshipParserPostProcessor {

public DependencyParserPostProcessor(Dependency element) {
super(element);
}

@Override
public Dependency getTarget() {
return (Dependency)super.getTarget();
}

@Override
public void postProcess() {
super.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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2026 Obeo
* Copyright (c) 2026 Model Driven Solutions, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

package org.omg.kerml.xtext.postprocessing;

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 DifferencingParserPostProcessor extends RelationshipParserPostProcessor {

public DifferencingParserPostProcessor(Differencing element) {
super(element);
}

@Override
public Differencing getTarget() {
return (Differencing)super.getTarget();
}

@Override
public void postProcess() {
super.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));
}
}
}
}
Loading
Loading