]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Transformation1.scl
Automatic execution of SCL tests in Maven
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / Transformation1.scl
diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Transformation1.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Transformation1.scl
new file mode 100644 (file)
index 0000000..144b031
--- /dev/null
@@ -0,0 +1,59 @@
+import "StandardLibrary"
+import "Minigraph"
+import "MMap" as MMap
+
+consistsOf :: <Graph> Integer
+consistsOf = resource "consistsOf"
+instanceOf :: <Graph> Integer
+instanceOf = resource "instanceOf"
+areConnected :: <Graph> Integer
+areConnected = resource "areConnected"
+from :: <Graph> Integer
+from = resource "from"
+to :: <Graph> Integer
+to = resource "to"
+
+element :: <Graph> Integer
+element = resource "Element"
+connection :: <Graph> Integer
+connection = resource "Connection"
+
+mapping relation MapDiagrams Integer Integer
+
+rule ElementsRule where
+    @when
+    MapDiagrams ?dA ?dB
+    
+    @from
+    Statement ?dA consistsOf ?elA
+    Statement ?elA instanceOf element
+    
+    @to
+    Statement ?dB consistsOf ?elB
+    Statement ?elB instanceOf element
+    
+    @where
+    MapElements ?elA ?elB
+
+rule ConnectionsRule where
+    @when
+    MapElements ?elA1 ?elB1
+    MapElements ?elA2 ?elB2
+    
+    @from
+    Statement ?elA1 areConnected ?elA2
+    
+    @to
+    Statement ?conn instanceOf connection
+    Statement ?conn from ?elB1
+    Statement ?conn to   ?elB2
+
+foo :: <Graph,Proc> ()
+foo = transformation OneShotForward where
+    MapDiagrams 0 0
+
+main = withGraph do
+    foo
+    "OK"
+--
+OK