From 59a53fc819355fb2809b23544a5ca19ffff802fb Mon Sep 17 00:00:00 2001
From: OszkarSemerath
Date: Mon, 16 Jul 2018 18:25:34 +0200
Subject: Scope support for attributes
---
.../Partial2logicannotationsPackage.java | 32 +-----
.../PartialModelRelation2Assertion.java | 21 ----
.../impl/Partial2logicannotationsPackageImpl.java | 14 +--
.../impl/PartialModelRelation2AssertionImpl.java | 59 -----------
.../model/PartialModelAnnotations.aird | 111 +++++++++++++--------
.../model/PartialModelAnnotations.ecore | 2 -
.../InstanceModel2PartialInterpretation.xtend | 81 +++++++++++++--
.../PartialInterpretation2Logic.xtend | 22 +++-
.../PartialInterpretationInitialiser.xtend | 86 ++++++++++++++--
9 files changed, 244 insertions(+), 184 deletions(-)
(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/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
index 25438ba2..f3df1319 100644
--- 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
@@ -76,15 +76,6 @@ public interface Partial2logicannotationsPackage extends EPackage {
*/
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.
*
@@ -92,7 +83,7 @@ public interface Partial2logicannotationsPackage extends EPackage {
* @generated
* @ordered
*/
- int PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION = LogicproblemPackage.ASSERTION_ANNOTATION_FEATURE_COUNT + 1;
+ int PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION = LogicproblemPackage.ASSERTION_ANNOTATION_FEATURE_COUNT + 0;
/**
* The number of structural features of the 'Partial Model Relation2 Assertion' class.
@@ -101,7 +92,7 @@ public interface Partial2logicannotationsPackage extends EPackage {
* @generated
* @ordered
*/
- int PARTIAL_MODEL_RELATION2_ASSERTION_FEATURE_COUNT = LogicproblemPackage.ASSERTION_ANNOTATION_FEATURE_COUNT + 2;
+ int PARTIAL_MODEL_RELATION2_ASSERTION_FEATURE_COUNT = LogicproblemPackage.ASSERTION_ANNOTATION_FEATURE_COUNT + 1;
/**
* The number of operations of the 'Partial Model Relation2 Assertion' class.
@@ -123,17 +114,6 @@ public interface Partial2logicannotationsPackage extends EPackage {
*/
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}'.
*
@@ -178,14 +158,6 @@ public interface Partial2logicannotationsPackage extends EPackage {
*/
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.
*
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
index 3c7f1a38..164725d3 100644
--- 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
@@ -5,10 +5,6 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.pa
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'.
@@ -18,7 +14,6 @@ import org.eclipse.emf.common.util.EList;
* The following features are supported:
*
*
- * - {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion#getLinks Links}
* - {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion#getTargetRelation Target Relation}
*
*
@@ -27,22 +22,6 @@ import org.eclipse.emf.common.util.EList;
* @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.
*
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
index f83498cd..934abc24 100644
--- 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
@@ -107,22 +107,13 @@ public class Partial2logicannotationsPackageImpl extends EPackageImpl implements
return partialModelRelation2AssertionEClass;
}
- /**
- *
- *
- * @generated
- */
- public EReference getPartialModelRelation2Assertion_Links() {
- return (EReference)partialModelRelation2AssertionEClass.getEStructuralFeatures().get(0);
- }
-
/**
*
*
* @generated
*/
public EReference getPartialModelRelation2Assertion_TargetRelation() {
- return (EReference)partialModelRelation2AssertionEClass.getEStructuralFeatures().get(1);
+ return (EReference)partialModelRelation2AssertionEClass.getEStructuralFeatures().get(0);
}
/**
@@ -154,7 +145,6 @@ public class Partial2logicannotationsPackageImpl extends EPackageImpl implements
// 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);
}
@@ -183,7 +173,6 @@ public class Partial2logicannotationsPackageImpl extends EPackageImpl implements
// 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
@@ -195,7 +184,6 @@ public class Partial2logicannotationsPackageImpl extends EPackageImpl implements
// 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
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
index 92011d1c..c6d0c04f 100644
--- 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
@@ -7,22 +7,11 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.impl.AssertionAnnotat
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;
/**
*
@@ -32,23 +21,12 @@ import org.eclipse.emf.ecore.util.InternalEList;
* The following features are implemented:
*
*
- * - {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.PartialModelRelation2AssertionImpl#getLinks Links}
* - {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.PartialModelRelation2AssertionImpl#getTargetRelation Target Relation}
*
*
* @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.
*
@@ -78,18 +56,6 @@ public class PartialModelRelation2AssertionImpl extends AssertionAnnotationImpl
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;
- }
-
/**
*
*
@@ -128,20 +94,6 @@ public class PartialModelRelation2AssertionImpl extends AssertionAnnotationImpl
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);
- }
-
/**
*
*
@@ -150,8 +102,6 @@ public class PartialModelRelation2AssertionImpl extends AssertionAnnotationImpl
@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();
@@ -168,10 +118,6 @@ public class PartialModelRelation2AssertionImpl extends AssertionAnnotationImpl
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
- case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS:
- getLinks().clear();
- getLinks().addAll((Collection extends RelationLink>)newValue);
- return;
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION:
setTargetRelation((RelationDeclaration)newValue);
return;
@@ -187,9 +133,6 @@ public class PartialModelRelation2AssertionImpl extends AssertionAnnotationImpl
@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;
@@ -205,8 +148,6 @@ public class PartialModelRelation2AssertionImpl extends AssertionAnnotationImpl
@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;
}
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
index d5d1094d..3bf7db44 100644
--- 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
@@ -59,15 +59,6 @@
-
-
-
-
-
-
-
-
-
@@ -177,6 +168,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -194,22 +198,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -338,9 +326,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
KEEP_LOCATION
@@ -377,7 +381,7 @@
-
+
@@ -392,15 +396,6 @@
-
-
-
-
-
-
-
-
-
@@ -496,7 +491,7 @@
-
+
@@ -512,8 +507,8 @@
-
- bold
+
+
@@ -647,6 +642,44 @@
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+ italic
+
+
+
+
+
+
+
+ bold
+
+
+
+
+
+
+
+
+
+
+
+
+
+ italic
+
+
+
+
+
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
index 3a1c20d1..412d8cbb 100644
--- 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
@@ -3,8 +3,6 @@
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="partial2logicannotations" nsURI="http://www.bme.hu/mit/inf/dslreasoner/logic/model/language/partial2logicannotation"
nsPrefix="partial2logicannotations">
-
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
index f4fc1fce..bd0f4ca4 100644
--- 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
@@ -20,6 +20,10 @@ import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.resource.Resource
import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.*
+import java.util.HashSet
+import java.util.Set
+import java.math.BigDecimal
+import org.eclipse.emf.ecore.EAttribute
class InstanceModel2PartialInterpretation {
val extension LogiclanguageFactory factory = LogiclanguageFactory.eINSTANCE
@@ -43,7 +47,12 @@ class InstanceModel2PartialInterpretation {
{
val problem = metamodelTranslationResult.output
val ecore2LogicTrace = metamodelTranslationResult.trace
- val tracedOutput = partialInterpretationInitialiser.initialisePartialInterpretation(problem, new TypeScopes)
+
+ val referencesUsed = ecore2Logic.allReferencesInScope(ecore2LogicTrace).toSet
+ val attributesUsed = ecore2Logic.allAttributesInScope(ecore2LogicTrace).toSet
+
+ val typeScope = createTypeScopesFromKnownAttributeValues(objects,attributesUsed)
+ val tracedOutput = partialInterpretationInitialiser.initialisePartialInterpretation(problem, typeScope)
val partialInterpretation = tracedOutput.output
val partialInterpretationTrace = tracedOutput.trace
@@ -54,7 +63,7 @@ class InstanceModel2PartialInterpretation {
val object = objects.get(objectIndex)
val element = createDefinedElement => [
it.name = if(withID)
- { '''o «objectIndex»''' } else
+ { '''o «objectIndex+1»''' } else
{ null }
]
@@ -71,8 +80,6 @@ class InstanceModel2PartialInterpretation {
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[
@@ -126,6 +133,52 @@ class InstanceModel2PartialInterpretation {
return partialInterpretation
}
+ private def createTypeScopesFromKnownAttributeValues(List objects, Set attributesUsed) {
+ val Set integers = new HashSet
+ val Set reals = new HashSet
+ val Set strings = new HashSet
+ for(object: objects) {
+ for(attribute : object.eClass.EAllAttributes.filter[attributesUsed.contains(it)]) {
+ val value = object.eGet(attribute)
+ if(value !== null) {
+ if(value instanceof List>) {
+ for(v : value) {
+ shortValue(v,integers,reals,strings)
+ }
+ } else {
+ shortValue(value,integers,reals,strings)
+ }
+ }
+ }
+ }
+ return new TypeScopes => [
+ it.knownIntegers += integers
+ it.knownReals += reals
+ it.knownStrings += strings
+ ]
+ }
+ private def dispatch shortValue(Boolean value, Set integers, Set reals, Set strings) {
+ // Do nothing
+ }
+ private def dispatch shortValue(Integer value, Set integers, Set reals, Set strings) {
+ integers += value
+ }
+ private def dispatch shortValue(Float value, Set integers, Set reals, Set strings) {
+ reals += BigDecimal.valueOf(value)
+ }
+ private def dispatch shortValue(Double value, Set integers, Set reals, Set strings) {
+ reals += BigDecimal.valueOf(value)
+ }
+ private def dispatch shortValue(String value, Set integers, Set reals, Set strings) {
+ strings += value
+ }
+ private def dispatch shortValue(Void value, Set integers, Set reals, Set strings) {
+ // Do nothing
+ }
+ private def dispatch shortValue(Object value, Set integers, Set reals, Set strings) {
+ // Do nothing
+ }
+
protected def translateLink(PartialRelationInterpretation interpretation, DefinedElement source, DefinedElement target) {
interpretation.relationlinks += createBinaryElementRelationLink => [it.param1 = source it.param2 = target]
}
@@ -138,7 +191,23 @@ class InstanceModel2PartialInterpretation {
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!''')
+ dispatch protected def translateValue(Boolean value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) {
+ value.lookup(partialInterpretationTrace.primitiveValues.booleanMap)
+ }
+
+ dispatch protected def translateValue(Integer value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) {
+ value.lookup(partialInterpretationTrace.primitiveValues.integerMap)
+ }
+
+ dispatch protected def translateValue(Double value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) {
+ BigDecimal.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap)
+ }
+
+ dispatch protected def translateValue(Float value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) {
+ BigDecimal.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap)
+ }
+
+ dispatch protected def translateValue(String value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) {
+ value.lookup(partialInterpretationTrace.primitiveValues.stringMap)
}
}
\ 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
index 5d8d9313..bba4ae92 100644
--- 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
@@ -24,6 +24,9 @@ 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.partialinterpretation.PrimitiveElement
+import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.BooleanElement
+import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.IntegerElement
+import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement
@Data class PartialInterpretation2Logic_Trace {
Map new2Old = new HashMap
@@ -148,7 +151,7 @@ class PartialInterpretation2Logic {
val ^annotation= Partial2logicannotationsFactory.eINSTANCE.createPartialModelRelation2Assertion
^annotation.target = assertion
^annotation.targetRelation = relation
- ^annotation.links += links.map[EcoreUtil.copy(it)]
+ //^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)
@@ -162,12 +165,25 @@ class PartialInterpretation2Logic {
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]
+ it.parameterSubstitutions += createValueInLink(link.param1)
+ it.parameterSubstitutions += createValueInLink(link.param2)
]
} else {
throw new IllegalArgumentException
}
} else throw new UnsupportedOperationException
}
+
+ def private dispatch createValueInLink(BooleanElement element) {
+ return element.value.asTerm
+ }
+ def private dispatch createValueInLink(IntegerElement element) {
+ return element.value.asTerm
+ }
+ def private dispatch createValueInLink(RealElement element) {
+ return element.value.asTerm
+ }
+ def private dispatch createValueInLink(DefinedElement element) {
+ return createSymbolicValue => [it.symbolicReference = element]
+ }
}
\ 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 2a350d53..cc76ce3f 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
@@ -2,6 +2,7 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage
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.RelationDeclaration
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type
@@ -10,8 +11,10 @@ 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.logic.model.patterns.SupertypeStar
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion
+import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.BinaryElementRelationLink
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.BooleanElement
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.IntegerElement
+import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.NaryRelationLink
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialBooleanInterpretation
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialComplexTypeInterpretation
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialIntegerInterpretation
@@ -22,16 +25,22 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.par
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.StringElement
+import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.UnaryElementRelationLink
import java.math.BigDecimal
import java.util.HashMap
import java.util.Map
import java.util.SortedSet
-import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine
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.logic.model.logiclanguage.SymbolicValue
+import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.And
+import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolLiteral
+import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral
+import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral
+import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringLiteral
@Data class Problem2PartialInterpretationTrace {
Map type2Interpretation
@@ -81,7 +90,7 @@ class PartialInterpretationInitialiser {
typeScopes.maxNewElements)
// Initialise relations
- val relation2Interpretation = initRelations(res)
+ val relation2Interpretation = initRelations(res,primitiveTrace)
val trace = new Problem2PartialInterpretationTrace(type2Interpretation,primitiveTrace,relation2Interpretation)
return new TracedOutput(res,trace)
@@ -95,13 +104,13 @@ class PartialInterpretationInitialiser {
{
return new PrimitiveValueTrace(
booleanType,
- booleanType.elements.filter(BooleanElement).toMap[value],
+ booleanType.elements.filter(BooleanElement).filter[it.isValueSet].toMap[value],
integerType,
- integerType.elements.filter(IntegerElement).toMap[value],
+ integerType.elements.filter(IntegerElement).filter[it.isValueSet].toMap[value],
realType,
- realType.elements.filter(RealElement).toMap[value],
+ realType.elements.filter(RealElement).filter[it.isValueSet].toMap[value],
stringType,
- stringType.elements.filter(StringElement).toMap[value]
+ stringType.elements.filter(StringElement).filter[it.isValueSet].toMap[value]
)
}
@@ -130,7 +139,9 @@ class PartialInterpretationInitialiser {
partialInterpretation.newElements += integerElement
}
if(maxNewIntegers>0) {
- throw new UnsupportedOperationException('''Unspecified Integers are currently not supported!''')
+ val newElements = createIntegerElement => [it.name = "New Integers" it.valueSet = false]
+ partialInterpretation.openWorldElements += newElements
+ integerInterpretation.elements += newElements
}
return integerInterpretation
@@ -146,7 +157,9 @@ class PartialInterpretationInitialiser {
partialInterpretation.newElements += realElement
}
if(maxNewReals>0) {
- throw new UnsupportedOperationException('''Unspecified Real values are currently not supported!''')
+ val newElements = createRealElement => [it.name = "New Reals" it.valueSet = false]
+ partialInterpretation.openWorldElements += newElements
+ realInterpretation.elements += newElements
}
return realInterpretation
}
@@ -161,7 +174,9 @@ class PartialInterpretationInitialiser {
partialInterpretation.newElements += stringElement
}
if(maxNewStrings>0) {
- throw new UnsupportedOperationException('''Unspecified String values are currently not supported!''')
+ val newElements = createStringElement => [it.name = "New Strings" it.valueSet = false]
+ partialInterpretation.openWorldElements += newElements
+ stringInterpretation.elements += newElements
}
return stringInterpretation
@@ -201,7 +216,7 @@ class PartialInterpretationInitialiser {
}
}
- def private initRelations(PartialInterpretation interpretation) {
+ def private Map initRelations(PartialInterpretation interpretation, PrimitiveValueTrace trace) {
val Map relation2Interpretation = new HashMap
for(relation : interpretation.problem.relations.filter(RelationDeclaration)) {
val partialInterpretation = relation.initialisePartialRelationInterpretation
@@ -211,8 +226,24 @@ class PartialInterpretationInitialiser {
for(pMR2A : interpretation.problem.annotations.filter(PartialModelRelation2Assertion)) {
val relation = pMR2A.targetRelation
val r = relation.lookup(relation2Interpretation)
- r.relationlinks+=pMR2A.links.map[EcoreUtil.copy(it)]
+ val assertion = pMR2A.target.value
+ val links = if(assertion instanceof SymbolicValue) {
+ #[assertion]
+ } else if(assertion instanceof And){
+ val res = assertion.operands.filter(SymbolicValue)
+ if(res.size != assertion.operands) {
+ throw new UnsupportedOperationException('''Assertion describing partial model of "«r.interpretationOf.name»" contains unsupported constructs''')
+ } else {
+ res
+ }
+ } else {
+ throw new UnsupportedOperationException('''Assertion describing partial model of "«r.interpretationOf.name»" contains unsupported constructs''')
+ }
+ for(link:links) {
+ r.relationlinks += createLink(link,trace)
+ }
}
+
// interpretation.partialfunctioninterpretation += interpretation.problem.functions.filter(FunctionDeclaration)
// .map[initialisePartialFunctionInterpretation(trace)]
// interpretation.partialconstantinterpretation += interpretation.problem.constants.filter(ConstantDeclaration)
@@ -220,6 +251,39 @@ class PartialInterpretationInitialiser {
return relation2Interpretation
}
+ def private createLink(SymbolicValue v, PrimitiveValueTrace trace) {
+ val translatedValues = v.parameterSubstitutions.map[getElement(trace)].toList
+ if(translatedValues.size == 1) {
+ return createUnaryElementRelationLink => [it.param1 = translatedValues.get(0)]
+ } else if(translatedValues.size == 2) {
+ return createBinaryElementRelationLink => [it.param1 = translatedValues.get(0) it.param2 = translatedValues.get(1)]
+ } else {
+ val res = createNaryRelationLink
+ for(i : 0.. [
+ it.index = i
+ it.param = translatedValues.get(i)
+ ]
+ }
+ return res
+ }
+ }
+
+ def private dispatch getElement(SymbolicValue element, PrimitiveValueTrace trace) {
+ return element.symbolicReference as DefinedElement
+ }
+ def private dispatch getElement(BoolLiteral element, PrimitiveValueTrace trace) {
+ element.value.lookup(trace.booleanMap)
+ }
+ def private dispatch getElement(IntLiteral element, PrimitiveValueTrace trace) {
+ element.value.lookup(trace.integerMap)
+ }
+ def private dispatch getElement(RealLiteral element, PrimitiveValueTrace trace) {
+ element.value.lookup(trace.realMap)
+ }
+ def private dispatch getElement(StringLiteral element, PrimitiveValueTrace trace) {
+ element.value.lookup(trace.stringMap)
+ }
def private initialisePartialTypeInterpretation(TypeDeclaration t, ViatraQueryEngine engine) {
val supertypeMatcher = SupertypeStar.Matcher.on(engine)
--
cgit v1.2.3-70-g09d2