diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns')
6 files changed, 60 insertions, 34 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/GenericTypeIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/GenericTypeIndexer.xtend index 2dae95be..dce04a7f 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/GenericTypeIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/GenericTypeIndexer.xtend | |||
@@ -80,6 +80,11 @@ class GenericTypeIndexer extends TypeIndexer { | |||
80 | Type.isAbstract(dynamic,false); | 80 | Type.isAbstract(dynamic,false); |
81 | } | 81 | } |
82 | 82 | ||
83 | |||
84 | private pattern isPrimitive(element: PrimitiveElement) { | ||
85 | PrimitiveElement(element); | ||
86 | } | ||
87 | |||
83 | private pattern possibleDynamicType(problem: LogicProblem, interpretation:PartialInterpretation, dynamic:Type, element:DefinedElement) | 88 | private pattern possibleDynamicType(problem: LogicProblem, interpretation:PartialInterpretation, dynamic:Type, element:DefinedElement) |
84 | // case 1: element is defined at least once | 89 | // case 1: element is defined at least once |
85 | { | 90 | { |
@@ -94,6 +99,8 @@ class GenericTypeIndexer extends TypeIndexer { | |||
94 | neg find dynamicTypeIsSubtypeOfANonDefinition(problem,interpretation,element,dynamic); | 99 | neg find dynamicTypeIsSubtypeOfANonDefinition(problem,interpretation,element,dynamic); |
95 | // 4: T is not abstract | 100 | // 4: T is not abstract |
96 | Type.isAbstract(dynamic,false); | 101 | Type.isAbstract(dynamic,false); |
102 | // 5. element is not primitive datatype | ||
103 | neg find isPrimitive(element); | ||
97 | } or | 104 | } or |
98 | // case 2: element is not defined anywhere | 105 | // case 2: element is not defined anywhere |
99 | { | 106 | { |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/GenericTypeRefinementGenerator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/GenericTypeRefinementGenerator.xtend index 1aa3b955..2e03d6ed 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/GenericTypeRefinementGenerator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/GenericTypeRefinementGenerator.xtend | |||
@@ -28,7 +28,7 @@ class GenericTypeRefinementGenerator extends TypeRefinementGenerator { | |||
28 | private pattern hasElementInContainment(problem:LogicProblem, interpretation:PartialInterpretation) | 28 | private pattern hasElementInContainment(problem:LogicProblem, interpretation:PartialInterpretation) |
29 | «FOR type :containment.typesOrderedInHierarchy SEPARATOR "or"»{ | 29 | «FOR type :containment.typesOrderedInHierarchy SEPARATOR "or"»{ |
30 | find interpretation(problem,interpretation); | 30 | find interpretation(problem,interpretation); |
31 | «base.typeIndexer.referInstanceOf(type,Modality.MAY,"root")» | 31 | «base.typeIndexer.referInstanceOf(type,Modality.MUST,"root")» |
32 | find mustExist(problem, interpretation, root); | 32 | find mustExist(problem, interpretation, root); |
33 | }«ENDFOR» | 33 | }«ENDFOR» |
34 | «FOR type:newObjectTypes» | 34 | «FOR type:newObjectTypes» |
@@ -37,7 +37,7 @@ class GenericTypeRefinementGenerator extends TypeRefinementGenerator { | |||
37 | «IF inverseRelations.containsKey(containmentRelation)» | 37 | «IF inverseRelations.containsKey(containmentRelation)» |
38 | pattern «this.patternName(containmentRelation,inverseRelations.get(containmentRelation),type)»( | 38 | pattern «this.patternName(containmentRelation,inverseRelations.get(containmentRelation),type)»( |
39 | problem:LogicProblem, interpretation:PartialInterpretation, | 39 | problem:LogicProblem, interpretation:PartialInterpretation, |
40 | relationInterpretation:PartialRelationInterpretation, inverseInterpretation:PartialRelationInterpretation ,typeInterpretation:PartialTypeInterpratation, | 40 | relationInterpretation:PartialRelationInterpretation, inverseInterpretation:PartialRelationInterpretation ,typeInterpretation:PartialComplexTypeInterpretation, |
41 | container:DefinedElement) | 41 | container:DefinedElement) |
42 | { | 42 | { |
43 | find interpretation(problem,interpretation); | 43 | find interpretation(problem,interpretation); |
@@ -56,7 +56,7 @@ class GenericTypeRefinementGenerator extends TypeRefinementGenerator { | |||
56 | «ELSE» | 56 | «ELSE» |
57 | pattern «this.patternName(containmentRelation,null,type)»( | 57 | pattern «this.patternName(containmentRelation,null,type)»( |
58 | problem:LogicProblem, interpretation:PartialInterpretation, | 58 | problem:LogicProblem, interpretation:PartialInterpretation, |
59 | relationInterpretation:PartialRelationInterpretation, typeInterpretation:PartialTypeInterpratation, | 59 | relationInterpretation:PartialRelationInterpretation, typeInterpretation:PartialComplexTypeInterpretation, |
60 | container:DefinedElement) | 60 | container:DefinedElement) |
61 | { | 61 | { |
62 | find interpretation(problem,interpretation); | 62 | find interpretation(problem,interpretation); |
@@ -74,7 +74,7 @@ class GenericTypeRefinementGenerator extends TypeRefinementGenerator { | |||
74 | «ENDFOR» | 74 | «ENDFOR» |
75 | pattern «patternName(null,null,type)»( | 75 | pattern «patternName(null,null,type)»( |
76 | problem:LogicProblem, interpretation:PartialInterpretation, | 76 | problem:LogicProblem, interpretation:PartialInterpretation, |
77 | typeInterpretation:PartialTypeInterpratation) | 77 | typeInterpretation:PartialComplexTypeInterpretation) |
78 | { | 78 | { |
79 | find interpretation(problem,interpretation); | 79 | find interpretation(problem,interpretation); |
80 | neg find hasElementInContainment(problem,interpretation); | 80 | neg find hasElementInContainment(problem,interpretation); |
@@ -87,7 +87,7 @@ class GenericTypeRefinementGenerator extends TypeRefinementGenerator { | |||
87 | «ELSE» | 87 | «ELSE» |
88 | pattern createObject_«this.patternName(null,null,type)»( | 88 | pattern createObject_«this.patternName(null,null,type)»( |
89 | problem:LogicProblem, interpretation:PartialInterpretation, | 89 | problem:LogicProblem, interpretation:PartialInterpretation, |
90 | typeInterpretation:PartialTypeInterpratation) | 90 | typeInterpretation:PartialComplexTypeInterpretation) |
91 | { | 91 | { |
92 | find interpretation(problem,interpretation); | 92 | find interpretation(problem,interpretation); |
93 | PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); | 93 | PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend index 001ff13f..0fed5c76 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternGenerator.xtend | |||
@@ -163,35 +163,35 @@ class PatternGenerator { | |||
163 | ////////// | 163 | ////////// |
164 | // 0. Util | 164 | // 0. Util |
165 | ////////// | 165 | ////////// |
166 | private pattern interpretation(problem:LogicProblem, interpetation:PartialInterpretation) { | 166 | private pattern interpretation(problem:LogicProblem, interpretation:PartialInterpretation) { |
167 | PartialInterpretation.problem(interpetation,problem); | 167 | PartialInterpretation.problem(interpretation,problem); |
168 | } | 168 | } |
169 | 169 | ||
170 | ///////////////////////// | 170 | ///////////////////////// |
171 | // 0.1 Existence | 171 | // 0.1 Existence |
172 | ///////////////////////// | 172 | ///////////////////////// |
173 | private pattern mustExist(problem:LogicProblem, interpetation:PartialInterpretation, element:DefinedElement) { | 173 | private pattern mustExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { |
174 | find interpretation(problem,interpetation); | 174 | find interpretation(problem,interpretation); |
175 | LogicProblem.elements(problem,element); | 175 | LogicProblem.elements(problem,element); |
176 | } or { | 176 | } or { |
177 | find interpretation(problem,interpetation); | 177 | find interpretation(problem,interpretation); |
178 | PartialInterpretation.newElements(interpetation,element); | 178 | PartialInterpretation.newElements(interpretation,element); |
179 | } | 179 | } |
180 | 180 | ||
181 | private pattern mayExist(problem:LogicProblem, interpetation:PartialInterpretation, element:DefinedElement) { | 181 | private pattern mayExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { |
182 | find mustExist(problem,interpetation,element); | 182 | find mustExist(problem,interpretation,element); |
183 | } or { | 183 | } or { |
184 | find interpretation(problem,interpetation); | 184 | find interpretation(problem,interpretation); |
185 | neg find elementCloseWorld(interpetation); | 185 | neg find elementCloseWorld(element); |
186 | PartialInterpretation.openWorldElements(interpetation,element); | 186 | PartialInterpretation.openWorldElements(interpretation,element); |
187 | } | 187 | } |
188 | 188 | ||
189 | private pattern elementCloseWorld(element:DefinedElement) { | 189 | private pattern elementCloseWorld(element:DefinedElement) { |
190 | PartialInterpretation.newElements(i,element); | 190 | PartialInterpretation.newElements(i,element); |
191 | PartialInterpretation.maxNewElements(i,0); | 191 | PartialInterpretation.maxNewElements(i,0); |
192 | } or { | 192 | } or { |
193 | Scope.targetTypeInterpretation(scope,interpetation); | 193 | Scope.targetTypeInterpretation(scope,interpretation); |
194 | PartialTypeInterpratation.elements(interpetation,element); | 194 | PartialTypeInterpratation.elements(interpretation,element); |
195 | Scope.maxNewElements(scope,0); | 195 | Scope.maxNewElements(scope,0); |
196 | } | 196 | } |
197 | 197 | ||
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexer.xtend index 630fad51..d1d57189 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexer.xtend | |||
@@ -11,6 +11,7 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolTypeReference | |||
11 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntTypeReference | 11 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntTypeReference |
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealTypeReference | 12 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealTypeReference |
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringTypeReference | 13 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringTypeReference |
14 | import java.math.BigDecimal | ||
14 | 15 | ||
15 | abstract class TypeIndexer { | 16 | abstract class TypeIndexer { |
16 | public def CharSequence getRequiredQueries() | 17 | public def CharSequence getRequiredQueries() |
@@ -34,5 +35,18 @@ abstract class TypeIndexer { | |||
34 | public def dispatch CharSequence referInstanceOfByReference(StringTypeReference reference, Modality modality, String variableName) { | 35 | public def dispatch CharSequence referInstanceOfByReference(StringTypeReference reference, Modality modality, String variableName) { |
35 | '''StringElement(«variableName»);''' | 36 | '''StringElement(«variableName»);''' |
36 | } | 37 | } |
38 | public def dispatch CharSequence referPrimitiveValue(String variableName, Boolean value) { | ||
39 | '''BooleanElement.value(«variableName»,«value»);''' | ||
40 | } | ||
41 | public def dispatch CharSequence referPrimitiveValue(String variableName, Integer value) { | ||
42 | '''IntegerElement.value(«variableName»,«value»);''' | ||
43 | } | ||
44 | public def dispatch CharSequence referPrimitiveValue(String variableName, BigDecimal value) { | ||
45 | '''RealElement.value(«variableName»,«value»);''' | ||
46 | } | ||
47 | ///TODO: de-escaping string literals | ||
48 | public def dispatch CharSequence referPrimitiveValue(String variableName, String value) { | ||
49 | '''StringElement.value(«variableName»,"«value»");''' | ||
50 | } | ||
37 | 51 | ||
38 | } \ No newline at end of file | 52 | } \ No newline at end of file |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexerWithPreliminaryTypeAnalysis.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexerWithPreliminaryTypeAnalysis.xtend index 7bdb9a5b..fde5f4b6 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexerWithPreliminaryTypeAnalysis.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexerWithPreliminaryTypeAnalysis.xtend | |||
@@ -4,10 +4,9 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type | |||
4 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem | 4 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem |
5 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.Modality | 5 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.Modality |
6 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeAnalysisResult | 6 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeAnalysisResult |
7 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeRefinementPrecondition | ||
7 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | 8 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation |
8 | import org.eclipse.emf.ecore.EClass | 9 | import org.eclipse.emf.ecore.EClass |
9 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.TypeRefinementPrecondition | ||
10 | import java.util.Collections | ||
11 | 10 | ||
12 | class TypeIndexerWithPreliminaryTypeAnalysis extends TypeIndexer{ | 11 | class TypeIndexerWithPreliminaryTypeAnalysis extends TypeIndexer{ |
13 | val PatternGenerator base; | 12 | val PatternGenerator base; |
@@ -18,22 +17,26 @@ class TypeIndexerWithPreliminaryTypeAnalysis extends TypeIndexer{ | |||
18 | override requiresTypeAnalysis() { true } | 17 | override requiresTypeAnalysis() { true } |
19 | 18 | ||
20 | override getRequiredQueries() ''' | 19 | override getRequiredQueries() ''' |
21 | private pattern typeInterpretation(problem:LogicProblem, interpetation:PartialInterpretation, type:TypeDeclaration, typeInterpretation:PartialComplexTypeInterpretation) { | 20 | private pattern typeInterpretation(problem:LogicProblem, interpretation:PartialInterpretation, type:TypeDeclaration, typeInterpretation:PartialComplexTypeInterpretation) { |
22 | find interpretation(problem,interpetation); | 21 | find interpretation(problem,interpretation); |
23 | LogicProblem.types(problem,type); | 22 | LogicProblem.types(problem,type); |
24 | PartialInterpretation.partialtypeinterpratation(interpetation,typeInterpretation); | 23 | PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); |
25 | PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type); | 24 | PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type); |
26 | } | 25 | } |
27 | 26 | ||
28 | private pattern directInstanceOf(problem:LogicProblem, interpetation:PartialInterpretation, element:DefinedElement, type:Type) { | 27 | private pattern directInstanceOf(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement, type:Type) { |
29 | find interpretation(problem,interpetation); | 28 | find interpretation(problem,interpretation); |
30 | LogicProblem.types(problem,type); | 29 | LogicProblem.types(problem,type); |
31 | TypeDefinition.elements(type,element); | 30 | TypeDefinition.elements(type,element); |
32 | } or { | 31 | } or { |
33 | find interpretation(problem,interpetation); | 32 | find interpretation(problem,interpretation); |
34 | find typeInterpretation(problem,interpetation,type,typeInterpretation); | 33 | find typeInterpretation(problem,interpretation,type,typeInterpretation); |
35 | PartialComplexTypeInterpretation.elements(typeInterpretation,element); | 34 | PartialComplexTypeInterpretation.elements(typeInterpretation,element); |
36 | } | 35 | } |
36 | |||
37 | private pattern isPrimitive(element: PrimitiveElement) { | ||
38 | PrimitiveElement(element); | ||
39 | } | ||
37 | ''' | 40 | ''' |
38 | 41 | ||
39 | override generateInstanceOfQueries(LogicProblem problem, PartialInterpretation emptySolution, TypeAnalysisResult typeAnalysisResult) { | 42 | override generateInstanceOfQueries(LogicProblem problem, PartialInterpretation emptySolution, TypeAnalysisResult typeAnalysisResult) { |
@@ -73,15 +76,16 @@ class TypeIndexerWithPreliminaryTypeAnalysis extends TypeIndexer{ | |||
73 | * An element may be an instance of type "«type.name»". | 76 | * An element may be an instance of type "«type.name»". |
74 | */ | 77 | */ |
75 | private pattern «patternName(type,Modality.MAY)»(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) | 78 | private pattern «patternName(type,Modality.MAY)»(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) |
76 | «IF inhibitorTypes != null»{ | 79 | «IF inhibitorTypes !== null»{ |
77 | find interpretation(problem,interpretation); | 80 | find interpretation(problem,interpretation); |
78 | PartialInterpretation.newElements(interpretation,element); | 81 | PartialInterpretation.newElements(interpretation,element); |
79 | «FOR inhibitorType : inhibitorTypes» | 82 | «FOR inhibitorType : inhibitorTypes» |
80 | neg «referInstanceOf(inhibitorType,Modality.MUST,"element")» | 83 | neg «referInstanceOf(inhibitorType,Modality.MUST,"element")» |
81 | «ENDFOR» | 84 | «ENDFOR» |
85 | neg find isPrimitive(element); | ||
82 | } or { | 86 | } or { |
83 | find interpretation(problem,interpretation); | 87 | find interpretation(problem,interpretation); |
84 | PartialInterpretation.openWorldElements(interpetation,element); | 88 | PartialInterpretation.openWorldElements(interpretation,element); |
85 | } or | 89 | } or |
86 | «ENDIF» | 90 | «ENDIF» |
87 | { «referInstanceOf(type,Modality.MUST,"element")» } | 91 | { «referInstanceOf(type,Modality.MUST,"element")» } |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeRefinementWithPreliminaryTypeAnalysis.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeRefinementWithPreliminaryTypeAnalysis.xtend index 7c5f507b..cbbbcb08 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeRefinementWithPreliminaryTypeAnalysis.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeRefinementWithPreliminaryTypeAnalysis.xtend | |||
@@ -27,7 +27,7 @@ class TypeRefinementWithPreliminaryTypeAnalysis extends TypeRefinementGenerator{ | |||
27 | private pattern hasElementInContainment(problem:LogicProblem, interpretation:PartialInterpretation) | 27 | private pattern hasElementInContainment(problem:LogicProblem, interpretation:PartialInterpretation) |
28 | «FOR type :containment.typesOrderedInHierarchy SEPARATOR "or"»{ | 28 | «FOR type :containment.typesOrderedInHierarchy SEPARATOR "or"»{ |
29 | find interpretation(problem,interpretation); | 29 | find interpretation(problem,interpretation); |
30 | «base.typeIndexer.referInstanceOf(type,Modality.MAY,"root")» | 30 | «base.typeIndexer.referInstanceOf(type,Modality.MUST,"root")» |
31 | find mustExist(problem, interpretation, root); | 31 | find mustExist(problem, interpretation, root); |
32 | }«ENDFOR» | 32 | }«ENDFOR» |
33 | «FOR type:possibleNewDynamicType» | 33 | «FOR type:possibleNewDynamicType» |
@@ -36,7 +36,7 @@ class TypeRefinementWithPreliminaryTypeAnalysis extends TypeRefinementGenerator{ | |||
36 | «IF inverseRelations.containsKey(containmentRelation)» | 36 | «IF inverseRelations.containsKey(containmentRelation)» |
37 | pattern «this.patternName(containmentRelation,inverseRelations.get(containmentRelation),type)»( | 37 | pattern «this.patternName(containmentRelation,inverseRelations.get(containmentRelation),type)»( |
38 | problem:LogicProblem, interpretation:PartialInterpretation, | 38 | problem:LogicProblem, interpretation:PartialInterpretation, |
39 | relationInterpretation:PartialRelationInterpretation, inverseInterpretation:PartialRelationInterpretation, typeInterpretation:PartialTypeInterpratation, | 39 | relationInterpretation:PartialRelationInterpretation, inverseInterpretation:PartialRelationInterpretation, typeInterpretation:PartialComplexTypeInterpretation, |
40 | container:DefinedElement) | 40 | container:DefinedElement) |
41 | { | 41 | { |
42 | find interpretation(problem,interpretation); | 42 | find interpretation(problem,interpretation); |
@@ -55,7 +55,7 @@ class TypeRefinementWithPreliminaryTypeAnalysis extends TypeRefinementGenerator{ | |||
55 | «ELSE» | 55 | «ELSE» |
56 | pattern «this.patternName(containmentRelation,null,type)»( | 56 | pattern «this.patternName(containmentRelation,null,type)»( |
57 | problem:LogicProblem, interpretation:PartialInterpretation, | 57 | problem:LogicProblem, interpretation:PartialInterpretation, |
58 | relationInterpretation:PartialRelationInterpretation, typeInterpretation:PartialTypeInterpratation, | 58 | relationInterpretation:PartialRelationInterpretation, typeInterpretation:PartialComplexTypeInterpretation, |
59 | container:DefinedElement) | 59 | container:DefinedElement) |
60 | { | 60 | { |
61 | find interpretation(problem,interpretation); | 61 | find interpretation(problem,interpretation); |
@@ -73,7 +73,7 @@ class TypeRefinementWithPreliminaryTypeAnalysis extends TypeRefinementGenerator{ | |||
73 | «ENDFOR» | 73 | «ENDFOR» |
74 | pattern «patternName(null,null,type)»( | 74 | pattern «patternName(null,null,type)»( |
75 | problem:LogicProblem, interpretation:PartialInterpretation, | 75 | problem:LogicProblem, interpretation:PartialInterpretation, |
76 | typeInterpretation:PartialTypeInterpratation) | 76 | typeInterpretation:PartialComplexTypeInterpretation) |
77 | { | 77 | { |
78 | find interpretation(problem,interpretation); | 78 | find interpretation(problem,interpretation); |
79 | neg find hasElementInContainment(problem,interpretation); | 79 | neg find hasElementInContainment(problem,interpretation); |
@@ -86,7 +86,7 @@ class TypeRefinementWithPreliminaryTypeAnalysis extends TypeRefinementGenerator{ | |||
86 | «ELSE» | 86 | «ELSE» |
87 | pattern «this.patternName(null,null,type)»( | 87 | pattern «this.patternName(null,null,type)»( |
88 | problem:LogicProblem, interpretation:PartialInterpretation, | 88 | problem:LogicProblem, interpretation:PartialInterpretation, |
89 | typeInterpretation:PartialTypeInterpratation) | 89 | typeInterpretation:PartialComplexTypeInterpretation) |
90 | { | 90 | { |
91 | find interpretation(problem,interpretation); | 91 | find interpretation(problem,interpretation); |
92 | PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); | 92 | PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); |
@@ -107,6 +107,7 @@ class TypeRefinementWithPreliminaryTypeAnalysis extends TypeRefinementGenerator{ | |||
107 | pattern refineTypeTo_«base.canonizeName(newTypeRefinement.targetType.name)»(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) { | 107 | pattern refineTypeTo_«base.canonizeName(newTypeRefinement.targetType.name)»(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) { |
108 | find interpretation(problem,interpretation); | 108 | find interpretation(problem,interpretation); |
109 | PartialInterpretation.newElements(interpretation,element); | 109 | PartialInterpretation.newElements(interpretation,element); |
110 | «base.typeIndexer.referInstanceOf(newTypeRefinement.targetType,Modality.MAY,"element")» | ||
110 | «FOR inhibitorType : newTypeRefinement.inhibitorTypes» | 111 | «FOR inhibitorType : newTypeRefinement.inhibitorTypes» |
111 | neg «base.typeIndexer.referInstanceOf(inhibitorType,Modality.MUST,"element")» | 112 | neg «base.typeIndexer.referInstanceOf(inhibitorType,Modality.MUST,"element")» |
112 | «ENDFOR» | 113 | «ENDFOR» |