X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Ftests%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FTransformation1.scl;fp=bundles%2Forg.simantics.scl.compiler%2Ftests%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FTransformation1.scl;h=144b03155b913d85490c135810426bd5bd88233d;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Transformation1.scl b/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Transformation1.scl new file mode 100644 index 000000000..144b03155 --- /dev/null +++ b/bundles/org.simantics.scl.compiler/tests/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