From a993b72eb3e038897767c79d054467a6986d2085 Mon Sep 17 00:00:00 2001 From: OszkarSemerath Date: Mon, 14 May 2018 12:55:47 +0200 Subject: Moved partial model management is moved to one project (+1 PM edge fix) --- .../META-INF/MANIFEST.MF | 12 +- .../Partial2logicannotationsFactory.java | 42 ++ .../Partial2logicannotationsPackage.java | 199 +++++++ .../PartialModelRelation2Assertion.java | 72 +++ .../impl/Partial2logicannotationsFactoryImpl.java | 95 +++ .../impl/Partial2logicannotationsPackageImpl.java | 205 +++++++ .../impl/PartialModelRelation2AssertionImpl.java | 216 +++++++ .../Partial2logicannotationsAdapterFactory.java | 159 +++++ .../util/Partial2logicannotationsSwitch.java | 145 +++++ .../model/PartialModelAnnotations.aird | 658 +++++++++++++++++++++ .../model/PartialModelAnnotations.ecore | 11 + .../model/PartialModelAnnotations.genmodel | 16 + .../plugin.xml | 8 + .../InstanceModel2Logic.xtend | 22 + .../InstanceModel2PartialInterpretation.xtend | 144 +++++ .../PartialInterpretation2Logic.xtend | 172 ++++++ .../PartialInterpretationInitialiser.xtend | 7 + 17 files changed, 2180 insertions(+), 3 deletions(-) create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/Partial2logicannotationsFactory.java create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/Partial2logicannotationsPackage.java create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/PartialModelRelation2Assertion.java create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/Partial2logicannotationsFactoryImpl.java create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/Partial2logicannotationsPackageImpl.java create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/PartialModelRelation2AssertionImpl.java create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/util/Partial2logicannotationsAdapterFactory.java create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/util/Partial2logicannotationsSwitch.java create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.aird create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.ecore create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.genmodel create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2Logic.xtend create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend create mode 100644 Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/PartialInterpretation2Logic.xtend (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage') diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/META-INF/MANIFEST.MF b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/META-INF/MANIFEST.MF index 91960c3a..83c90829 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/META-INF/MANIFEST.MF +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/META-INF/MANIFEST.MF @@ -7,22 +7,28 @@ Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage, +Export-Package: hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic, + hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage, hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood, hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation, hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl, hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.util, hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder, - hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation + hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation, + hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations, + hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl, + hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.util Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, hu.bme.mit.inf.dslreasoner.logic.model;bundle-version="1.0.0";visibility:=reexport, + hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage;visibility:=reexport, com.google.guava, org.eclipse.xtext.xbase.lib, org.eclipse.xtend.lib, org.eclipse.xtend.lib.macro, org.eclipse.viatra.query.runtime;bundle-version="1.5.0", - org.eclipse.viatra.dse;bundle-version="0.15.0" + org.eclipse.viatra.dse;bundle-version="0.15.0", + hu.bme.mit.inf.dslreasoner.ecore2logic;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/Partial2logicannotationsFactory.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/Partial2logicannotationsFactory.java new file mode 100644 index 00000000..7d53f823 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/Partial2logicannotationsFactory.java @@ -0,0 +1,42 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage + * @generated + */ +public interface Partial2logicannotationsFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + Partial2logicannotationsFactory eINSTANCE = hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.Partial2logicannotationsFactoryImpl.init(); + + /** + * Returns a new object of class 'Partial Model Relation2 Assertion'. + * + * + * @return a new object of class 'Partial Model Relation2 Assertion'. + * @generated + */ + PartialModelRelation2Assertion createPartialModelRelation2Assertion(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + Partial2logicannotationsPackage getPartial2logicannotationsPackage(); + +} //Partial2logicannotationsFactory diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/Partial2logicannotationsPackage.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/Partial2logicannotationsPackage.java new file mode 100644 index 00000000..25438ba2 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/Partial2logicannotationsPackage.java @@ -0,0 +1,199 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations; + +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + * + * + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsFactory + * @model kind="package" + * @generated + */ +public interface Partial2logicannotationsPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "partial2logicannotations"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://www.bme.hu/mit/inf/dslreasoner/logic/model/language/partial2logicannotation"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "partial2logicannotations"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + Partial2logicannotationsPackage eINSTANCE = hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.Partial2logicannotationsPackageImpl.init(); + + /** + * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.PartialModelRelation2AssertionImpl Partial Model Relation2 Assertion}' class. + * + * + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.PartialModelRelation2AssertionImpl + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.Partial2logicannotationsPackageImpl#getPartialModelRelation2Assertion() + * @generated + */ + int PARTIAL_MODEL_RELATION2_ASSERTION = 0; + + /** + * The feature id for the 'Target' reference. + * + * + * @generated + * @ordered + */ + int PARTIAL_MODEL_RELATION2_ASSERTION__TARGET = LogicproblemPackage.ASSERTION_ANNOTATION__TARGET; + + /** + * The feature id for the 'Links' containment reference list. + * + * + * @generated + * @ordered + */ + int PARTIAL_MODEL_RELATION2_ASSERTION__LINKS = LogicproblemPackage.ASSERTION_ANNOTATION_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Target Relation' reference. + * + * + * @generated + * @ordered + */ + int PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION = LogicproblemPackage.ASSERTION_ANNOTATION_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'Partial Model Relation2 Assertion' class. + * + * + * @generated + * @ordered + */ + int PARTIAL_MODEL_RELATION2_ASSERTION_FEATURE_COUNT = LogicproblemPackage.ASSERTION_ANNOTATION_FEATURE_COUNT + 2; + + /** + * The number of operations of the 'Partial Model Relation2 Assertion' class. + * + * + * @generated + * @ordered + */ + int PARTIAL_MODEL_RELATION2_ASSERTION_OPERATION_COUNT = LogicproblemPackage.ASSERTION_ANNOTATION_OPERATION_COUNT + 0; + + + /** + * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion Partial Model Relation2 Assertion}'. + * + * + * @return the meta object for class 'Partial Model Relation2 Assertion'. + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion + * @generated + */ + EClass getPartialModelRelation2Assertion(); + + /** + * Returns the meta object for the containment reference list '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion#getLinks Links}'. + * + * + * @return the meta object for the containment reference list 'Links'. + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion#getLinks() + * @see #getPartialModelRelation2Assertion() + * @generated + */ + EReference getPartialModelRelation2Assertion_Links(); + + /** + * Returns the meta object for the reference '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion#getTargetRelation Target Relation}'. + * + * + * @return the meta object for the reference 'Target Relation'. + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion#getTargetRelation() + * @see #getPartialModelRelation2Assertion() + * @generated + */ + EReference getPartialModelRelation2Assertion_TargetRelation(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + Partial2logicannotationsFactory getPartial2logicannotationsFactory(); + + /** + * + * Defines literals for the meta objects that represent + * + * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.PartialModelRelation2AssertionImpl Partial Model Relation2 Assertion}' class. + * + * + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.PartialModelRelation2AssertionImpl + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.Partial2logicannotationsPackageImpl#getPartialModelRelation2Assertion() + * @generated + */ + EClass PARTIAL_MODEL_RELATION2_ASSERTION = eINSTANCE.getPartialModelRelation2Assertion(); + + /** + * The meta object literal for the 'Links' containment reference list feature. + * + * + * @generated + */ + EReference PARTIAL_MODEL_RELATION2_ASSERTION__LINKS = eINSTANCE.getPartialModelRelation2Assertion_Links(); + + /** + * The meta object literal for the 'Target Relation' reference feature. + * + * + * @generated + */ + EReference PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION = eINSTANCE.getPartialModelRelation2Assertion_TargetRelation(); + + } + +} //Partial2logicannotationsPackage diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/PartialModelRelation2Assertion.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/PartialModelRelation2Assertion.java new file mode 100644 index 00000000..3c7f1a38 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/PartialModelRelation2Assertion.java @@ -0,0 +1,72 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations; + +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration; +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.AssertionAnnotation; + +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'Partial Model Relation2 Assertion'. + * + * + *

+ * The following features are supported: + *

+ * + * + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage#getPartialModelRelation2Assertion() + * @model + * @generated + */ +public interface PartialModelRelation2Assertion extends AssertionAnnotation { + /** + * Returns the value of the 'Links' containment reference list. + * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink}. + * + *

+ * If the meaning of the 'Links' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Links' containment reference list. + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage#getPartialModelRelation2Assertion_Links() + * @model containment="true" + * @generated + */ + EList getLinks(); + + /** + * Returns the value of the 'Target Relation' reference. + * + *

+ * If the meaning of the 'Target Relation' reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Target Relation' reference. + * @see #setTargetRelation(RelationDeclaration) + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage#getPartialModelRelation2Assertion_TargetRelation() + * @model required="true" + * @generated + */ + RelationDeclaration getTargetRelation(); + + /** + * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion#getTargetRelation Target Relation}' reference. + * + * + * @param value the new value of the 'Target Relation' reference. + * @see #getTargetRelation() + * @generated + */ + void setTargetRelation(RelationDeclaration value); + +} // PartialModelRelation2Assertion diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/Partial2logicannotationsFactoryImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/Partial2logicannotationsFactoryImpl.java new file mode 100644 index 00000000..a9906e70 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/Partial2logicannotationsFactoryImpl.java @@ -0,0 +1,95 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl; + +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.*; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class Partial2logicannotationsFactoryImpl extends EFactoryImpl implements Partial2logicannotationsFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static Partial2logicannotationsFactory init() { + try { + Partial2logicannotationsFactory thePartial2logicannotationsFactory = (Partial2logicannotationsFactory)EPackage.Registry.INSTANCE.getEFactory(Partial2logicannotationsPackage.eNS_URI); + if (thePartial2logicannotationsFactory != null) { + return thePartial2logicannotationsFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new Partial2logicannotationsFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public Partial2logicannotationsFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION: return createPartialModelRelation2Assertion(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public PartialModelRelation2Assertion createPartialModelRelation2Assertion() { + PartialModelRelation2AssertionImpl partialModelRelation2Assertion = new PartialModelRelation2AssertionImpl(); + return partialModelRelation2Assertion; + } + + /** + * + * + * @generated + */ + public Partial2logicannotationsPackage getPartial2logicannotationsPackage() { + return (Partial2logicannotationsPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static Partial2logicannotationsPackage getPackage() { + return Partial2logicannotationsPackage.eINSTANCE; + } + +} //Partial2logicannotationsFactoryImpl diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/Partial2logicannotationsPackageImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/Partial2logicannotationsPackageImpl.java new file mode 100644 index 00000000..f83498cd --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/Partial2logicannotationsPackageImpl.java @@ -0,0 +1,205 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl; + +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage; + +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage; + +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsFactory; +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage; +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion; + +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class Partial2logicannotationsPackageImpl extends EPackageImpl implements Partial2logicannotationsPackage { + /** + * + * + * @generated + */ + private EClass partialModelRelation2AssertionEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage#eNS_URI + * @see #init() + * @generated + */ + private Partial2logicannotationsPackageImpl() { + super(eNS_URI, Partial2logicannotationsFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link Partial2logicannotationsPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static Partial2logicannotationsPackage init() { + if (isInited) return (Partial2logicannotationsPackage)EPackage.Registry.INSTANCE.getEPackage(Partial2logicannotationsPackage.eNS_URI); + + // Obtain or create and register package + Partial2logicannotationsPackageImpl thePartial2logicannotationsPackage = (Partial2logicannotationsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Partial2logicannotationsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new Partial2logicannotationsPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + LogiclanguagePackage.eINSTANCE.eClass(); + LogicproblemPackage.eINSTANCE.eClass(); + PartialinterpretationPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + thePartial2logicannotationsPackage.createPackageContents(); + + // Initialize created meta-data + thePartial2logicannotationsPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + thePartial2logicannotationsPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(Partial2logicannotationsPackage.eNS_URI, thePartial2logicannotationsPackage); + return thePartial2logicannotationsPackage; + } + + /** + * + * + * @generated + */ + public EClass getPartialModelRelation2Assertion() { + return partialModelRelation2AssertionEClass; + } + + /** + * + * + * @generated + */ + public EReference getPartialModelRelation2Assertion_Links() { + return (EReference)partialModelRelation2AssertionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getPartialModelRelation2Assertion_TargetRelation() { + return (EReference)partialModelRelation2AssertionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public Partial2logicannotationsFactory getPartial2logicannotationsFactory() { + return (Partial2logicannotationsFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + partialModelRelation2AssertionEClass = createEClass(PARTIAL_MODEL_RELATION2_ASSERTION); + createEReference(partialModelRelation2AssertionEClass, PARTIAL_MODEL_RELATION2_ASSERTION__LINKS); + createEReference(partialModelRelation2AssertionEClass, PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + LogicproblemPackage theLogicproblemPackage = (LogicproblemPackage)EPackage.Registry.INSTANCE.getEPackage(LogicproblemPackage.eNS_URI); + PartialinterpretationPackage thePartialinterpretationPackage = (PartialinterpretationPackage)EPackage.Registry.INSTANCE.getEPackage(PartialinterpretationPackage.eNS_URI); + LogiclanguagePackage theLogiclanguagePackage = (LogiclanguagePackage)EPackage.Registry.INSTANCE.getEPackage(LogiclanguagePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + partialModelRelation2AssertionEClass.getESuperTypes().add(theLogicproblemPackage.getAssertionAnnotation()); + + // Initialize classes, features, and operations; add parameters + initEClass(partialModelRelation2AssertionEClass, PartialModelRelation2Assertion.class, "PartialModelRelation2Assertion", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPartialModelRelation2Assertion_Links(), thePartialinterpretationPackage.getRelationLink(), null, "links", null, 0, -1, PartialModelRelation2Assertion.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getPartialModelRelation2Assertion_TargetRelation(), theLogiclanguagePackage.getRelationDeclaration(), null, "targetRelation", null, 1, 1, PartialModelRelation2Assertion.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //Partial2logicannotationsPackageImpl diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/PartialModelRelation2AssertionImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/PartialModelRelation2AssertionImpl.java new file mode 100644 index 00000000..92011d1c --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/impl/PartialModelRelation2AssertionImpl.java @@ -0,0 +1,216 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl; + +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration; +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.impl.AssertionAnnotationImpl; + +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage; +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion; + +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Partial Model Relation2 Assertion'. + * + *

+ * The following features are implemented: + *

+ * + * + * @generated + */ +public class PartialModelRelation2AssertionImpl extends AssertionAnnotationImpl implements PartialModelRelation2Assertion { + /** + * The cached value of the '{@link #getLinks() Links}' containment reference list. + * + * + * @see #getLinks() + * @generated + * @ordered + */ + protected EList links; + + /** + * The cached value of the '{@link #getTargetRelation() Target Relation}' reference. + * + * + * @see #getTargetRelation() + * @generated + * @ordered + */ + protected RelationDeclaration targetRelation; + + /** + * + * + * @generated + */ + protected PartialModelRelation2AssertionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return Partial2logicannotationsPackage.Literals.PARTIAL_MODEL_RELATION2_ASSERTION; + } + + /** + * + * + * @generated + */ + public EList getLinks() { + if (links == null) { + links = new EObjectContainmentEList(RelationLink.class, this, Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS); + } + return links; + } + + /** + * + * + * @generated + */ + public RelationDeclaration getTargetRelation() { + if (targetRelation != null && targetRelation.eIsProxy()) { + InternalEObject oldTargetRelation = (InternalEObject)targetRelation; + targetRelation = (RelationDeclaration)eResolveProxy(oldTargetRelation); + if (targetRelation != oldTargetRelation) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION, oldTargetRelation, targetRelation)); + } + } + return targetRelation; + } + + /** + * + * + * @generated + */ + public RelationDeclaration basicGetTargetRelation() { + return targetRelation; + } + + /** + * + * + * @generated + */ + public void setTargetRelation(RelationDeclaration newTargetRelation) { + RelationDeclaration oldTargetRelation = targetRelation; + targetRelation = newTargetRelation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION, oldTargetRelation, targetRelation)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS: + return ((InternalEList)getLinks()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS: + return getLinks(); + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION: + if (resolve) return getTargetRelation(); + return basicGetTargetRelation(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS: + getLinks().clear(); + getLinks().addAll((Collection)newValue); + return; + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION: + setTargetRelation((RelationDeclaration)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS: + getLinks().clear(); + return; + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION: + setTargetRelation((RelationDeclaration)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS: + return links != null && !links.isEmpty(); + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION: + return targetRelation != null; + } + return super.eIsSet(featureID); + } + +} //PartialModelRelation2AssertionImpl diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/util/Partial2logicannotationsAdapterFactory.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/util/Partial2logicannotationsAdapterFactory.java new file mode 100644 index 00000000..2777a18d --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/util/Partial2logicannotationsAdapterFactory.java @@ -0,0 +1,159 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.util; + +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.Annotation; +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.AssertionAnnotation; + +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.*; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage + * @generated + */ +public class Partial2logicannotationsAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static Partial2logicannotationsPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public Partial2logicannotationsAdapterFactory() { + if (modelPackage == null) { + modelPackage = Partial2logicannotationsPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected Partial2logicannotationsSwitch modelSwitch = + new Partial2logicannotationsSwitch() { + @Override + public Adapter casePartialModelRelation2Assertion(PartialModelRelation2Assertion object) { + return createPartialModelRelation2AssertionAdapter(); + } + @Override + public Adapter caseAnnotation(Annotation object) { + return createAnnotationAdapter(); + } + @Override + public Adapter caseAssertionAnnotation(AssertionAnnotation object) { + return createAssertionAnnotationAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion Partial Model Relation2 Assertion}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion + * @generated + */ + public Adapter createPartialModelRelation2AssertionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.Annotation Annotation}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.Annotation + * @generated + */ + public Adapter createAnnotationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.AssertionAnnotation Assertion Annotation}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.AssertionAnnotation + * @generated + */ + public Adapter createAssertionAnnotationAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //Partial2logicannotationsAdapterFactory diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/util/Partial2logicannotationsSwitch.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/util/Partial2logicannotationsSwitch.java new file mode 100644 index 00000000..f2a194e9 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partial2logicannotations/util/Partial2logicannotationsSwitch.java @@ -0,0 +1,145 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.util; + +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.Annotation; +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.AssertionAnnotation; + +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.*; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage + * @generated + */ +public class Partial2logicannotationsSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static Partial2logicannotationsPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public Partial2logicannotationsSwitch() { + if (modelPackage == null) { + modelPackage = Partial2logicannotationsPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @param ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION: { + PartialModelRelation2Assertion partialModelRelation2Assertion = (PartialModelRelation2Assertion)theEObject; + T result = casePartialModelRelation2Assertion(partialModelRelation2Assertion); + if (result == null) result = caseAssertionAnnotation(partialModelRelation2Assertion); + if (result == null) result = caseAnnotation(partialModelRelation2Assertion); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Partial Model Relation2 Assertion'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Partial Model Relation2 Assertion'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePartialModelRelation2Assertion(PartialModelRelation2Assertion object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Annotation'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Annotation'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAnnotation(Annotation object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Assertion Annotation'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Assertion Annotation'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAssertionAnnotation(AssertionAnnotation object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //Partial2logicannotationsSwitch diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.aird b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.aird new file mode 100644 index 00000000..d5d1094d --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.aird @@ -0,0 +1,658 @@ + + + + PartialModelAnnotations.ecore + platform:/resource/hu.bme.mit.inf.dslreasoner.logic.model/model/logicproblem.ecore + platform:/resource/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore + http://www.eclipse.org/emf/2002/Ecore + PartialInterpretation.ecore + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + bold + + + + + + + + + bold + + + + + + + bold + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + italic + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + italic + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + + + + + + + italic + + + + + + + + + + + + + + + italic + + + + + + + + + + + + + + + italic + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + + + labelSize + bold + + + labelSize + + + + + + + + + + labelSize + bold + + + labelSize + + + + + + + + + + labelSize + bold + + + labelSize + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + bold + + + + + + + + bold + + + + + + + + + + + bold + + + bold + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + + + + + + + + italic + + + + + + + + + italic + + + + + + + + + + + bold + + + + + + + + + + + + + + diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.ecore b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.ecore new file mode 100644 index 00000000..3a1c20d1 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.ecore @@ -0,0 +1,11 @@ + + + + + + + diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.genmodel b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.genmodel new file mode 100644 index 00000000..0fd889d2 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialModelAnnotations.genmodel @@ -0,0 +1,16 @@ + + + PartialModelAnnotations.ecore + + + + + + diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/plugin.xml b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/plugin.xml index b9248505..37f467c9 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/plugin.xml +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/plugin.xml @@ -14,4 +14,12 @@ genModel="model/PartialInterpretation.genmodel"/> + + + + + diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2Logic.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2Logic.xtend new file mode 100644 index 00000000..d2b59754 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2Logic.xtend @@ -0,0 +1,22 @@ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic + +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace +import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem +import java.util.List +import org.eclipse.emf.ecore.EObject +import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes + +class InstanceModel2Logic { + val InstanceModel2PartialInterpretation instanceModel2PartialInterpretation = new InstanceModel2PartialInterpretation + val PartialInterpretation2Logic partialInterpretation2Logic = new PartialInterpretation2Logic + + public def transform( + TracedOutput metamodelTranslationResult, + List objects) + { + val res1 = instanceModel2PartialInterpretation.transform(metamodelTranslationResult,objects,true) + this.partialInterpretation2Logic.transformPartialIntepretation2Logic(metamodelTranslationResult.output,res1) + return metamodelTranslationResult//.output + } +} \ No newline at end of file diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend new file mode 100644 index 00000000..9a737ab9 --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend @@ -0,0 +1,144 @@ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic + +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic +import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace +import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput +import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguageFactory +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDeclaration +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.PartialInterpretationInitialiser +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Problem2PartialInterpretationTrace +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory +import java.util.HashMap +import java.util.List +import java.util.Map +import org.eclipse.emf.common.util.Enumerator +import org.eclipse.emf.ecore.EObject +import org.eclipse.emf.ecore.resource.Resource + +import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* + +class InstanceModel2PartialInterpretation { + val extension LogiclanguageFactory factory = LogiclanguageFactory.eINSTANCE + val extension PartialinterpretationFactory factory2 = PartialinterpretationFactory.eINSTANCE + val Ecore2Logic ecore2Logic = new Ecore2Logic + val partialInterpretationInitialiser = new PartialInterpretationInitialiser + + public def transform( + TracedOutput metamodelTranslationResult, + Resource resource, + boolean withID) + { + val objects = resource.allContents.toList + return transform(metamodelTranslationResult,objects,withID) + } + + public def transform( + TracedOutput metamodelTranslationResult, + List objects, + boolean withID) + { + val problem = metamodelTranslationResult.output + val ecore2LogicTrace = metamodelTranslationResult.trace + val tracedOutput = partialInterpretationInitialiser.initialisePartialInterpretation(problem, new TypeScopes) + val partialInterpretation = tracedOutput.output + val partialInterpretationTrace = tracedOutput.trace + + val Map object2DefinedElement = new HashMap + + // EObject -> DefinedElement + for(objectIndex : 0.. [ + it.name = if(withID) + { '''PartialObject«objectIndex»''' } else + { null } + ] + + // Add element to interpretation + partialInterpretation.newElements += element + + // Define the types + val type = ecore2Logic.TypeofEClass(ecore2LogicTrace,object.eClass) as TypeDeclaration + val interpretation = type.lookup(partialInterpretationTrace.type2Interpretation) + interpretation.elements += element + interpretation.supertypeInterpretation.forEach[elements += element] + + // Trace handling + object2DefinedElement.put(object, element) + } + + val referencesUsed = ecore2Logic.allReferencesInScope(ecore2LogicTrace).toSet + val attributesUsed = ecore2Logic.allAttributesInScope(ecore2LogicTrace).toSet + for(source : objects) { + // Translating the references + for(reference : source.eClass.EAllReferences.filter[ + referencesUsed.contains(it) && !it.derived]) + { + val type = ecore2Logic.relationOfReference(ecore2LogicTrace,reference) + val interpretation = type.lookup(partialInterpretationTrace.relation2Interpretation) + val sourceElement = source.lookup(object2DefinedElement) + if(reference.isMany) { + val listOfTargets = source.eGet(reference) as List + for(target : listOfTargets) { + if(target !== null && object2DefinedElement.containsKey(target)) { + val targetElement = target.lookup(object2DefinedElement) + translateLink(interpretation,sourceElement,targetElement) + } + } + } else { + val target = source.eGet(reference) as EObject + if(target !== null && object2DefinedElement.containsKey(target)) { + val targetElement = target.lookup(object2DefinedElement) + translateLink(interpretation,sourceElement,targetElement) + } + } + } + + // Transforming the attributes + for(attribute : source.eClass.EAllAttributes.filter[attributesUsed.contains(it) && !it.derived]) { + val type = ecore2Logic.relationOfAttribute(ecore2LogicTrace,attribute) + val interpretation = type.lookup(partialInterpretationTrace.relation2Interpretation) + val sourceElement = source.lookup(object2DefinedElement) + if(attribute.isMany) { + val listOfTargets = source.eGet(attribute) as List + for(target : listOfTargets) { + val value = translateValue(target,ecore2LogicTrace,partialInterpretationTrace) + if(value !== null) { + translateLink(interpretation,sourceElement,value) + } + } + } else { + val target = source.eGet(attribute) + if(target !== null) { + val value = translateValue(target,ecore2LogicTrace,partialInterpretationTrace) + if(value !== null) { + translateLink(interpretation,sourceElement,value) + } + } + } + } + } + + return partialInterpretation + } + + protected def translateLink(PartialRelationInterpretation interpretation, DefinedElement source, DefinedElement target) { + interpretation.relationlinks += createBinaryElementRelationLink => [it.param1 = source it.param2 = target] + } + + dispatch protected def translateValue(Enumerator value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { + val term = this.ecore2Logic.Literal(ecore2LogicTrace,value) + if(term instanceof DefinedElement) { + return term + } + else throw new AssertionError('''term should be a defined element?''') + } + + dispatch protected def translateValue(Object value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { + //throw new UnsupportedOperationException('''Mapping of «value.class.simpleName» in partial models is currently not supported!''') + } +} \ No newline at end of file diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/PartialInterpretation2Logic.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/PartialInterpretation2Logic.xtend new file mode 100644 index 00000000..3a85536b --- /dev/null +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/PartialInterpretation2Logic.xtend @@ -0,0 +1,172 @@ +package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic + +import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguageFactory +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.SymbolicDeclaration +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDeclaration +import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDefinition +import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsFactory +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.BinaryElementRelationLink +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialTypeInterpratation +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink +import java.util.ArrayList +import java.util.HashMap +import java.util.HashSet +import java.util.Map +import java.util.Set +import org.eclipse.emf.ecore.util.EcoreUtil +import org.eclipse.xtend.lib.annotations.Data + +import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* + +@Data class PartialInterpretation2Logic_Trace { + Map new2Old = new HashMap + + Map definedPart = new HashMap + Map undefinedPart = new HashMap + Set originalTypes = new HashSet + Set splittedTypes = new HashSet +} + +class PartialInterpretation2Logic { + val extension LogiclanguageFactory factory = LogiclanguageFactory.eINSTANCE + val extension LogicProblemBuilder builder = new LogicProblemBuilder + + def transformPartialIntepretation2Logic(LogicProblem p, PartialInterpretation i) { + val trace = new PartialInterpretation2Logic_Trace() + trace.originalTypes.addAll(p.types) + if(! i.newElements.empty) { + + // Elements adding + addExistingElementToProblem(p,i,trace) + + // Types + for(partialTypeDeclaration : i.partialtypeinterpratation) { + splitTypeIntoTwo(p,partialTypeDeclaration,trace) + } + connectSplittings(p,trace) + + // Relations + for(partialRelationInterpretation : i.partialrelationinterpretation) { + //println(partialRelationInterpretation.interpretationOf.name) + relationLinksToAssertion(p,partialRelationInterpretation,trace) + } + } + } + + private def addExistingElementToProblem(LogicProblem p, PartialInterpretation i,PartialInterpretation2Logic_Trace trace) { +// val newElements = new ArrayList(i.newElements) +// var newElementIndex = 1 +// for(newElement : newElements) { +// newElement.name = '''o «newElementIndex++»''' +// p.elements += newElement +// } + p.elements += i.newElements + } + + private def splitTypeIntoTwo(LogicProblem p, PartialTypeInterpratation partialTypeDeclaration,PartialInterpretation2Logic_Trace trace) { + if(!partialTypeDeclaration.elements.empty) { + val declaration = partialTypeDeclaration.interpretationOf + + val definedPart = createTypeDefinition => [ + it.name = '''«declaration.name» DefinedPart''' + it.elements += partialTypeDeclaration.elements + it.isAbstract = declaration.isIsAbstract + ] + val undefinedPart = createTypeDeclaration => [ + it.name = '''«declaration.name» UndefinedPart''' + it.isAbstract = declaration.isIsAbstract + ] + declaration.isAbstract = true + + trace.definedPart.put(declaration,definedPart) + trace.undefinedPart.put(declaration,undefinedPart) + trace.splittedTypes.add(declaration) + p.add(definedPart) + p.add(undefinedPart) + Supertype(definedPart,declaration) + Supertype(undefinedPart,declaration) + + for(containment : p.containmentHierarchies) { + if(containment.typesOrderedInHierarchy.contains(declaration)) { + containment.typesOrderedInHierarchy += definedPart + containment.typesOrderedInHierarchy += undefinedPart + } + } + } + } + + private def connectSplittings(LogicProblem p,PartialInterpretation2Logic_Trace trace) { + val originalTypes = p.types.filter[originalType(trace)].toList + for(type : originalTypes) { + val superTypes = new ArrayList(type.supertypes.filter[originalType(trace)].toList) + for(supertype : superTypes) { + if(type.isSplitted(trace)) { + if(supertype.isSplitted(trace)) { + Supertype((type as TypeDeclaration).lookup(trace.definedPart), (supertype as TypeDeclaration).lookup(trace.definedPart)) + Supertype((type as TypeDeclaration).lookup(trace.undefinedPart), (supertype as TypeDeclaration).lookup(trace.undefinedPart)) + } else { + // Do nothing + } + } else { + if(supertype.isSplitted(trace)) { + Supertype(type, (supertype as TypeDeclaration).lookup(trace.undefinedPart)) + } else if(supertype instanceof TypeDefinition) { + // Do nothing + } + } + } + } + } + + private def originalType(Type type,PartialInterpretation2Logic_Trace trace) { + return trace.originalTypes.contains(type) + } + private def isSplitted(Type t, PartialInterpretation2Logic_Trace trace) { + trace.splittedTypes.contains(t) + } + + private def relationLinksToAssertion(LogicProblem p, PartialRelationInterpretation r,PartialInterpretation2Logic_Trace trace) { + val relation = r.interpretationOf + val links = r.relationlinks + if(links.size == 0) { + // No assertion for empty relations + return + } else { + val term = if(links.size == 1) { + createLink(links.head,relation) + } else { + links.map[link|createLink(link,relation)].And + } + val assertion = Assertion('''PartialInterpretation «r.interpretationOf.name»''',term) + val ^annotation= Partial2logicannotationsFactory.eINSTANCE.createPartialModelRelation2Assertion + ^annotation.target = assertion + ^annotation.targetRelation = relation + ^annotation.links += links.map[EcoreUtil.copy(it)] + //val error= assertion.eAllContents.toIterable.filter(SymbolicValue).filter[it.symbolicReference === null] + //error.forEach[println("error")] + p.add(assertion) + p.annotations+= ^annotation + } + + } + + def private createLink(RelationLink link, SymbolicDeclaration relationDeclaration) { + if(link instanceof BinaryElementRelationLink) { + if((link.param1 !== null) && (link.param2 !== null)) { + return createSymbolicValue=>[ + it.symbolicReference=relationDeclaration + it.parameterSubstitutions += createSymbolicValue => [it.symbolicReference = link.param1] + it.parameterSubstitutions += createSymbolicValue => [it.symbolicReference = link.param2] + ] + } else { + throw new IllegalArgumentException + } + } else throw new UnsupportedOperationException + } +} \ No newline at end of file diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend index 45fd2c6d..ad9d882b 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend @@ -27,6 +27,8 @@ import org.eclipse.viatra.query.runtime.emf.EMFScope import org.eclipse.xtend.lib.annotations.Data import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* +import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion +import org.eclipse.emf.ecore.util.EcoreUtil @Data class Problem2PartialInterpretationTrace { Map type2Interpretation = new HashMap @@ -99,6 +101,11 @@ class PartialInterpretationInitialiser { it.partialrelationinterpretation += problem.relations.filter(RelationDeclaration) .map[initialisePartialRelationInterpretation(trace)] + for(pMR2A : problem.annotations.filter(PartialModelRelation2Assertion)) { + val relation = pMR2A.targetRelation + val interpretation = relation.lookup(trace.relation2Interpretation) + interpretation.relationlinks+=pMR2A.links.map[EcoreUtil.copy(it)] + } it.partialfunctioninterpretation += problem.functions.filter(FunctionDeclaration) .map[initialisePartialFunctionInterpretation(trace)] it.partialconstantinterpretation += problem.constants.filter(ConstantDeclaration) -- cgit v1.2.3-70-g09d2