diff options
author | 2020-05-18 21:45:19 +0200 | |
---|---|---|
committer | 2020-05-18 21:45:19 +0200 | |
commit | c0568c4373fa00e2ba2e165cfd681dd7cd61add6 (patch) | |
tree | 2b896db05d2b4be163f0ea639f847fe6426c6eb4 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns | |
parent | Merge branch 'master' of https://github.com/viatra/VIATRA-Generator (diff) | |
download | VIATRA-Generator-c0568c4373fa00e2ba2e165cfd681dd7cd61add6.tar.gz VIATRA-Generator-c0568c4373fa00e2ba2e165cfd681dd7cd61add6.tar.zst VIATRA-Generator-c0568c4373fa00e2ba2e165cfd681dd7cd61add6.zip |
removed every occurence of check expressions
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns')
4 files changed, 22 insertions, 18 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PConstraintTransformer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PConstraintTransformer.xtend index a4dcefbf..dd5cade1 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PConstraintTransformer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PConstraintTransformer.xtend | |||
@@ -196,7 +196,9 @@ class PConstraintTransformer { | |||
196 | def hasValue(PVariable v, String target, Modality m, List<VariableMapping> variableMapping) { | 196 | def hasValue(PVariable v, String target, Modality m, List<VariableMapping> variableMapping) { |
197 | val typeReference = variableMapping.filter[it.sourcePVariable === v].head.targetLogicVariable.range as PrimitiveTypeReference | 197 | val typeReference = variableMapping.filter[it.sourcePVariable === v].head.targetLogicVariable.range as PrimitiveTypeReference |
198 | if(m.isMay) { | 198 | if(m.isMay) { |
199 | '''PrimitiveElement.valueSet(«v.canonizeName»,«v.valueSetted»); «hasValueExpressionByRef(typeReference,v,v.valueVariable)» check(!«v.valueSetted»||«v.valueVariable»==«target»));''' | 199 | '''PrimitiveElement.valueSet(«v.canonizeName»,«v.valueSetted»); «hasValueExpressionByRef(typeReference,v,v.valueVariable)» |
200 | ««« check(!«v.valueSetted»||«v.valueVariable»==«target»)); | ||
201 | ''' | ||
200 | } else { // Must or current | 202 | } else { // Must or current |
201 | '''PrimitiveElement.valueSet(«v.canonizeName»,true);«hasValueExpressionByRef(typeReference,v,target)»''' | 203 | '''PrimitiveElement.valueSet(«v.canonizeName»,true);«hasValueExpressionByRef(typeReference,v,target)»''' |
202 | } | 204 | } |
@@ -233,13 +235,13 @@ class PConstraintTransformer { | |||
233 | «FOR variable: e.affectedVariables» | 235 | «FOR variable: e.affectedVariables» |
234 | PrimitiveElement.valueSet(«variable.canonizeName»,«variable.valueSetted»); «hasValueExpression(variableMapping,variable,variable.valueVariable)» | 236 | PrimitiveElement.valueSet(«variable.canonizeName»,«variable.valueSetted»); «hasValueExpression(variableMapping,variable,variable.valueVariable)» |
235 | «ENDFOR» | 237 | «ENDFOR» |
236 | check( | 238 | ««« check( |
237 | «FOR variable: e.affectedVariables SEPARATOR " || "»!«variable.valueSetted»«ENDFOR» | 239 | ««« «FOR variable: e.affectedVariables SEPARATOR " || "»!«variable.valueSetted»«ENDFOR» |
238 | ««« «IF variable2Type.values.filter(RealTypeReference).empty» | 240 | ««« «IF variable2Type.values.filter(RealTypeReference).empty» |
239 | ««« || | 241 | ««« || |
240 | ««« («expressionGenerator.translateExpression(expression,e.affectedVariables.toInvertedMap[valueVariable],variable2Type)») | 242 | ««« («expressionGenerator.translateExpression(expression,e.affectedVariables.toInvertedMap[valueVariable],variable2Type)») |
241 | ««« «ENDIF» | 243 | ««« «ENDIF» |
242 | ); | 244 | ««« ); |
243 | ''' | 245 | ''' |
244 | } else { // Must or Current | 246 | } else { // Must or Current |
245 | return ''' | 247 | return ''' |
@@ -263,7 +265,7 @@ class PConstraintTransformer { | |||
263 | «FOR variable: e.affectedVariables» | 265 | «FOR variable: e.affectedVariables» |
264 | PrimitiveElement.valueSet(«variable.canonizeName»,«variable.valueSetted»); «hasValueExpression(variableMapping,variable,variable.valueVariable)» | 266 | PrimitiveElement.valueSet(«variable.canonizeName»,«variable.valueSetted»); «hasValueExpression(variableMapping,variable,variable.valueVariable)» |
265 | «ENDFOR» | 267 | «ENDFOR» |
266 | check(«FOR variable: e.affectedVariables SEPARATOR " || "»!«variable.valueSetted»«ENDFOR»); | 268 | ««« check(«FOR variable: e.affectedVariables SEPARATOR " || "»!«variable.valueSetted»«ENDFOR»); |
267 | ''' | 269 | ''' |
268 | } | 270 | } |
269 | 271 | ||
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend index cfea499b..f3de4ccc 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend | |||
@@ -27,8 +27,8 @@ import java.util.HashMap | |||
27 | @Data class GeneratedPatterns { | 27 | @Data class GeneratedPatterns { |
28 | public Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> invalidWFQueries | 28 | public Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> invalidWFQueries |
29 | public Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> unfinishedWFQueries | 29 | public Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> unfinishedWFQueries |
30 | public Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> unfinishedContainmentMulticiplicityQueries | 30 | public Map<Relation, Pair<IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>,Integer>> unfinishedContainmentMulticiplicityQueries |
31 | public Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> unfinishedNonContainmentMulticiplicityQueries | 31 | public Map<Relation, Pair<IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>,Integer>> unfinishedNonContainmentMulticiplicityQueries |
32 | public Map<ObjectCreationPrecondition, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refineObjectQueries | 32 | public Map<ObjectCreationPrecondition, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refineObjectQueries |
33 | public Map<? extends Type, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refineTypeQueries | 33 | public Map<? extends Type, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refineTypeQueries |
34 | public Map<Pair<RelationDeclaration, Relation>, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refinerelationQueries | 34 | public Map<Pair<RelationDeclaration, Relation>, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> refinerelationQueries |
@@ -93,11 +93,13 @@ class PatternProvider { | |||
93 | val unfinishedNonContainmentMultiplicities = new HashMap | 93 | val unfinishedNonContainmentMultiplicities = new HashMap |
94 | for(entry : unfinishedMultiplicities.entrySet) { | 94 | for(entry : unfinishedMultiplicities.entrySet) { |
95 | val relation = entry.key | 95 | val relation = entry.key |
96 | val value = entry.value.lookup(queries) | 96 | val name = entry.value.key |
97 | val amount = entry.value.value | ||
98 | val query = name.lookup(queries) | ||
97 | if(problem.containmentHierarchies.head.containmentRelations.contains(relation)) { | 99 | if(problem.containmentHierarchies.head.containmentRelations.contains(relation)) { |
98 | unfinishedContainmentMultiplicities.put(relation,value) | 100 | unfinishedContainmentMultiplicities.put(relation,query->amount) |
99 | } else { | 101 | } else { |
100 | unfinishedNonContainmentMultiplicities.put(relation,value) | 102 | unfinishedNonContainmentMultiplicities.put(relation,query->amount) |
101 | } | 103 | } |
102 | } | 104 | } |
103 | // val Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> | 105 | // val Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDeclarationIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDeclarationIndexer.xtend index f384cd50..cef707c5 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDeclarationIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/RelationDeclarationIndexer.xtend | |||
@@ -90,13 +90,13 @@ class RelationDeclarationIndexer { | |||
90 | // There are "numberOfExistingReferences" currently existing instances of the reference from the source, | 90 | // There are "numberOfExistingReferences" currently existing instances of the reference from the source, |
91 | // the upper bound of the multiplicity should be considered. | 91 | // the upper bound of the multiplicity should be considered. |
92 | numberOfExistingReferences == count «referRelation(relation,"source","_",Modality.MUST)» | 92 | numberOfExistingReferences == count «referRelation(relation,"source","_",Modality.MUST)» |
93 | check(numberOfExistingReferences < «upperMultiplicities.get(relation)»); | 93 | numberOfExistingReferences != «upperMultiplicities.get(relation)»; |
94 | «ENDIF» | 94 | «ENDIF» |
95 | «IF inverseRelations.containsKey(relation) && upperMultiplicities.containsKey(inverseRelations.get(relation))» | 95 | «IF inverseRelations.containsKey(relation) && upperMultiplicities.containsKey(inverseRelations.get(relation))» |
96 | // There are "numberOfExistingReferences" currently existing instances of the reference to the target, | 96 | // There are "numberOfExistingReferences" currently existing instances of the reference to the target, |
97 | // the upper bound of the opposite reference multiplicity should be considered. | 97 | // the upper bound of the opposite reference multiplicity should be considered. |
98 | numberOfExistingOppositeReferences == count «base.referRelation(inverseRelations.get(relation),"target","_",Modality.MUST,fqn2PQuery)» | 98 | numberOfExistingOppositeReferences == count «base.referRelation(inverseRelations.get(relation),"target","_",Modality.MUST,fqn2PQuery)» |
99 | check(numberOfExistingOppositeReferences < «upperMultiplicities.get(inverseRelations.get(relation))»); | 99 | numberOfExistingOppositeReferences != «upperMultiplicities.get(inverseRelations.get(relation))»; |
100 | «ENDIF» | 100 | «ENDIF» |
101 | «IF containments.contains(relation)» | 101 | «IF containments.contains(relation)» |
102 | // The reference is containment, then a new reference cannot be create if: | 102 | // The reference is containment, then a new reference cannot be create if: |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend index ad1c9033..1df402fa 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend | |||
@@ -46,14 +46,14 @@ class UnfinishedIndexer { | |||
46 | val lowerMultiplicities = base.lowerMultiplicities(problem) | 46 | val lowerMultiplicities = base.lowerMultiplicities(problem) |
47 | return ''' | 47 | return ''' |
48 | «FOR lowerMultiplicity : lowerMultiplicities» | 48 | «FOR lowerMultiplicity : lowerMultiplicities» |
49 | pattern «unfinishedMultiplicityName(lowerMultiplicity)»(problem:LogicProblem, interpretation:PartialInterpretation, relationIterpretation:PartialRelationInterpretation, object:DefinedElement,missingMultiplicity) { | 49 | pattern «unfinishedMultiplicityName(lowerMultiplicity)»(problem:LogicProblem, interpretation:PartialInterpretation, relationIterpretation:PartialRelationInterpretation, object:DefinedElement,numberOfExistingReferences) { |
50 | find interpretation(problem,interpretation); | 50 | find interpretation(problem,interpretation); |
51 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); | 51 | PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); |
52 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"«lowerMultiplicity.relation.name»"); | 52 | PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"«lowerMultiplicity.relation.name»"); |
53 | «base.typeIndexer.referInstanceOf(lowerMultiplicity.firstParamTypeOfRelation,Modality::MUST,"object")» | 53 | «base.typeIndexer.referInstanceOf(lowerMultiplicity.firstParamTypeOfRelation,Modality::MUST,"object")» |
54 | numberOfExistingReferences == count «base.referRelation(lowerMultiplicity.relation,"object","_",Modality.MUST,fqn2PQuery)» | 54 | numberOfExistingReferences == count «base.referRelation(lowerMultiplicity.relation,"object","_",Modality.MUST,fqn2PQuery)» |
55 | check(numberOfExistingReferences < «lowerMultiplicity.lower»); | 55 | ««« numberOfExistingReferences < «lowerMultiplicity.lower»; |
56 | missingMultiplicity == eval(«lowerMultiplicity.lower»-numberOfExistingReferences); | 56 | ««« missingMultiplicity == eval(«lowerMultiplicity.lower»-numberOfExistingReferences); |
57 | } | 57 | } |
58 | «ENDFOR» | 58 | «ENDFOR» |
59 | ''' | 59 | ''' |
@@ -61,8 +61,8 @@ class UnfinishedIndexer { | |||
61 | def String unfinishedMultiplicityName(LowerMultiplicityAssertion lowerMultiplicityAssertion) | 61 | def String unfinishedMultiplicityName(LowerMultiplicityAssertion lowerMultiplicityAssertion) |
62 | '''unfinishedLowerMultiplicity_«base.canonizeName(lowerMultiplicityAssertion.relation.name)»''' | 62 | '''unfinishedLowerMultiplicity_«base.canonizeName(lowerMultiplicityAssertion.relation.name)»''' |
63 | 63 | ||
64 | def public referUnfinishedMultiplicityQuery(LowerMultiplicityAssertion lowerMultiplicityAssertion) | 64 | //def public referUnfinishedMultiplicityQuery(LowerMultiplicityAssertion lowerMultiplicityAssertion) |
65 | '''find «unfinishedMultiplicityName(lowerMultiplicityAssertion)»(problem, interpretation ,object, missingMultiplicity);''' | 65 | // '''find «unfinishedMultiplicityName(lowerMultiplicityAssertion)»(problem, interpretation ,object, missingMultiplicity);''' |
66 | 66 | ||
67 | def getFirstParamTypeOfRelation(LowerMultiplicityAssertion lowerMultiplicityAssertion) { | 67 | def getFirstParamTypeOfRelation(LowerMultiplicityAssertion lowerMultiplicityAssertion) { |
68 | val parameters = lowerMultiplicityAssertion.relation.parameters | 68 | val parameters = lowerMultiplicityAssertion.relation.parameters |
@@ -78,7 +78,7 @@ class UnfinishedIndexer { | |||
78 | val lowerMultiplicities = base.lowerMultiplicities(problem) | 78 | val lowerMultiplicities = base.lowerMultiplicities(problem) |
79 | val map = new LinkedHashMap | 79 | val map = new LinkedHashMap |
80 | for(lowerMultiplicity : lowerMultiplicities) { | 80 | for(lowerMultiplicity : lowerMultiplicities) { |
81 | map.put(lowerMultiplicity.relation,unfinishedMultiplicityName(lowerMultiplicity)) | 81 | map.put(lowerMultiplicity.relation,unfinishedMultiplicityName(lowerMultiplicity)->lowerMultiplicity.lower) |
82 | } | 82 | } |
83 | return map | 83 | return map |
84 | } | 84 | } |