Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeza Kulcsar2019-05-07 03:58:58 -0400
committerZoltan Ujhelyi2021-08-12 11:43:00 -0400
commitd75e6d39e84eb614c2425c80da9d1ee8bd016621 (patch)
treee2043e7c9af078075957e55c5be1e5696f06d58b
parent72338d7781cf0d0c54b1ea2c2a80b8ad924cec82 (diff)
downloadorg.eclipse.viatra.examples-master.tar.gz
org.eclipse.viatra.examples-master.tar.xz
org.eclipse.viatra.examples-master.zip
[547031] Adds a GT-like transformation to CPS DemonstratorHEADmaster
The transformation requires the dangling edge assumption to be set to true, as matches of the traceability patterns might not removed correctly on model deletion. Change-Id: Ib2efb19a8c58d924cd4929c9797ce0413c21023d Signed-off-by: Geza Kulcsar <geza.kulcsar@incquerylabs.com> Signed-off-by: Zoltan Ujhelyi <zoltan.ujhelyi@incquerylabs.com>
-rw-r--r--cps/pom.xml1
-rw-r--r--cps/releng/org.eclipse.viatra.examples.cps.application.feature/feature.xml7
-rw-r--r--cps/tests/org.eclipse.viatra.examples.cps.xform.m2m.tests/META-INF/MANIFEST.MF3
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.classpath9
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.project40
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.pde.core.prefs3
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/META-INF/MANIFEST.MF21
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/build.properties7
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/plugin.xml40
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/pom.xml87
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src-gen/.gitignore5
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src/org/eclipse/viatra/examples/cps/xform/m2m/incr/puregratra/queries/CPS2DeploymentIncrPureGraTra.xtend243
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src/org/eclipse/viatra/examples/cps/xform/m2m/incr/puregratra/queries/cpsXformM2M.vql407
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/xtend-gen/.gitignore5
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/META-INF/MANIFEST.MF1
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/IncrPureGraTra.xtend49
-rw-r--r--cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java4
19 files changed, 940 insertions, 1 deletions
diff --git a/cps/pom.xml b/cps/pom.xml
index 3640d8f..06b06a8 100644
--- a/cps/pom.xml
+++ b/cps/pom.xml
@@ -38,6 +38,7 @@
<module>transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.qrt</module>
<module>transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.aggr</module>
<module>transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.viatra</module>
+ <module>transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra</module>
<!-- M2T Transformations -->
<module>transformations/org.eclipse.viatra.examples.cps.xform.m2t</module>
diff --git a/cps/releng/org.eclipse.viatra.examples.cps.application.feature/feature.xml b/cps/releng/org.eclipse.viatra.examples.cps.application.feature/feature.xml
index a60f15f..9079c62 100644
--- a/cps/releng/org.eclipse.viatra.examples.cps.application.feature/feature.xml
+++ b/cps/releng/org.eclipse.viatra.examples.cps.application.feature/feature.xml
@@ -134,4 +134,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/cps/tests/org.eclipse.viatra.examples.cps.xform.m2m.tests/META-INF/MANIFEST.MF b/cps/tests/org.eclipse.viatra.examples.cps.xform.m2m.tests/META-INF/MANIFEST.MF
index 79f59c2..2a80edc 100644
--- a/cps/tests/org.eclipse.viatra.examples.cps.xform.m2m.tests/META-INF/MANIFEST.MF
+++ b/cps/tests/org.eclipse.viatra.examples.cps.xform.m2m.tests/META-INF/MANIFEST.MF
@@ -22,7 +22,8 @@ Require-Bundle: com.google.guava,
org.eclipse.viatra.examples.cps.xform.m2m.launcher;bundle-version="0.1.0",
org.eclipse.viatra.query.runtime.localsearch;bundle-version="[2.0.0,3.0.0)",
org.eclipse.viatra.query.runtime.rete;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.collections;bundle-version="9.0.0"
+ org.eclipse.collections;bundle-version="9.0.0",
+ org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra;bundle-version="0.0.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.log4j;version="1.2.15"
Automatic-Module-Name: org.eclipse.viatra.examples.cps.xform.m2m.tests
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.classpath b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.classpath
new file mode 100644
index 0000000..4a3597e
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="xtend-gen"/>
+ <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.project b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.project
new file mode 100644
index 0000000..d64f9dd
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.viatra.query.tooling.ui.projectbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.viatra.query.projectnature</nature>
+ </natures>
+</projectDescription>
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.core.resources.prefs b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.jdt.core.prefs b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.pde.core.prefs b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 0000000..36c29ad
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+pluginProject.equinox=false
+resolve.requirebundle=false
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/META-INF/MANIFEST.MF b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..fdef372
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra
+Bundle-SymbolicName: org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra;singleton:=true
+Bundle-Version: 2.6.0.qualifier
+Export-Package: org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries
+Require-Bundle: org.eclipse.viatra.transformation.runtime.emf,
+ org.eclipse.viatra.transformation.evm,
+ org.eclipse.emf.ecore,
+ org.eclipse.viatra.query.runtime,
+ org.eclipse.viatra.query.runtime.rete,
+ org.eclipse.viatra.query.runtime.localsearch,
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.viatra.examples.cps.model;bundle-version="2.6.0",
+ org.eclipse.viatra.examples.cps.deployment;bundle-version="2.6.0",
+ org.eclipse.viatra.examples.cps.traceability;bundle-version="2.6.0",
+ org.eclipse.viatra.examples.cps.xform.m2m.util;bundle-version="2.6.0",
+ org.eclipse.viatra.transformation.runtime.debug;bundle-version="[0.20.0,0.27.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: org.apache.log4j
+Automatic-Module-Name: org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/build.properties b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/build.properties
new file mode 100644
index 0000000..af2a90f
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/build.properties
@@ -0,0 +1,7 @@
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
+source.. = src/,\
+ src-gen/,\
+ xtend-gen/
+output.. = bin/
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/plugin.xml b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/plugin.xml
new file mode 100644
index 0000000..c70d0d9
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/plugin.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?><plugin>
+ <extension id="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.CpsXformM2M" point="org.eclipse.viatra.query.runtime.queryspecification">
+ <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.CpsXformM2M" id="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.CpsXformM2M">
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.cps2depTrace"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.applicationInstanceOnHost"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.danglingCps2DepTrace"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.hostInstance"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.changeHostIp"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.missingDepHost"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.appInstanceWithDepHost"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.appInstanceWithChangedHost"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.missingAppInstance"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.missingHostForAppInstance"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.renamedApplication"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.appInstanceWithStateMachine_noTrace"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.appInstanceWithStateMachine_withTrace"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.stateMachineToBeDeleted"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.stateMachineDel"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.appInstanceWithState_noTrace"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.appInstanceWithState_withTrace"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.incorrectlyMappedInitialState"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.incorrectlyMappedUnsetInitialState"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.stateDel"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.renamedElement"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.transition_noTrace"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.transition_withTrace"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.mappedOutgoingTransition"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.transitionWithMovedSource"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.transitionWithMovedTarget"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.transitionDel"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.communicatingAppInstances"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.sendTransitionAppSignal"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.waitTransitionAppSignal"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.hostFromTransition"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.behTriggerPair"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.behTriggerToRemove"/>
+ <query-specification fqn="org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.behTriggerToBeRemoved"/>
+ </group>
+ </extension>
+</plugin>
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/pom.xml b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/pom.xml
new file mode 100644
index 0000000..8892538
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.viatra.examples.cps.parent</artifactId>
+ <groupId>org.eclipse.viatra.examples.cps</groupId>
+ <version>2.6.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>clean</phase>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>src-gen</directory>
+ <excludes>
+ <exclude>.gitignore</exclude>
+ </excludes>
+ </fileset>
+ <fileset>
+ <directory>xtend-gen</directory>
+ <excludes>
+ <exclude>.gitignore</exclude>
+ </excludes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.viatra</groupId>
+ <artifactId>viatra-maven-plugin</artifactId>
+ <version>${viatra.compiler.version}</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <outputDirectory>src-gen</outputDirectory>
+ <useProjectDependencies>true</useProjectDependencies>
+ <metamodels>
+ <metamodel>
+ <packageClass>org.eclipse.viatra.examples.cps.deployment.DeploymentPackage</packageClass>
+ </metamodel>
+ <metamodel>
+ <packageClass>org.eclipse.viatra.examples.cps.cyberPhysicalSystem.CyberPhysicalSystemPackage</packageClass>
+ </metamodel>
+ <metamodel>
+ <packageClass>org.eclipse.viatra.examples.cps.traceability.TraceabilityPackage</packageClass>
+ </metamodel>
+ </metamodels>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src-gen/.gitignore b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src-gen/.gitignore
new file mode 100644
index 0000000..1a5126b
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src-gen/.gitignore
@@ -0,0 +1,5 @@
+#This file is needed to prevent git from omitting this folder that would cause build issues/compile errors.
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore \ No newline at end of file
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src/org/eclipse/viatra/examples/cps/xform/m2m/incr/puregratra/queries/CPS2DeploymentIncrPureGraTra.xtend b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src/org/eclipse/viatra/examples/cps/xform/m2m/incr/puregratra/queries/CPS2DeploymentIncrPureGraTra.xtend
new file mode 100644
index 0000000..bbdfddb
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src/org/eclipse/viatra/examples/cps/xform/m2m/incr/puregratra/queries/CPS2DeploymentIncrPureGraTra.xtend
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * Copyright (c) 2014-2019 Geza Kulcsar, Akos Horvath, Abel Hegedus, Zoltan Ujhelyi, Daniel Segesdi, IncQuery Labs Ltd.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-v20.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+package org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries
+
+import org.eclipse.viatra.examples.cps.deployment.DeploymentBehavior
+import org.eclipse.viatra.examples.cps.deployment.DeploymentFactory
+import org.eclipse.viatra.examples.cps.traceability.CPSToDeployment
+import org.eclipse.viatra.examples.cps.traceability.TraceabilityFactory
+import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine
+import org.eclipse.viatra.transformation.debug.configuration.TransformationDebuggerConfiguration
+import org.eclipse.viatra.transformation.runtime.emf.modelmanipulation.IModelManipulations
+import org.eclipse.viatra.transformation.runtime.emf.modelmanipulation.SimpleModelManipulations
+import org.eclipse.viatra.transformation.runtime.emf.rules.batch.BatchTransformationRuleFactory
+import org.eclipse.viatra.transformation.runtime.emf.transformation.batch.BatchTransformation
+import org.eclipse.viatra.transformation.runtime.emf.transformation.batch.BatchTransformation.BatchTransformationBuilder
+import org.eclipse.viatra.transformation.runtime.emf.transformation.batch.BatchTransformationStatements
+
+import static org.eclipse.viatra.query.runtime.matchers.util.Preconditions.*
+
+class CPS2DeploymentIncrPureGraTra {
+ val extension CpsXformM2M cpsXformM2M = CpsXformM2M.instance
+ val CPSToDeployment cps2dep
+
+ /** EMF metamodels **/
+ protected extension DeploymentFactory depFactory = DeploymentFactory.eINSTANCE
+ protected extension TraceabilityFactory traceFactory = TraceabilityFactory.eINSTANCE
+
+ /* Transformation-related extensions */
+ extension BatchTransformation transformation
+ extension BatchTransformationStatements statements
+
+ /* Transformation rule-related extensions */
+ extension BatchTransformationRuleFactory = new BatchTransformationRuleFactory
+ extension IModelManipulations manipulation
+
+ protected ViatraQueryEngine engine
+
+ new(CPSToDeployment cps2dep, ViatraQueryEngine engine, boolean isDebuggable, String debugName) {
+ checkArgument(cps2dep !== null, "Mapping cannot be null!")
+ checkArgument(cps2dep.cps !== null, "CPS not defined in mapping!")
+ checkArgument(cps2dep.deployment !== null, "Deployment not defined in mapping!")
+ checkArgument(engine !== null, "Engine cannot be null!")
+
+ this.cps2dep = cps2dep
+ this.engine = engine
+ prepare(engine)
+
+ createTransformation(isDebuggable, debugName)
+ }
+
+ def void execute() {
+ fireWhilePossible
+ }
+
+ private def void createTransformation(boolean isDebuggable, String debugName) {
+ // Create VIATRA model manipulations
+ this.manipulation = new SimpleModelManipulations(engine)
+ // Create VIATRA Batch transformation
+ val transformationBuilder = BatchTransformation.forEngine(engine)
+
+ if (isDebuggable) {
+ val debuggerConfig = new TransformationDebuggerConfiguration(debugName ?:
+ "CPS2DeploymentTransformationViatra")
+ transformationBuilder.addAdapterConfiguration(debuggerConfig)
+ }
+
+ transformation = transformationBuilder
+ .addHostRules
+ .addApplicationInstanceRules
+ .addStateMachineRules
+ .addStateRules
+ .addTransitionRules
+ .addActionMappingRules
+ .addRule(createRule(danglingCps2DepTrace).name("DanglingTraceRule").action [
+ // This rule is necessary to remove traces whose deployment element was
+ // already removed (e.g. because of the removal of their containers)
+ cps2dep.traces -= trace
+ ].build)
+ .addRule(createRule(renamedElement).name("ChangeApplicationIdRule").action [
+ depElement.description = expectedId
+ ].build).build
+
+ statements = transformation.transformationStatements
+ }
+
+ private def addHostRules(BatchTransformationBuilder transformationBuilder) {
+ transformationBuilder.addRule(createRule(hostInstance).name("HostRule").action [
+ val hostInstance = it.hostInstance;
+ val nodeIp = hostInstance.nodeIp;
+
+ val depHost = createDeploymentHost => [ip = nodeIp;]
+
+ cps2dep.deployment.hosts += depHost
+ cps2dep.traces += createCPS2DeploymentTrace => [
+ cpsElements += hostInstance
+ deploymentElements += depHost
+ ]
+ ].build).addRule(createRule(changeHostIp).name("ChangeHostIpRule").action [
+ depHost.ip = hostInstance.nodeIp
+ ].build).addRule(createRule(missingDepHost).name("HostRuleDel").action [
+ depHost.remove
+ trace.remove
+ ].build)
+ }
+
+ private def addApplicationInstanceRules(BatchTransformationBuilder transformationBuilder) {
+ transformationBuilder.addRule(createRule(appInstanceWithDepHost).name("ApplicationRule").action [
+ val appInstance = it.appInstance
+ val depApp = createDeploymentApplication
+
+ depHost.applications += depApp
+
+ cps2dep.traces += createCPS2DeploymentTrace => [
+ cpsElements += appInstance
+ deploymentElements += depApp
+ ]
+ ].build).addRule(createRule(appInstanceWithChangedHost).name("ReallocAppRule").action [
+ depHost1.applications -= depApp
+ depHost2.applications += depApp
+
+ ].build).addRule(createRule(missingAppInstance).name("AppRuleDel").action [
+ depApp.remove
+ trace.remove
+
+ ].build).addRule(createRule(missingHostForAppInstance).name("AppRuleMissingHostDel").action [
+ appInstance.remove
+ depApp.remove
+ trace.remove
+
+ ].build).addRule(createRule(renamedApplication).name("ChangeApplicationIdRule").action [
+ depApplication.id = expectedId
+ ].build)
+ }
+
+ private def addStateMachineRules(BatchTransformationBuilder transformationBuilder) {
+ transformationBuilder.addRule(
+ createRule(appInstanceWithStateMachine_noTrace).name("StateMachineNoTraceRule").action [
+ val sm = it.stateMachine
+ val depBehavior = createDeploymentBehavior
+ depApp.behavior = depBehavior
+
+ cps2dep.traces += createCPS2DeploymentTrace => [
+ cpsElements += sm
+ deploymentElements += depBehavior
+ ]
+ ].build).addRule(
+ createRule(appInstanceWithStateMachine_withTrace).name("StateMachineWithTraceRule").action [
+ val depBehavior = createDeploymentBehavior
+ depApp.behavior = depBehavior
+ trace.deploymentElements += depBehavior
+ ].build).addRule(createRule(stateMachineDel).name("StateMachineDel").action [
+ depBehavior.remove
+ trace.remove
+ ].build)
+ }
+
+ private def addStateRules(BatchTransformationBuilder transformationBuilder) {
+ transformationBuilder.addRule(createRule(appInstanceWithState_noTrace).name("StateNoTraceRule").action [
+ val state = it.state
+ val behState = createBehaviorState
+
+ depBehavior.states += behState
+
+ cps2dep.traces += createCPS2DeploymentTrace => [
+ cpsElements += state
+ deploymentElements += behState
+ ]
+ ].build).addRule(createRule(appInstanceWithState_withTrace).name("StateWithTraceRule").action [
+ val behState = createBehaviorState
+ depBehavior.states += behState
+ trace.deploymentElements += behState
+ ].build).addRule(createRule(incorrectlyMappedInitialState).name("InitialStateRule").action [
+ depBehavior.current = expectedCurrentState
+ ].build).addRule(createRule(incorrectlyMappedUnsetInitialState).name("UnsetInitialStateRule").action [
+ depBehavior.current = null
+ ].build).addRule(createRule(stateDel).name("StateDel").action [
+ val depBehavior = behState.eContainer as DeploymentBehavior
+ if (depBehavior.current == behState) {
+ depBehavior.current = null
+ }
+
+ behState.remove
+ trace.remove
+ ].build)
+ }
+
+ private def addTransitionRules(BatchTransformationBuilder transformationBuilder) {
+ transformationBuilder.addRule(createRule(transition_noTrace).name("TransitionNoTraceRule").action [
+ val transition = it.transition
+ val behTransition = createBehaviorTransition
+ depBehavior.transitions += behTransition
+ depSource.outgoing += behTransition
+
+ behTransition.to = depTarget
+
+ cps2dep.traces += createCPS2DeploymentTrace => [
+ cpsElements += transition
+ deploymentElements += behTransition
+ ]
+ ].build).addRule(createRule(transition_withTrace).name("TransitionWithTraceRule").action [
+ val behTransition = createBehaviorTransition
+ depBehavior.transitions += behTransition
+ depSource.outgoing += behTransition
+
+ behTransition.to = depTarget
+
+ trace.deploymentElements += behTransition
+ ].build).addRule(createRule(transitionWithMovedSource).name("TransitionWithTraceRule").action [
+ depBehavior.transitions += behTransition
+ expectedSource.outgoing += behTransition
+ actualSource.outgoing -= behTransition
+ ].build).addRule(createRule(transitionWithMovedTarget).name("TransitionWithTraceRule").action [
+ behTransition.to = expectedTarget
+ ].build).addRule(createRule(transitionDel).name("TransitionDel").action [
+ behTransition.remove
+ trace.remove
+ ].build)
+ }
+
+ private def addActionMappingRules(BatchTransformationBuilder transformationBuilder) {
+ transformationBuilder.addRule(createRule(behTriggerPair).name("TriggerRule").action [
+ behTrigger.trigger += behTarget
+ ].build).addRule(createRule(behTriggerToRemove).name("TriggerRemoval").action [
+ behTrigger.trigger -= behTarget
+ ].build).addRule(createRule(behTriggerToBeRemoved).name("DanglingTriggerRule").action [
+ behTrigger.trigger -= behTarget
+ ].build)
+ }
+
+ def void dispose() {
+ if (transformation !== null) {
+ transformation.ruleEngine.dispose
+ transformation = null
+ }
+ }
+} \ No newline at end of file
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src/org/eclipse/viatra/examples/cps/xform/m2m/incr/puregratra/queries/cpsXformM2M.vql b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src/org/eclipse/viatra/examples/cps/xform/m2m/incr/puregratra/queries/cpsXformM2M.vql
new file mode 100644
index 0000000..4dddccb
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/src/org/eclipse/viatra/examples/cps/xform/m2m/incr/puregratra/queries/cpsXformM2M.vql
@@ -0,0 +1,407 @@
+/*******************************************************************************
+ * Copyright (c) 2014-2019 Geza Kulcsar, Akos Horvath, Abel Hegedus, Zoltan Ujhelyi, Peter Lunk, Istvan David, IncQuery Labs Ltd.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-v20.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+ package org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries
+
+import "http://org.eclipse.viatra/model/cps"
+import "http://org.eclipse.viatra/model/deployment"
+import "http://org.eclipse.viatra/model/cps-traceability"
+
+import java org.eclipse.viatra.examples.cps.xform.m2m.util.SignalUtil
+
+/* General-Use Patterns */
+
+pattern cps2depTrace(cps2dep : CPSToDeployment, trace : CPS2DeploymentTrace, cpsElement : Identifiable, depElement : DeploymentElement) {
+ CPSToDeployment.traces(cps2dep, trace);
+ CPS2DeploymentTrace.cpsElements(trace, cpsElement);
+ CPS2DeploymentTrace.deploymentElements(trace, depElement);
+}
+
+pattern applicationInstanceOnHost(appType : ApplicationType, appInstance : ApplicationInstance, hostInstance : HostInstance) {
+ HostInstance.applications(hostInstance, appInstance);
+ ApplicationType.instances(appType, appInstance);
+}
+
+pattern danglingCps2DepTrace(cps2dep : CPSToDeployment, trace : CPS2DeploymentTrace) {
+ CPSToDeployment.traces(cps2dep, trace);
+ neg CPS2DeploymentTrace.deploymentElements(trace, _);
+}
+
+/* Host Rule Patterns (Spec 1) */
+
+pattern hostInstance(hostInstance : HostInstance) {
+ neg find cps2depTrace(_, _, hostInstance, _);
+}
+
+pattern changeHostIp(hostInstance: HostInstance, depHost: DeploymentHost) {
+ find cps2depTrace(_, _, hostInstance, depHost);
+ HostInstance.nodeIp(hostInstance,hostIp);
+ DeploymentHost.ip(depHost,depIp);
+ hostIp != depIp;
+}
+
+private pattern hostToBeRemoved(depHost : DeploymentHost, trace : CPS2DeploymentTrace) {
+ CPS2DeploymentTrace.deploymentElements(trace,depHost);
+ neg find cps2depTrace(_, trace, _, depHost);
+}
+
+pattern missingDepHost(depHost : DeploymentHost, trace : CPS2DeploymentTrace) {
+ find hostToBeRemoved(depHost, trace);
+ neg find incomingTriggers(depHost, _, _);
+}
+
+/* AppInstance Rule Patterns (Spec 2) */
+
+pattern appInstanceWithDepHost(appInstance : ApplicationInstance, depHost : DeploymentHost) {
+ HostInstance.applications(hostInstance, appInstance);
+ find cps2depTrace(_, _, hostInstance, depHost);
+ neg CPS2DeploymentTrace.cpsElements(_, appInstance);
+}
+
+pattern appInstanceWithChangedHost(appInstance : ApplicationInstance, depHost1 : DeploymentHost, depHost2 : DeploymentHost, depApp : DeploymentApplication) {
+ find cps2depTrace(_,_,appInstance,depApp);
+ DeploymentHost.applications(depHost1,depApp);
+ find cps2depTrace(_,_,hostInstance1,depHost1);
+ neg HostInstance.applications(hostInstance1,appInstance);
+ HostInstance.applications(hostInstance2,appInstance);
+ find cps2depTrace(_,_,hostInstance2,depHost2);
+}
+
+private pattern appInstanceToBeRemoved(depApp : DeploymentApplication, trace : CPS2DeploymentTrace) {
+ CPS2DeploymentTrace.deploymentElements(trace,depApp);
+ neg find cps2depTrace(_, trace, _, depApp);
+}
+
+pattern missingAppInstance(depApp : DeploymentApplication, trace : CPS2DeploymentTrace) {
+ find appInstanceToBeRemoved(depApp, trace);
+ neg find incomingTriggers(depApp, _, _);
+}
+
+private pattern missingAppInstanceToBeRemoved(appInstance : ApplicationInstance, depApp : DeploymentApplication, trace : CPS2DeploymentTrace) {
+ find cps2depTrace(_, trace, appInstance, depApp);
+ neg HostInstance.applications(_, appInstance);
+} or {
+ find cps2depTrace(_, trace, appInstance, depApp);
+ HostInstance.applications(hostInstance,appInstance);
+ neg HostType.instances(_, hostInstance);
+}
+
+pattern missingHostForAppInstance(appInstance : ApplicationInstance, depApp : DeploymentApplication, trace : CPS2DeploymentTrace) {
+ find missingAppInstanceToBeRemoved(appInstance, depApp, trace);
+ neg find incomingTriggers(depApp, _, _);
+}
+
+pattern renamedApplication(cpsElement : Identifiable, depApplication : DeploymentApplication, expectedId : java String) {
+ find cps2depTrace(_, _, cpsElement, depApplication);
+ Identifiable.identifier(cpsElement, expectedId);
+ DeploymentApplication.id(depApplication, actualId);
+
+ expectedId != actualId;
+} or {
+ find cps2depTrace(_, _, cpsElement, depApplication);
+ Identifiable.identifier(cpsElement, expectedId);
+ neg DeploymentApplication.id(depApplication, _);
+}
+
+/* State Machine Rule Patterns (Spec 3) */
+
+private pattern appInstanceWithStateMachine(appType : ApplicationType, appInstance : ApplicationInstance, stateMachine : StateMachine) {
+ find applicationInstanceOnHost(appType, appInstance, _);
+ ApplicationType.behavior(appType, stateMachine);
+}
+
+pattern appInstanceWithStateMachine_noTrace(appInstance : ApplicationInstance,
+ stateMachine : StateMachine, depApp : DeploymentApplication
+) {
+ find appInstanceWithStateMachine(_, appInstance, stateMachine);
+ find cps2depTrace(_, _, appInstance, depApp);
+
+ neg find cps2depTrace(_, _, stateMachine, _);
+ neg CPS2DeploymentTrace.cpsElements(_, stateMachine);
+}
+
+pattern appInstanceWithStateMachine_withTrace(appType : ApplicationType, appInstance : ApplicationInstance,
+ stateMachine : StateMachine, depApp : DeploymentApplication, trace: CPS2DeploymentTrace
+) {
+ find appInstanceWithStateMachine(appType, appInstance, stateMachine);
+ find cps2depTrace(_, _, appInstance, depApp);
+
+ CPS2DeploymentTrace.cpsElements(trace, stateMachine);
+ neg find mappedOwnedBehavior(trace, depApp);
+}
+
+private pattern mappedOwnedBehavior(trace: CPS2DeploymentTrace, depApp : DeploymentApplication) {
+ DeploymentApplication.behavior(depApp, depBehavior);
+ CPS2DeploymentTrace.deploymentElements(trace, depBehavior);
+}
+
+pattern stateMachineToBeDeleted(depBehavior : DeploymentBehavior, trace : CPS2DeploymentTrace) {
+ CPS2DeploymentTrace.deploymentElements(trace, depBehavior);
+ neg find cps2depTrace(_, trace, _, depBehavior);
+} or {
+ find cps2depTrace(_, trace, SM, depBehavior);
+ neg find appInstanceWithStateMachine(_, _, SM);
+} or {
+ // Application instance moved
+ find cps2depTrace(_,trace, SM, depBehavior);
+ ApplicationType.behavior(AT1,SM);
+ neg ApplicationInstance.type(_,AT1);
+}
+
+pattern stateMachineDel(depBehavior : DeploymentBehavior, trace : CPS2DeploymentTrace) {
+ find stateMachineToBeDeleted(depBehavior, trace);
+ neg find incomingTriggers(depBehavior, _, _);
+}
+
+/* State Rule Patterns (Spec 4) */
+
+pattern appInstanceWithState_noTrace(appType : ApplicationType, appInstance : ApplicationInstance,
+ state : State, depBehavior : DeploymentBehavior
+) {
+ find appInstanceWithStateMachine(appType, appInstance, stateMachine);
+ find cps2depTrace(_, _, stateMachine, depBehavior);
+
+ StateMachine.states(stateMachine, state);
+
+ neg find cps2depTrace(_, _, state, _);
+}
+
+pattern appInstanceWithState_withTrace(appType : ApplicationType, appInstance : ApplicationInstance,
+ state : State, depBehavior : DeploymentBehavior, trace: CPS2DeploymentTrace
+) {
+ find appInstanceWithStateMachine(appType, appInstance, stateMachine);
+ find cps2depTrace(_, _, stateMachine, depBehavior);
+
+ StateMachine.states(stateMachine, state);
+
+ CPS2DeploymentTrace.cpsElements(trace, state);
+ neg find mappedOwnedState(trace, depBehavior);
+}
+
+private pattern mappedOwnedState(trace: CPS2DeploymentTrace, depBehavior : DeploymentBehavior) {
+ DeploymentBehavior.states(depBehavior, depState);
+ CPS2DeploymentTrace.deploymentElements(trace, depState);
+}
+
+pattern incorrectlyMappedInitialState(depBehavior : DeploymentBehavior, expectedCurrentState : BehaviorState) {
+ find cps2depTrace(_, _, stateMachine, depBehavior);
+ StateMachine.initial(stateMachine, initialState);
+ DeploymentBehavior.states(depBehavior, expectedCurrentState);
+ find cps2depTrace(_, _, initialState, expectedCurrentState);
+
+ DeploymentBehavior.current(depBehavior, currentState);
+ expectedCurrentState != currentState;
+} or {
+ find cps2depTrace(_, _, stateMachine, depBehavior);
+ StateMachine.initial(stateMachine, initialState);
+ DeploymentBehavior.states(depBehavior, expectedCurrentState);
+ find cps2depTrace(_, _, initialState, expectedCurrentState);
+
+ neg DeploymentBehavior.current(depBehavior, _);
+}
+
+pattern incorrectlyMappedUnsetInitialState(stateMachine : StateMachine, depBehavior : DeploymentBehavior) {
+ find cps2depTrace(_, _, stateMachine, depBehavior);
+ neg StateMachine.initial(stateMachine, _initialState);
+ DeploymentBehavior.current(depBehavior, _);
+}
+
+pattern stateDel(behState : BehaviorState, trace : CPS2DeploymentTrace) {
+ CPS2DeploymentTrace.deploymentElements(trace,behState);
+ neg find cps2depTrace(_, trace, _, behState);
+}
+
+pattern renamedElement(cpsElement : Identifiable, depElement : DeploymentElement, expectedId : java String) {
+ find cps2depTrace(_, _, cpsElement, depElement);
+ neg DeploymentApplication(depElement); neg DeploymentHost(depElement);
+ Identifiable.identifier(cpsElement, expectedId);
+ DeploymentElement.description(depElement, actualId);
+
+ expectedId != actualId;
+} or {
+ find cps2depTrace(_, _, cpsElement, depElement);
+ neg DeploymentApplication(depElement); neg DeploymentHost(depElement);
+ Identifiable.identifier(cpsElement, expectedId);
+ neg DeploymentElement.description(depElement, _);
+}
+
+
+/* Transition Rule Patterns (Spec 5) */
+
+pattern transition_noTrace(depBehavior : DeploymentBehavior, depSource : BehaviorState, transition : Transition, depTarget : BehaviorState) {
+ State.outgoingTransitions(src,transition);
+ Transition.targetState(transition,trg);
+
+ DeploymentBehavior.states(depBehavior, depSource);
+ find cps2depTrace(_, _, src, depSource);
+ DeploymentBehavior.states(depBehavior, depTarget);
+ find cps2depTrace(_, _, trg, depTarget);
+
+ neg find cps2depTrace(_, _, transition, _);
+}
+
+pattern transition_withTrace(depBehavior : DeploymentBehavior, depSource : BehaviorState, transition : Transition, depTarget : BehaviorState, trace : CPS2DeploymentTrace) {
+ State.outgoingTransitions(src,transition);
+ Transition.targetState(transition,trg);
+
+ DeploymentBehavior.states(depBehavior, depSource);
+ find cps2depTrace(_, _, src, depSource);
+ DeploymentBehavior.states(depBehavior, depTarget);
+ find cps2depTrace(_, _, trg, depTarget);
+
+ CPS2DeploymentTrace.cpsElements(trace, transition);
+ neg find mappedOutgoingTransition(trace, depSource);
+ neg find transitionWithMovedSource(transition, depBehavior, _, _, _);
+}
+
+pattern mappedOutgoingTransition(trace: CPS2DeploymentTrace, depState : BehaviorState) {
+ BehaviorState.outgoing(depState, depTransition);
+ CPS2DeploymentTrace.deploymentElements(trace, depTransition);
+}
+
+pattern transitionWithMovedSource(transition : Transition, depBehavior : DeploymentBehavior, behTransition : BehaviorTransition, expectedSource : BehaviorState, actualSource : BehaviorState) {
+ find cps2depTrace(cps2dep, _, transition, behTransition);
+ State.outgoingTransitions(source, transition);
+ find cps2depTrace(cps2dep, _, source, expectedSource);
+ DeploymentBehavior.states(depBehavior, actualSource);
+ BehaviorState.outgoing(actualSource, behTransition);
+
+ DeploymentBehavior.states(depBehavior, expectedSource);
+ DeploymentBehavior.states(depBehavior, actualSource);
+ expectedSource != actualSource;
+}
+
+pattern transitionWithMovedTarget(behTransition : BehaviorTransition, transition : Transition, expectedTarget : BehaviorState, actualTarget : BehaviorState) {
+ find cps2depTrace(cps2dep, _, transition, behTransition);
+ Transition.targetState(transition, target);
+ find cps2depTrace(cps2dep, _, target, expectedTarget);
+ BehaviorTransition.to(behTransition, actualTarget);
+
+ DeploymentBehavior.states(depBehavior, expectedTarget);
+ DeploymentBehavior.states(depBehavior, actualTarget);
+ expectedTarget != actualTarget;
+}
+
+private pattern transitionToBeDeleted(behTransition : BehaviorTransition, trace : CPS2DeploymentTrace) {
+ CPS2DeploymentTrace.deploymentElements(trace, behTransition);
+ neg find cps2depTrace(_, trace, _, behTransition);
+} or {
+ neg BehaviorTransition.to(behTransition, _);
+ CPS2DeploymentTrace.deploymentElements(trace, behTransition);
+} or {
+ neg BehaviorState.outgoing(_, behTransition);
+ CPS2DeploymentTrace.deploymentElements(trace, behTransition);
+}
+
+pattern transitionDel(behTransition : BehaviorTransition, trace : CPS2DeploymentTrace) {
+ find transitionToBeDeleted(behTransition, trace);
+ neg find incomingTriggers(behTransition, _, _);
+}
+
+/* Action Rule Patterns (Spec 6) */
+
+private pattern reachableHosts(source : HostInstance, target : HostInstance) {
+ HostInstance.communicateWith*(source, target);
+}
+
+pattern communicatingAppInstances(sourceAppInstance : ApplicationInstance, targetAppInstance : ApplicationInstance) {
+ find applicationInstanceOnHost(_, sourceAppInstance, sourceHostInstance);
+ find applicationInstanceOnHost(_, targetAppInstance, targetHostInstance);
+ find reachableHosts(sourceHostInstance, targetHostInstance);
+}
+
+pattern sendTransitionAppSignal(transition : Transition, app : java String, signal : java String) {
+ Transition.action(transition, action);
+ app == eval(SignalUtil.getAppId(action));
+ signal == eval(SignalUtil.getSignalId(action));
+}
+
+pattern waitTransitionAppSignal(transition : Transition, signal : java String) {
+ Transition.action(transition, action);
+ check(SignalUtil.isWait(action));
+ signal == eval(SignalUtil.getSignalId(action));
+}
+
+pattern hostFromTransition(hostInstance : HostInstance, appType : ApplicationType, appInstance : ApplicationInstance, transition : Transition) {
+ ApplicationType.behavior.states.outgoingTransitions(appType, transition);
+ find applicationInstanceOnHost(appType, appInstance, hostInstance);
+}
+
+private pattern triggerPair(triggerApp : ApplicationInstance, targetApp : ApplicationInstance, cpsTrigger : Transition, cpsTarget : Transition) {
+ find sendTransitionAppSignal(cpsTrigger, targetAppId, signal);
+ find waitTransitionAppSignal(cpsTarget, signal);
+ ApplicationType.identifier(targetAppType, targetAppId);
+
+ find hostFromTransition(triggerHost, _triggerAppType, triggerApp, cpsTrigger);
+ find hostFromTransition(targetHost, targetAppType, targetApp, cpsTarget);
+
+ find reachableHosts(triggerHost, targetHost);
+}
+
+pattern behTriggerPair(cpsTrigger : Transition, cpsTarget : Transition, behTrigger : BehaviorTransition, behTarget : BehaviorTransition) {
+ find triggerPair(triggerApp, targetApp,cpsTrigger,cpsTarget);
+
+ find cps2depTrace(_, _, cpsTrigger, behTrigger);
+ find cps2depTrace(_, _, triggerApp, depTriggerApplication);
+ DeploymentApplication.behavior.transitions(depTriggerApplication, behTrigger);
+
+ find cps2depTrace(_, _, cpsTarget, behTarget);
+ find cps2depTrace(_, _, targetApp, depTargetApplication);
+ DeploymentApplication.behavior.transitions(depTargetApplication, behTarget);
+
+ neg BehaviorTransition.trigger(behTrigger, behTarget);
+}
+
+pattern behTriggerToRemove(behTrigger : BehaviorTransition, behTarget : BehaviorTransition) {
+ BehaviorTransition.trigger(behTrigger, behTarget);
+ neg find cps2depTrace(_, _, _, behTarget);
+} or {
+ BehaviorTransition.trigger(behTrigger, behTarget);
+ neg find cps2depTrace(_, _, _, behTrigger);
+} or {
+ BehaviorTransition.trigger(behTrigger, behTarget);
+
+ find cps2depTrace(cps2dep, _, cpsTrigger, behTrigger);
+ find cps2depTrace(_, _, triggerApp, depTriggerApplication);
+ DeploymentApplication.behavior.transitions(depTriggerApplication, behTrigger);
+
+ find cps2depTrace(cps2dep, _, cpsTarget, behTarget);
+ find cps2depTrace(_, _, targetApp, depTargetApplication);
+ DeploymentApplication.behavior.transitions(depTargetApplication, behTarget);
+
+ neg find triggerPair( triggerApp, targetApp, cpsTrigger, cpsTarget);
+}
+
+private pattern includedTransitions(depElement : DeploymentElement, behTransition : BehaviorTransition) {
+ depElement == behTransition;
+} or {
+ DeploymentBehavior.transitions(depElement, behTransition);
+} or {
+ DeploymentApplication.behavior.transitions(depElement, behTransition);
+} or {
+ DeploymentHost.applications.behavior.transitions(depElement, behTransition);
+}
+
+private pattern incomingTriggers(depElement : DeploymentElement, behTrigger : BehaviorTransition, behTarget : BehaviorTransition) {
+ find includedTransitions(depElement, behTarget);
+ BehaviorTransition.trigger(behTrigger, behTarget);
+}
+
+pattern behTriggerToBeRemoved(behTrigger : BehaviorTransition, behTarget : BehaviorTransition) {
+ find incomingTriggers(depElement, behTrigger, behTarget);
+ find hostToBeRemoved(depElement, _);
+} or {
+ find incomingTriggers(depElement, behTrigger, behTarget);
+ find missingAppInstance(depElement, _);
+} or {
+ find incomingTriggers(depElement, behTrigger, behTarget);
+ find missingAppInstanceToBeRemoved(_, depElement, _);
+} or {
+ find incomingTriggers(depElement, behTrigger, behTarget);
+ find stateMachineToBeDeleted(depElement, _);
+} \ No newline at end of file
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/xtend-gen/.gitignore b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/xtend-gen/.gitignore
new file mode 100644
index 0000000..1a5126b
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra/xtend-gen/.gitignore
@@ -0,0 +1,5 @@
+#This file is needed to prevent git from omitting this folder that would cause build issues/compile errors.
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore \ No newline at end of file
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/META-INF/MANIFEST.MF b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/META-INF/MANIFEST.MF
index 3c63822..435f89c 100644
--- a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/META-INF/MANIFEST.MF
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/META-INF/MANIFEST.MF
@@ -19,5 +19,6 @@ Require-Bundle: org.eclipse.viatra.examples.cps.traceability;bundle-version="0.1
org.eclipse.viatra.examples.cps.xform.m2m.incr.expl;bundle-version="0.1.0",
org.eclipse.viatra.examples.cps.xform.m2m.incr.qrt;bundle-version="0.1.0",
org.eclipse.viatra.examples.cps.xform.m2m.incr.viatra;bundle-version="0.1.0",
+ org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra;bundle-version="0.0.1",
org.eclipse.viatra.query.runtime
Automatic-Module-Name: org.eclipse.viatra.examples.cps.xform.m2m.launcher
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/IncrPureGraTra.xtend b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/IncrPureGraTra.xtend
new file mode 100644
index 0000000..146dc01
--- /dev/null
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/IncrPureGraTra.xtend
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2014-2019 Geza Kulcsar, Akos Horvath, Abel Hegedus, Tamas Borbas, Marton Bur, Zoltan Ujhelyi, Robert Doczi, Daniel Segesdi, Peter Lunk, IncQuery Labs Ltd.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-v20.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+package org.eclipse.viatra.examples.cps.xform.m2m.launcher
+
+import org.eclipse.viatra.examples.cps.traceability.CPSToDeployment
+import org.eclipse.viatra.query.runtime.api.AdvancedViatraQueryEngine
+import org.eclipse.viatra.query.runtime.emf.EMFScope
+import org.eclipse.viatra.examples.cps.xform.m2m.incr.puregratra.queries.CPS2DeploymentIncrPureGraTra
+import org.eclipse.viatra.query.runtime.base.api.BaseIndexOptions
+
+class IncrPureGraTra extends CPSViatraTransformationWrapper {
+
+ CPS2DeploymentIncrPureGraTra xform
+ AdvancedViatraQueryEngine engine
+
+ override initializeDebuggableTransformation(CPSToDeployment cps2dep, boolean isDebuggable, String debugName) {
+ val options = new BaseIndexOptions().withDanglingFreeAssumption(false)
+ engine = AdvancedViatraQueryEngine.createUnmanagedEngine(new EMFScope(cps2dep.eResource.resourceSet, options));
+ xform = new CPS2DeploymentIncrPureGraTra(cps2dep, engine, isDebuggable, debugName)
+ }
+
+ override executeTransformation() {
+ xform.execute
+ }
+
+ override cleanupTransformation() {
+ if(xform !== null){
+ xform.dispose
+ }
+ if(engine !== null){
+ engine.dispose
+ }
+ xform = null
+ engine = null
+ }
+
+ override isIncremental() {
+ false
+ }
+
+
+} \ No newline at end of file
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java
index aaa3ede..21ab758 100644
--- a/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.launcher/src/org/eclipse/viatra/examples/cps/xform/m2m/launcher/TransformationType.java
@@ -87,6 +87,10 @@ public enum TransformationType {
public boolean isDebuggable() {
return true;
}
+
+ },
+ INCR_VIATRA_PUREGRATRA {
+ public CPSTransformationWrapper getWrapper() {return new IncrPureGraTra();}
};
private final class EndOfTransformationCostFunction extends StatisticsBasedConstraintCostFunction {

Back to the top