X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=tests%2Forg.simantics.scl.compiler.tests%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FTransformation1.scl;fp=tests%2Forg.simantics.scl.compiler.tests%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FTransformation1.scl;h=144b03155b913d85490c135810426bd5bd88233d;hb=0364f8f54b009e9e5de482d5c9d1cb7efb023141;hp=0000000000000000000000000000000000000000;hpb=7ecf07ff9aacab300f1fb900f1f0f97beb1be139;p=simantics%2Fplatform.git 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 index 000000000..144b03155 --- /dev/null +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Transformation1.scl @@ -0,0 +1,59 @@ +import "StandardLibrary" +import "Minigraph" +import "MMap" as MMap + +consistsOf :: Integer +consistsOf = resource "consistsOf" +instanceOf :: Integer +instanceOf = resource "instanceOf" +areConnected :: Integer +areConnected = resource "areConnected" +from :: Integer +from = resource "from" +to :: Integer +to = resource "to" + +element :: Integer +element = resource "Element" +connection :: 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 :: () +foo = transformation OneShotForward where + MapDiagrams 0 0 + +main = withGraph do + foo + "OK" +-- +OK