]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Transformation1.scl
Re-enabled Acorn transaction cancellation support for testing
[simantics/platform.git] / bundles / org.simantics.scl.compiler / tests / org / simantics / scl / compiler / tests / scl / Transformation1.scl
1 import "StandardLibrary"
2 import "Minigraph"
3 import "MMap" as MMap
4
5 consistsOf :: <Graph> Integer
6 consistsOf = resource "consistsOf"
7 instanceOf :: <Graph> Integer
8 instanceOf = resource "instanceOf"
9 areConnected :: <Graph> Integer
10 areConnected = resource "areConnected"
11 from :: <Graph> Integer
12 from = resource "from"
13 to :: <Graph> Integer
14 to = resource "to"
15
16 element :: <Graph> Integer
17 element = resource "Element"
18 connection :: <Graph> Integer
19 connection = resource "Connection"
20
21 mapping relation MapDiagrams Integer Integer
22
23 rule ElementsRule where
24     @when
25     MapDiagrams ?dA ?dB
26     
27     @from
28     Statement ?dA consistsOf ?elA
29     Statement ?elA instanceOf element
30     
31     @to
32     Statement ?dB consistsOf ?elB
33     Statement ?elB instanceOf element
34     
35     @where
36     MapElements ?elA ?elB
37
38 rule ConnectionsRule where
39     @when
40     MapElements ?elA1 ?elB1
41     MapElements ?elA2 ?elB2
42     
43     @from
44     Statement ?elA1 areConnected ?elA2
45     
46     @to
47     Statement ?conn instanceOf connection
48     Statement ?conn from ?elB1
49     Statement ?conn to   ?elB2
50
51 foo :: <Graph,Proc> ()
52 foo = transformation OneShotForward where
53     MapDiagrams 0 0
54
55 main = withGraph do
56     foo
57     "OK"
58 --
59 OK