From a8fe3a5c47c62d647f2dcbc3aea25f54306192a1 Mon Sep 17 00:00:00 2001 From: nmacedo Date: Wed, 19 Mar 2014 17:29:53 +0000 Subject: [PATCH] Fixed bug on atl one-to-one --- .../metamodels/uml2rdbms_simple/UML.ecore | 2 +- .../models/uml2rdbms_simple/RDB_Company.xmi | 6 +++++ .../models/uml2rdbms_simple/UML_Company.xmi | 12 ++++++---- .../echo/engine/ast/EEngineRelation.java | 23 ++++++++++++------- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/examples/pt.uminho.haslab.echo.examples/metamodels/uml2rdbms_simple/UML.ecore b/examples/pt.uminho.haslab.echo.examples/metamodels/uml2rdbms_simple/UML.ecore index e50fe8a..74fd6cb 100644 --- a/examples/pt.uminho.haslab.echo.examples/metamodels/uml2rdbms_simple/UML.ecore +++ b/examples/pt.uminho.haslab.echo.examples/metamodels/uml2rdbms_simple/UML.ecore @@ -68,7 +68,7 @@
- +
diff --git a/examples/pt.uminho.haslab.echo.examples/models/uml2rdbms_simple/RDB_Company.xmi b/examples/pt.uminho.haslab.echo.examples/models/uml2rdbms_simple/RDB_Company.xmi index ef8de4e..53e9ec7 100644 --- a/examples/pt.uminho.haslab.echo.examples/models/uml2rdbms_simple/RDB_Company.xmi +++ b/examples/pt.uminho.haslab.echo.examples/models/uml2rdbms_simple/RDB_Company.xmi @@ -16,4 +16,10 @@ + + + + diff --git a/examples/pt.uminho.haslab.echo.examples/models/uml2rdbms_simple/UML_Company.xmi b/examples/pt.uminho.haslab.echo.examples/models/uml2rdbms_simple/UML_Company.xmi index e6caf24..7f23c6f 100644 --- a/examples/pt.uminho.haslab.echo.examples/models/uml2rdbms_simple/UML_Company.xmi +++ b/examples/pt.uminho.haslab.echo.examples/models/uml2rdbms_simple/UML_Company.xmi @@ -6,16 +6,18 @@ xmlns:uml="UML" xsi:schemaLocation="UML /pt.uminho.haslab.echo.examples/metamodels/uml2rdbms_simple/UML.ecore" name="Company"> - + child="//@classes.1 //@classes.2"> + super="//@classes.0"/> + + diff --git a/plugins/pt.uminho.haslab.echo/src/pt/uminho/haslab/echo/engine/ast/EEngineRelation.java b/plugins/pt.uminho.haslab.echo/src/pt/uminho/haslab/echo/engine/ast/EEngineRelation.java index aa4dbe5..76bdbbc 100644 --- a/plugins/pt.uminho.haslab.echo/src/pt/uminho/haslab/echo/engine/ast/EEngineRelation.java +++ b/plugins/pt.uminho.haslab.echo/src/pt/uminho/haslab/echo/engine/ast/EEngineRelation.java @@ -256,6 +256,14 @@ private IFormula calculateConstraint() throws EchoError { IFormula targetFormula = translateCondition(targetdomain.getCondition()); targetFormula = targetFormula.and(postFormula); + + if (mode == Mode.TOP_TRACEABILITY) { + // targetFormula := exists targetVars : targetPred & postPred & (srcRoot,trgRoot) in field + List params = new ArrayList<>(); + for (IDecl d : rootVar2engineDecl.values()) + params.add(d.variable()); + targetFormula = targetFormula.and(transformation.callRelation(relation, context, params)); + } if (targetVar2engineDecl.size() == 1) targetFormula = targetFormula.forSome(targetVar2engineDecl.values().iterator().next()); @@ -265,6 +273,12 @@ else if (targetVar2engineDecl.size() > 1) { targetFormula = targetFormula.forSome(tempDecls[0], Arrays.copyOfRange(tempDecls, 1, tempDecls.length)); } + + if (mode == Mode.TOP_TRACEABILITY) { + // targetFormula := one rgtRoot : exists targetVars : targetPred & postPred & (srcRoot,trgRoot) in field + for (IDecl d : rootVarT2engineDecl.values()) + targetFormula = targetFormula.forOne(d); + } // sourceFormula := forall sourceVars : sourcePreds => targetFormula for (EModelDomain dom : sourcedomains) { @@ -294,14 +308,7 @@ else if (sourceVar2engineDecl.size() > 1) { } if (mode == Mode.TOP_TRACEABILITY) { - // formula := forall srcRoot : one trgRoot : formula && (srcRoot,trgRoot) in field - List params = new ArrayList<>(); - for (IDecl d : rootVar2engineDecl.values()) - params.add(d.variable()); - - formula = formula.and(transformation.callRelation(relation, context, params)); - for (IDecl d : rootVarT2engineDecl.values()) - formula = formula.forOne(d); + // formula := forall srcRoot : forall preVars : prePred => sourceFormula for (IDecl d : rootVarS2engineDecl.values()) formula = formula.forAll(d); }