From 30c205f552a9c66c69903d4f12dd09f3e27e06ea Mon Sep 17 00:00:00 2001
From: OszkarSemerath
Date: Tue, 8 Aug 2017 16:11:45 +0200
Subject: Support for double and string attributes
---
.../model/logiclanguage.aird | 136 ++++++++++++++++++---
.../model/logiclanguage.ecore | 9 +-
.../model/builder/LogicModelInterpretation.xtend | 3 +
.../model/builder/LogicStructureBuilder.xtend | 75 ++++++------
4 files changed, 167 insertions(+), 56 deletions(-)
(limited to 'Framework/hu.bme.mit.inf.dslreasoner.logic.model')
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.aird b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.aird
index 4c0c5b13..16247fdd 100644
--- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.aird
+++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.aird
@@ -7273,6 +7273,12 @@
+
+
+ bold
+
+
+
@@ -7289,6 +7295,10 @@
+
+
+
+
@@ -7315,7 +7325,7 @@
-
+
@@ -7328,7 +7338,7 @@
-
+
@@ -7341,7 +7351,7 @@
-
+
@@ -7404,7 +7414,7 @@
-
+
@@ -7422,7 +7432,7 @@
-
+
@@ -7431,7 +7441,7 @@
-
+
@@ -7595,6 +7605,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -8556,6 +8579,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -8577,8 +8632,16 @@
+
+
+
+
+
+
+
+
-
+
KEEP_LOCATION
@@ -8600,8 +8663,8 @@
-
-
+
+ bold
@@ -8619,8 +8682,8 @@
-
-
+
+ bold
@@ -8638,13 +8701,13 @@
-
-
+
+ bold
-
+
KEEP_LOCATION
@@ -8883,7 +8946,7 @@
-
+
KEEP_LOCATION
@@ -9680,6 +9743,49 @@
+
+
+
+
+
+
+ italic
+
+
+
+
+
+
+
+
+ KEEP_LOCATION
+ KEEP_SIZE
+ KEEP_RATIO
+
+
+
+
+
+
+
+
+ bold
+
+
+
+
+
+
+
+
+
+
+ italic
+
+
+
+
+
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore
index 6a64a986..bf42e9b9 100644
--- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore
+++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore
@@ -49,13 +49,13 @@
-
+
-
+
-
+
+
+
+
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicModelInterpretation.xtend b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicModelInterpretation.xtend
index aa59836c..905859eb 100644
--- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicModelInterpretation.xtend
+++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicModelInterpretation.xtend
@@ -27,6 +27,7 @@ interface LogicModelInterpretation{
* Boolean literal | Boolean |
* Integer literal | Integer |
* Real literal | BigDecimal |
+ * String literal | String |
*
* @param function The target function to be interpreted.
* @param parameterSubstitution The array of the substituted parameters encoded as defined in the table.
@@ -41,6 +42,7 @@ interface LogicModelInterpretation{
* Boolean literal | Boolean |
* Integer literal | Integer |
* Real literal | BigDecimal |
+ * String literal | String |
*
* @param relation The target relation to be interpreted.
* @param parameterSubstitution The array of the substituted parameters encoded as defined in the table.
@@ -55,6 +57,7 @@ interface LogicModelInterpretation{
* Boolean literal | Boolean |
* Integer literal | Integer |
* Real literal | BigDecimal |
+ * String literal | String |
*
* @param constant The target constant to be interpreted.
* @return The value of the constant encoded as specified in the table.
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicStructureBuilder.xtend b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicStructureBuilder.xtend
index 760aa8b8..42f85a2d 100644
--- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicStructureBuilder.xtend
+++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicStructureBuilder.xtend
@@ -55,6 +55,10 @@ 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.InstanceOf
+import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeReference
+import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolTypeReference
+import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealTypeReference
+import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringTypeReference
@Data class InterpretationValidationResult {
val List problems;
@@ -381,14 +385,28 @@ class LogicStructureBuilder{
return (left as Number).asInteger == (right as Number).asInteger
}
} else return left.equals(right)
- }
+ }
- def allIntegers(LogicModelInterpretation interpretation) {
- if(interpretation.minimalInteger <= interpretation.maximalInteger) {
- (interpretation.minimalInteger .. interpretation.maximalInteger).map[asInteger]
- } else return emptySet
+ private dispatch def allObjects(LogicModelInterpretation interpretation, ComplexTypeReference type) {
+ return interpretation.getElements(type.referred)
+ }
+ private dispatch def allObjects(LogicModelInterpretation interpretation, BoolTypeReference type) {
+ return #[true,false]
+ }
+ private dispatch def allObjects(LogicModelInterpretation interpretation, IntTypeReference type) {
+ return interpretation.allIntegersInStructure
+ }
+ private dispatch def allObjects(LogicModelInterpretation interpretation, RealTypeReference type) {
+ return interpretation.allRealsInStructure
+ }
+ private dispatch def allObjects(LogicModelInterpretation interpretation, StringTypeReference type) {
+ return interpretation.allStringsInStructure
+ }
+ private dispatch def allObjects(LogicModelInterpretation interpretation, TypeReference type) {
+ throw new UnsupportedOperationException('''Unknown type :«type.class.simpleName»!''')
}
+
def private boolean executeExists(
Term expression,
LogicModelInterpretation interpretation,
@@ -401,23 +419,13 @@ class LogicStructureBuilder{
}
else {
val unfoldedVariable = variablesToBind.head
- val possibleValuesType = unfoldedVariable.range
- if(possibleValuesType instanceof ComplexTypeReference) {
- return this.getElements(interpretation,possibleValuesType.referred).exists[newBinding |
- executeExists(
- expression,
- interpretation,
- new HashMap(variableBinding) => [put(unfoldedVariable,newBinding)],
- variablesToBind.subList(1,variablesToBind.size))]
- } else if(possibleValuesType instanceof IntTypeReference) {
- return interpretation.allIntegers.exists[newBinding |
- executeExists(
- expression,
- interpretation,
- new HashMap(variableBinding) => [put(unfoldedVariable,newBinding)],
- variablesToBind.subList(1,variablesToBind.size))]
- }
- else throw new UnsupportedOperationException('''Quantifying over type "«possibleValuesType»" is unsupported.''')
+ val possibleValues = interpretation.allObjects(unfoldedVariable.range)
+ return possibleValues.exists[newBinding |
+ executeExists(
+ expression,
+ interpretation,
+ new HashMap(variableBinding) => [put(unfoldedVariable,newBinding)],
+ variablesToBind.subList(1,variablesToBind.size))]
}
}
@@ -432,22 +440,13 @@ class LogicStructureBuilder{
}
else {
val unfoldedVariable = variablesToBind.head
- val possibleValuesType = unfoldedVariable.range
- if(possibleValuesType instanceof ComplexTypeReference) {
- return this.getElements(interpretation,possibleValuesType.referred).forall[newBinding |
- executeForall(
- expression,
- interpretation,
- new HashMap(variableBinding) => [put(unfoldedVariable,newBinding)],
- variablesToBind.subList(1,variablesToBind.size))]
- } else if(possibleValuesType instanceof IntTypeReference) {
- return interpretation.allIntegers.forall[newBinding |
- executeForall(
- expression,
- interpretation,
- new HashMap(variableBinding) => [put(unfoldedVariable,newBinding)],
- variablesToBind.subList(1,variablesToBind.size))]
- } else throw new UnsupportedOperationException('''Quantifying over type "«possibleValuesType»" is unsupported.''')
+ val possibleValues = interpretation.allObjects(unfoldedVariable.range)
+ return possibleValues.forall[newBinding |
+ executeForall(
+ expression,
+ interpretation,
+ new HashMap(variableBinding) => [put(unfoldedVariable,newBinding)],
+ variablesToBind.subList(1,variablesToBind.size))]
}
}
}
\ No newline at end of file
--
cgit v1.2.3-54-g00ecf