diff options
author | 2018-06-25 00:16:48 +0200 | |
---|---|---|
committer | 2018-06-25 00:16:48 +0200 | |
commit | 6bd475a3eced9d9a912f76e24f91d2ad8da13d54 (patch) | |
tree | 66b3fbfb52e204d605225d1eac7e371eecea791e /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexerWithPreliminaryTypeAnalysis.xtend | |
parent | Fixing multiple "true" and "false" objects (diff) | |
download | VIATRA-Generator-6bd475a3eced9d9a912f76e24f91d2ad8da13d54.tar.gz VIATRA-Generator-6bd475a3eced9d9a912f76e24f91d2ad8da13d54.tar.zst VIATRA-Generator-6bd475a3eced9d9a912f76e24f91d2ad8da13d54.zip |
Fixing multiple true/false + bug preventing generation without PS
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexerWithPreliminaryTypeAnalysis.xtend')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/TypeIndexerWithPreliminaryTypeAnalysis.xtend | 26 |
1 files changed, 15 insertions, 11 deletions
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")» } |