aboutsummaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/.gitignore2
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._tracebin632 -> 632 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.MemberIsItsOwnParent.java._tracebin3544 -> 3540 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.gitignore8
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/errors.txt32
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generation.logicproblem680
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/init.partialmodel102
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/log.txt2
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/plugin.xml20
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.FamilyTreeConstraints.java._tracebin632 -> 632 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.MemberIsItsOwnParent.java._tracebin3544 -> 3540 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/FamilyTreeConstraints.java172
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberHasParent.java1102
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberIsItsOwnParent.java1154
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/ParentTooYoung.java1550
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/TwoMembersHaveNoParent.java1446
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.run/plugin.xml84
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbinbin12374 -> 12374 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java628
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml2
20 files changed, 3495 insertions, 3489 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/.gitignore
deleted file mode 100644
index 3d70f0da..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
1/queries/
2/run/
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._trace b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._trace
index 12849bfe..ab0f3a9a 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._trace
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._trace
Binary files differ
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.MemberIsItsOwnParent.java._trace b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.MemberIsItsOwnParent.java._trace
index 1b0dca98..aaf4d0c2 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.MemberIsItsOwnParent.java._trace
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.MemberIsItsOwnParent.java._trace
Binary files differ
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.gitignore
new file mode 100644
index 00000000..3be531f5
--- /dev/null
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.gitignore
@@ -0,0 +1,8 @@
1/.FamilyTreeConstraints.java._trace
2/.MemberIsItsOwnParent.java._trace
3/FamilyTreeConstraints.java
4/MemberIsItsOwnParent.java
5/.ParentTooYoung.java._trace
6/.MemberHasNoParent.java._trace
7/.MemberHasParent.java._trace
8/.TwoMembersHaveNoParent.java._trace
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/errors.txt b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/errors.txt
index b7eed629..637be9c5 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/errors.txt
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/errors.txt
@@ -1,16 +1,16 @@
1Error occured (NullPointerException): 1Error occured (NullPointerException):
2 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PConstraintTransformer.hasValueExpression(PConstraintTransformer.java:487) 2 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PConstraintTransformer.hasValueExpression(PConstraintTransformer.java:487)
3 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PConstraintTransformer._transformConstraint(PConstraintTransformer.java:614) 3 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PConstraintTransformer._transformConstraint(PConstraintTransformer.java:614)
4 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PConstraintTransformer.transformConstraint(PConstraintTransformer.java:689) 4 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PConstraintTransformer.transformConstraint(PConstraintTransformer.java:689)
5 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.RelationDefinitionIndexer.transformPattern(RelationDefinitionIndexer.java:169) 5 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.RelationDefinitionIndexer.transformPattern(RelationDefinitionIndexer.java:169)
6 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.RelationDefinitionIndexer.generateRelationDefinitions(RelationDefinitionIndexer.java:51) 6 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.RelationDefinitionIndexer.generateRelationDefinitions(RelationDefinitionIndexer.java:51)
7 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator.transformBaseProperties(PatternGenerator.java:747) 7 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator.transformBaseProperties(PatternGenerator.java:747)
8 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternProvider.generateQueries(PatternProvider.java:59) 8 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternProvider.generateQueries(PatternProvider.java:59)
9 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethodProvider.createModelGenerationMethod(ModelGenerationMethodProvider.java:57) 9 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethodProvider.createModelGenerationMethod(ModelGenerationMethodProvider.java:57)
10 hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner.solve(ViatraReasoner.java:96) 10 hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner.solve(ViatraReasoner.java:96)
11 hu.bme.mit.inf.dslreasoner.application.execution.GenerationTaskExecutor.executeGenerationTask(GenerationTaskExecutor.java:316) 11 hu.bme.mit.inf.dslreasoner.application.execution.GenerationTaskExecutor.executeGenerationTask(GenerationTaskExecutor.java:316)
12 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor._execute(ScriptExecutor.java:129) 12 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor._execute(ScriptExecutor.java:129)
13 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.execute(ScriptExecutor.java:338) 13 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.execute(ScriptExecutor.java:338)
14 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.executeScript(ScriptExecutor.java:110) 14 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.executeScript(ScriptExecutor.java:110)
15 hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor.executeScript(StandaloneScriptExecutor.java:149) 15 hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor.executeScript(StandaloneScriptExecutor.java:149)
16 run.FamilyTreeGen.main(FamilyTreeGen.java:7) 16 run.FamilyTreeGen.main(FamilyTreeGen.java:7)
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generation.logicproblem b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generation.logicproblem
index 327ce8b0..d15360ce 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generation.logicproblem
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generation.logicproblem
@@ -1,340 +1,340 @@
1<?xml version="1.0" encoding="ASCII"?> 1<?xml version="1.0" encoding="ASCII"?>
2<language:LogicProblem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore2logicannotations="http://www.bme.hu/mit/inf/dslreasoner/logic/model/language/ecore2logicannotation" xmlns:language="http://www.bme.hu/mit/inf/dslreasoner/logic/model/problem" xmlns:language_1="http://www.bme.hu/mit/inf/dslreasoner/logic/model/language" xmlns:viatra2logicannotations="http://www.bme.hu/mit/inf/dslreasoner/logic/model/language/viatra2logicannotation"> 2<language:LogicProblem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore2logicannotations="http://www.bme.hu/mit/inf/dslreasoner/logic/model/language/ecore2logicannotation" xmlns:language="http://www.bme.hu/mit/inf/dslreasoner/logic/model/problem" xmlns:language_1="http://www.bme.hu/mit/inf/dslreasoner/logic/model/language" xmlns:viatra2logicannotations="http://www.bme.hu/mit/inf/dslreasoner/logic/model/language/viatra2logicannotation">
3 <types xsi:type="language_1:TypeDeclaration" name="FamilyTree class"/> 3 <types xsi:type="language_1:TypeDeclaration" name="FamilyTree class"/>
4 <types xsi:type="language_1:TypeDeclaration" name="Member class"/> 4 <types xsi:type="language_1:TypeDeclaration" name="Member class"/>
5 <assertions name="upperMultiplicity parents Member" annotations="//@annotations.0"> 5 <assertions name="upperMultiplicity parents Member" annotations="//@annotations.0">
6 <value xsi:type="language_1:Forall"> 6 <value xsi:type="language_1:Forall">
7 <quantifiedVariables name="src"> 7 <quantifiedVariables name="src">
8 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 8 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
9 </quantifiedVariables> 9 </quantifiedVariables>
10 <quantifiedVariables name="trg 1"> 10 <quantifiedVariables name="trg 1">
11 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 11 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
12 </quantifiedVariables> 12 </quantifiedVariables>
13 <quantifiedVariables name="trg 2"> 13 <quantifiedVariables name="trg 2">
14 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 14 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
15 </quantifiedVariables> 15 </quantifiedVariables>
16 <quantifiedVariables name="trg 3"> 16 <quantifiedVariables name="trg 3">
17 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 17 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
18 </quantifiedVariables> 18 </quantifiedVariables>
19 <expression xsi:type="language_1:Impl"> 19 <expression xsi:type="language_1:Impl">
20 <leftOperand xsi:type="language_1:And"> 20 <leftOperand xsi:type="language_1:And">
21 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2"> 21 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
22 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.0"/> 22 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.0"/>
23 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.1"/> 23 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.1"/>
24 </operands> 24 </operands>
25 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2"> 25 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
26 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.0"/> 26 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.0"/>
27 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.2"/> 27 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.2"/>
28 </operands> 28 </operands>
29 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2"> 29 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
30 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.0"/> 30 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.0"/>
31 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.3"/> 31 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.3"/>
32 </operands> 32 </operands>
33 </leftOperand> 33 </leftOperand>
34 <rightOperand xsi:type="language_1:Not"> 34 <rightOperand xsi:type="language_1:Not">
35 <operand xsi:type="language_1:Distinct"> 35 <operand xsi:type="language_1:Distinct">
36 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.1"/> 36 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.1"/>
37 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.2"/> 37 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.2"/>
38 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.3"/> 38 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.3"/>
39 </operand> 39 </operand>
40 </rightOperand> 40 </rightOperand>
41 </expression> 41 </expression>
42 </value> 42 </value>
43 </assertions> 43 </assertions>
44 <assertions name="oppositeReference children Member" annotations="//@annotations.1"> 44 <assertions name="oppositeReference children Member" annotations="//@annotations.1">
45 <value xsi:type="language_1:Forall"> 45 <value xsi:type="language_1:Forall">
46 <quantifiedVariables name="src"> 46 <quantifiedVariables name="src">
47 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 47 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
48 </quantifiedVariables> 48 </quantifiedVariables>
49 <quantifiedVariables name="trg"> 49 <quantifiedVariables name="trg">
50 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 50 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
51 </quantifiedVariables> 51 </quantifiedVariables>
52 <expression xsi:type="language_1:Iff"> 52 <expression xsi:type="language_1:Iff">
53 <leftOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.1"> 53 <leftOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.1">
54 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.1/@value/@quantifiedVariables.0"/> 54 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.1/@value/@quantifiedVariables.0"/>
55 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.1/@value/@quantifiedVariables.1"/> 55 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.1/@value/@quantifiedVariables.1"/>
56 </leftOperand> 56 </leftOperand>
57 <rightOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2"> 57 <rightOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
58 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.1/@value/@quantifiedVariables.1"/> 58 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.1/@value/@quantifiedVariables.1"/>
59 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.1/@value/@quantifiedVariables.0"/> 59 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.1/@value/@quantifiedVariables.0"/>
60 </rightOperand> 60 </rightOperand>
61 </expression> 61 </expression>
62 </value> 62 </value>
63 </assertions> 63 </assertions>
64 <assertions name="upperMultiplicity name Member" annotations="//@annotations.2"> 64 <assertions name="upperMultiplicity name Member" annotations="//@annotations.2">
65 <value xsi:type="language_1:Forall"> 65 <value xsi:type="language_1:Forall">
66 <quantifiedVariables name="src"> 66 <quantifiedVariables name="src">
67 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 67 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
68 </quantifiedVariables> 68 </quantifiedVariables>
69 <quantifiedVariables name="trg 1"> 69 <quantifiedVariables name="trg 1">
70 <range xsi:type="language_1:StringTypeReference"/> 70 <range xsi:type="language_1:StringTypeReference"/>
71 </quantifiedVariables> 71 </quantifiedVariables>
72 <quantifiedVariables name="trg 2"> 72 <quantifiedVariables name="trg 2">
73 <range xsi:type="language_1:StringTypeReference"/> 73 <range xsi:type="language_1:StringTypeReference"/>
74 </quantifiedVariables> 74 </quantifiedVariables>
75 <expression xsi:type="language_1:Impl"> 75 <expression xsi:type="language_1:Impl">
76 <leftOperand xsi:type="language_1:And"> 76 <leftOperand xsi:type="language_1:And">
77 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.3"> 77 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.3">
78 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.0"/> 78 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.0"/>
79 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.1"/> 79 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.1"/>
80 </operands> 80 </operands>
81 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.3"> 81 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.3">
82 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.0"/> 82 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.0"/>
83 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.2"/> 83 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.2"/>
84 </operands> 84 </operands>
85 </leftOperand> 85 </leftOperand>
86 <rightOperand xsi:type="language_1:Not"> 86 <rightOperand xsi:type="language_1:Not">
87 <operand xsi:type="language_1:Distinct"> 87 <operand xsi:type="language_1:Distinct">
88 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.1"/> 88 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.1"/>
89 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.2"/> 89 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.2/@value/@quantifiedVariables.2"/>
90 </operand> 90 </operand>
91 </rightOperand> 91 </rightOperand>
92 </expression> 92 </expression>
93 </value> 93 </value>
94 </assertions> 94 </assertions>
95 <assertions name="upperMultiplicity age Member" annotations="//@annotations.3"> 95 <assertions name="upperMultiplicity age Member" annotations="//@annotations.3">
96 <value xsi:type="language_1:Forall"> 96 <value xsi:type="language_1:Forall">
97 <quantifiedVariables name="src"> 97 <quantifiedVariables name="src">
98 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 98 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
99 </quantifiedVariables> 99 </quantifiedVariables>
100 <quantifiedVariables name="trg 1"> 100 <quantifiedVariables name="trg 1">
101 <range xsi:type="language_1:IntTypeReference"/> 101 <range xsi:type="language_1:IntTypeReference"/>
102 </quantifiedVariables> 102 </quantifiedVariables>
103 <quantifiedVariables name="trg 2"> 103 <quantifiedVariables name="trg 2">
104 <range xsi:type="language_1:IntTypeReference"/> 104 <range xsi:type="language_1:IntTypeReference"/>
105 </quantifiedVariables> 105 </quantifiedVariables>
106 <expression xsi:type="language_1:Impl"> 106 <expression xsi:type="language_1:Impl">
107 <leftOperand xsi:type="language_1:And"> 107 <leftOperand xsi:type="language_1:And">
108 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4"> 108 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4">
109 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.0"/> 109 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.0"/>
110 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.1"/> 110 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.1"/>
111 </operands> 111 </operands>
112 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4"> 112 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4">
113 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.0"/> 113 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.0"/>
114 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.2"/> 114 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.2"/>
115 </operands> 115 </operands>
116 </leftOperand> 116 </leftOperand>
117 <rightOperand xsi:type="language_1:Not"> 117 <rightOperand xsi:type="language_1:Not">
118 <operand xsi:type="language_1:Distinct"> 118 <operand xsi:type="language_1:Distinct">
119 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.1"/> 119 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.1"/>
120 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.2"/> 120 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.3/@value/@quantifiedVariables.2"/>
121 </operand> 121 </operand>
122 </rightOperand> 122 </rightOperand>
123 </expression> 123 </expression>
124 </value> 124 </value>
125 </assertions> 125 </assertions>
126 <assertions name="errorpattern queries memberIsItsOwnParent" annotations="//@annotations.8"> 126 <assertions name="errorpattern queries memberIsItsOwnParent" annotations="//@annotations.8">
127 <value xsi:type="language_1:Forall"> 127 <value xsi:type="language_1:Forall">
128 <quantifiedVariables name="p0"> 128 <quantifiedVariables name="p0">
129 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 129 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
130 </quantifiedVariables> 130 </quantifiedVariables>
131 <expression xsi:type="language_1:Not"> 131 <expression xsi:type="language_1:Not">
132 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5"> 132 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5">
133 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.4/@value/@quantifiedVariables.0"/> 133 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.4/@value/@quantifiedVariables.0"/>
134 </operand> 134 </operand>
135 </expression> 135 </expression>
136 </value> 136 </value>
137 </assertions> 137 </assertions>
138 <assertions name="errorpattern queries twoMembersHaveNoParent" annotations="//@annotations.9"> 138 <assertions name="errorpattern queries twoMembersHaveNoParent" annotations="//@annotations.9">
139 <value xsi:type="language_1:Forall"> 139 <value xsi:type="language_1:Forall">
140 <quantifiedVariables name="p0"> 140 <quantifiedVariables name="p0">
141 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 141 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
142 </quantifiedVariables> 142 </quantifiedVariables>
143 <quantifiedVariables name="p1"> 143 <quantifiedVariables name="p1">
144 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 144 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
145 </quantifiedVariables> 145 </quantifiedVariables>
146 <expression xsi:type="language_1:Not"> 146 <expression xsi:type="language_1:Not">
147 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6"> 147 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6">
148 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.5/@value/@quantifiedVariables.0"/> 148 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.5/@value/@quantifiedVariables.0"/>
149 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.5/@value/@quantifiedVariables.1"/> 149 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.5/@value/@quantifiedVariables.1"/>
150 </operand> 150 </operand>
151 </expression> 151 </expression>
152 </value> 152 </value>
153 </assertions> 153 </assertions>
154 <assertions name="errorpattern queries parentTooYoung" annotations="//@annotations.10"> 154 <assertions name="errorpattern queries parentTooYoung" annotations="//@annotations.10">
155 <value xsi:type="language_1:Forall"> 155 <value xsi:type="language_1:Forall">
156 <quantifiedVariables name="p0"> 156 <quantifiedVariables name="p0">
157 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 157 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
158 </quantifiedVariables> 158 </quantifiedVariables>
159 <quantifiedVariables name="p1"> 159 <quantifiedVariables name="p1">
160 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 160 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
161 </quantifiedVariables> 161 </quantifiedVariables>
162 <expression xsi:type="language_1:Not"> 162 <expression xsi:type="language_1:Not">
163 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8"> 163 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8">
164 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.6/@value/@quantifiedVariables.0"/> 164 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.6/@value/@quantifiedVariables.0"/>
165 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.6/@value/@quantifiedVariables.1"/> 165 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.6/@value/@quantifiedVariables.1"/>
166 </operand> 166 </operand>
167 </expression> 167 </expression>
168 </value> 168 </value>
169 </assertions> 169 </assertions>
170 <relations xsi:type="language_1:RelationDeclaration" name="members reference FamilyTree"> 170 <relations xsi:type="language_1:RelationDeclaration" name="members reference FamilyTree">
171 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.0"/> 171 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.0"/>
172 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 172 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
173 </relations> 173 </relations>
174 <relations xsi:type="language_1:RelationDeclaration" name="children reference Member"> 174 <relations xsi:type="language_1:RelationDeclaration" name="children reference Member">
175 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 175 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
176 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 176 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
177 </relations> 177 </relations>
178 <relations xsi:type="language_1:RelationDeclaration" name="parents reference Member"> 178 <relations xsi:type="language_1:RelationDeclaration" name="parents reference Member">
179 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 179 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
180 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 180 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
181 </relations> 181 </relations>
182 <relations xsi:type="language_1:RelationDeclaration" name="name attribute Member"> 182 <relations xsi:type="language_1:RelationDeclaration" name="name attribute Member">
183 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 183 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
184 <parameters xsi:type="language_1:StringTypeReference"/> 184 <parameters xsi:type="language_1:StringTypeReference"/>
185 </relations> 185 </relations>
186 <relations xsi:type="language_1:RelationDeclaration" name="age attribute Member"> 186 <relations xsi:type="language_1:RelationDeclaration" name="age attribute Member">
187 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 187 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
188 <parameters xsi:type="language_1:IntTypeReference"/> 188 <parameters xsi:type="language_1:IntTypeReference"/>
189 </relations> 189 </relations>
190 <relations xsi:type="language_1:RelationDefinition" name="pattern queries memberIsItsOwnParent" annotations="//@annotations.4"> 190 <relations xsi:type="language_1:RelationDefinition" name="pattern queries memberIsItsOwnParent" annotations="//@annotations.4">
191 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 191 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
192 <variables name="parameter m"> 192 <variables name="parameter m">
193 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 193 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
194 </variables> 194 </variables>
195 <value xsi:type="language_1:Or"> 195 <value xsi:type="language_1:Or">
196 <operands xsi:type="language_1:Exists"> 196 <operands xsi:type="language_1:Exists">
197 <quantifiedVariables name="variable 0"> 197 <quantifiedVariables name="variable 0">
198 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.0"/> 198 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.0"/>
199 </quantifiedVariables> 199 </quantifiedVariables>
200 <expression xsi:type="language_1:And"> 200 <expression xsi:type="language_1:And">
201 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.0"> 201 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.0">
202 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5/@value/@operands.0/@quantifiedVariables.0"/> 202 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5/@value/@operands.0/@quantifiedVariables.0"/>
203 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5/@variables.0"/> 203 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5/@variables.0"/>
204 </operands> 204 </operands>
205 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2"> 205 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
206 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5/@variables.0"/> 206 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5/@variables.0"/>
207 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5/@variables.0"/> 207 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5/@variables.0"/>
208 </operands> 208 </operands>
209 </expression> 209 </expression>
210 </operands> 210 </operands>
211 </value> 211 </value>
212 </relations> 212 </relations>
213 <relations xsi:type="language_1:RelationDefinition" name="pattern queries twoMembersHaveNoParent" annotations="//@annotations.5"> 213 <relations xsi:type="language_1:RelationDefinition" name="pattern queries twoMembersHaveNoParent" annotations="//@annotations.5">
214 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 214 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
215 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 215 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
216 <variables name="parameter m1"> 216 <variables name="parameter m1">
217 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 217 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
218 </variables> 218 </variables>
219 <variables name="parameter m2"> 219 <variables name="parameter m2">
220 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 220 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
221 </variables> 221 </variables>
222 <value xsi:type="language_1:Or"> 222 <value xsi:type="language_1:Or">
223 <operands xsi:type="language_1:And"> 223 <operands xsi:type="language_1:And">
224 <operands xsi:type="language_1:InstanceOf"> 224 <operands xsi:type="language_1:InstanceOf">
225 <value xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.0"/> 225 <value xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.0"/>
226 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 226 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
227 </operands> 227 </operands>
228 <operands xsi:type="language_1:InstanceOf"> 228 <operands xsi:type="language_1:InstanceOf">
229 <value xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.1"/> 229 <value xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.1"/>
230 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 230 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
231 </operands> 231 </operands>
232 <operands xsi:type="language_1:Not"> 232 <operands xsi:type="language_1:Not">
233 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7"> 233 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7">
234 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.0"/> 234 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.0"/>
235 </operand> 235 </operand>
236 </operands> 236 </operands>
237 <operands xsi:type="language_1:Not"> 237 <operands xsi:type="language_1:Not">
238 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7"> 238 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7">
239 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.1"/> 239 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.1"/>
240 </operand> 240 </operand>
241 </operands> 241 </operands>
242 <operands xsi:type="language_1:Distinct"> 242 <operands xsi:type="language_1:Distinct">
243 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.0"/> 243 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.0"/>
244 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.1"/> 244 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.1"/>
245 </operands> 245 </operands>
246 </operands> 246 </operands>
247 </value> 247 </value>
248 </relations> 248 </relations>
249 <relations xsi:type="language_1:RelationDefinition" name="pattern queries memberHasParent" annotations="//@annotations.6"> 249 <relations xsi:type="language_1:RelationDefinition" name="pattern queries memberHasParent" annotations="//@annotations.6">
250 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 250 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
251 <variables name="parameter m"> 251 <variables name="parameter m">
252 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 252 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
253 </variables> 253 </variables>
254 <value xsi:type="language_1:Or"> 254 <value xsi:type="language_1:Or">
255 <operands xsi:type="language_1:Exists"> 255 <operands xsi:type="language_1:Exists">
256 <quantifiedVariables name="variable 0"> 256 <quantifiedVariables name="variable 0">
257 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 257 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
258 </quantifiedVariables> 258 </quantifiedVariables>
259 <expression xsi:type="language_1:And"> 259 <expression xsi:type="language_1:And">
260 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2"> 260 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
261 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7/@variables.0"/> 261 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7/@variables.0"/>
262 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7/@value/@operands.0/@quantifiedVariables.0"/> 262 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7/@value/@operands.0/@quantifiedVariables.0"/>
263 </operands> 263 </operands>
264 <operands xsi:type="language_1:InstanceOf"> 264 <operands xsi:type="language_1:InstanceOf">
265 <value xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7/@value/@operands.0/@quantifiedVariables.0"/> 265 <value xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7/@value/@operands.0/@quantifiedVariables.0"/>
266 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 266 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
267 </operands> 267 </operands>
268 </expression> 268 </expression>
269 </operands> 269 </operands>
270 </value> 270 </value>
271 </relations> 271 </relations>
272 <relations xsi:type="language_1:RelationDefinition" name="pattern queries parentTooYoung" annotations="//@annotations.7"> 272 <relations xsi:type="language_1:RelationDefinition" name="pattern queries parentTooYoung" annotations="//@annotations.7">
273 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 273 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
274 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 274 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
275 <variables name="parameter m"> 275 <variables name="parameter m">
276 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 276 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
277 </variables> 277 </variables>
278 <variables name="parameter p"> 278 <variables name="parameter p">
279 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/> 279 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
280 </variables> 280 </variables>
281 <value xsi:type="language_1:Or"> 281 <value xsi:type="language_1:Or">
282 <operands xsi:type="language_1:Exists"> 282 <operands xsi:type="language_1:Exists">
283 <quantifiedVariables name="variable 0"> 283 <quantifiedVariables name="variable 0">
284 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.0"/> 284 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.0"/>
285 </quantifiedVariables> 285 </quantifiedVariables>
286 <quantifiedVariables name="variable mAge"> 286 <quantifiedVariables name="variable mAge">
287 <range xsi:type="language_1:IntTypeReference"/> 287 <range xsi:type="language_1:IntTypeReference"/>
288 </quantifiedVariables> 288 </quantifiedVariables>
289 <quantifiedVariables name="variable pAge"> 289 <quantifiedVariables name="variable pAge">
290 <range xsi:type="language_1:IntTypeReference"/> 290 <range xsi:type="language_1:IntTypeReference"/>
291 </quantifiedVariables> 291 </quantifiedVariables>
292 <expression xsi:type="language_1:And"> 292 <expression xsi:type="language_1:And">
293 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.0"> 293 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.0">
294 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.0"/> 294 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.0"/>
295 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.0"/> 295 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.0"/>
296 </operands> 296 </operands>
297 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2"> 297 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
298 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.0"/> 298 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.0"/>
299 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.1"/> 299 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.1"/>
300 </operands> 300 </operands>
301 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4"> 301 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4">
302 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.0"/> 302 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.0"/>
303 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.1"/> 303 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.1"/>
304 </operands> 304 </operands>
305 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4"> 305 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4">
306 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.1"/> 306 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.1"/>
307 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.2"/> 307 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.2"/>
308 </operands> 308 </operands>
309 <operands xsi:type="language_1:LessOrEqualThan"> 309 <operands xsi:type="language_1:LessOrEqualThan">
310 <leftOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.1"/> 310 <leftOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.1"/>
311 <rightOperand xsi:type="language_1:Plus"> 311 <rightOperand xsi:type="language_1:Plus">
312 <leftOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.2"/> 312 <leftOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.2"/>
313 <rightOperand xsi:type="language_1:IntLiteral" value="12"/> 313 <rightOperand xsi:type="language_1:IntLiteral" value="12"/>
314 </rightOperand> 314 </rightOperand>
315 </operands> 315 </operands>
316 </expression> 316 </expression>
317 </operands> 317 </operands>
318 </value> 318 </value>
319 </relations> 319 </relations>
320 <containmentHierarchies typesOrderedInHierarchy="//@types.1 //@types.0" containmentRelations="//@relations.0"/> 320 <containmentHierarchies typesOrderedInHierarchy="//@types.0 //@types.1" containmentRelations="//@relations.0"/>
321 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.0" relation="//@relations.2" upper="2"/> 321 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.0" relation="//@relations.2" upper="2"/>
322 <annotations xsi:type="ecore2logicannotations:InverseRelationAssertion" target="//@assertions.1" inverseA="//@relations.1" inverseB="//@relations.2"/> 322 <annotations xsi:type="ecore2logicannotations:InverseRelationAssertion" target="//@assertions.1" inverseA="//@relations.1" inverseB="//@relations.2"/>
323 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.2" relation="//@relations.3" upper="1"/> 323 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.2" relation="//@relations.3" upper="1"/>
324 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.3" relation="//@relations.4" upper="1"/> 324 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.3" relation="//@relations.4" upper="1"/>
325 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.5" patternFullyQualifiedName="queries.memberIsItsOwnParent"> 325 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.5" patternFullyQualifiedName="queries.memberIsItsOwnParent">
326 <variableTrace targetLogicVariable="//@relations.5/@value/@operands.0/@quantifiedVariables.0"/> 326 <variableTrace targetLogicVariable="//@relations.5/@value/@operands.0/@quantifiedVariables.0"/>
327 </annotations> 327 </annotations>
328 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.6" patternFullyQualifiedName="queries.twoMembersHaveNoParent"/> 328 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.6" patternFullyQualifiedName="queries.twoMembersHaveNoParent"/>
329 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.7" patternFullyQualifiedName="queries.memberHasParent"> 329 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.7" patternFullyQualifiedName="queries.memberHasParent">
330 <variableTrace targetLogicVariable="//@relations.7/@value/@operands.0/@quantifiedVariables.0"/> 330 <variableTrace targetLogicVariable="//@relations.7/@value/@operands.0/@quantifiedVariables.0"/>
331 </annotations> 331 </annotations>
332 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.8" patternFullyQualifiedName="queries.parentTooYoung"> 332 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.8" patternFullyQualifiedName="queries.parentTooYoung">
333 <variableTrace targetLogicVariable="//@relations.8/@value/@operands.0/@quantifiedVariables.0"/> 333 <variableTrace targetLogicVariable="//@relations.8/@value/@operands.0/@quantifiedVariables.0"/>
334 <variableTrace targetLogicVariable="//@relations.8/@value/@operands.0/@quantifiedVariables.1"/> 334 <variableTrace targetLogicVariable="//@relations.8/@value/@operands.0/@quantifiedVariables.1"/>
335 <variableTrace targetLogicVariable="//@relations.8/@value/@operands.0/@quantifiedVariables.2"/> 335 <variableTrace targetLogicVariable="//@relations.8/@value/@operands.0/@quantifiedVariables.2"/>
336 </annotations> 336 </annotations>
337 <annotations xsi:type="viatra2logicannotations:TransformedViatraWellformednessConstraint" target="//@assertions.4" query="//@annotations.4"/> 337 <annotations xsi:type="viatra2logicannotations:TransformedViatraWellformednessConstraint" target="//@assertions.4" query="//@annotations.4"/>
338 <annotations xsi:type="viatra2logicannotations:TransformedViatraWellformednessConstraint" target="//@assertions.5" query="//@annotations.5"/> 338 <annotations xsi:type="viatra2logicannotations:TransformedViatraWellformednessConstraint" target="//@assertions.5" query="//@annotations.5"/>
339 <annotations xsi:type="viatra2logicannotations:TransformedViatraWellformednessConstraint" target="//@assertions.6" query="//@annotations.7"/> 339 <annotations xsi:type="viatra2logicannotations:TransformedViatraWellformednessConstraint" target="//@assertions.6" query="//@annotations.7"/>
340</language:LogicProblem> 340</language:LogicProblem>
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/init.partialmodel b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/init.partialmodel
index 949d6b64..df908518 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/init.partialmodel
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/init.partialmodel
@@ -1,51 +1,51 @@
1<?xml version="1.0" encoding="ASCII"?> 1<?xml version="1.0" encoding="ASCII"?>
2<partialinterpretation:PartialInterpretation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:language="http://www.bme.hu/mit/inf/dslreasoner/logic/model/language" xmlns:partialinterpretation="http://www.bme.hu/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage" minNewElements="6" maxNewElements="6"> 2<partialinterpretation:PartialInterpretation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:language="http://www.bme.hu/mit/inf/dslreasoner/logic/model/language" xmlns:partialinterpretation="http://www.bme.hu/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage" minNewElements="6" maxNewElements="6">
3 <problem href="outputs/debug/generation.logicproblem#/"/> 3 <problem href="outputs/debug/generation.logicproblem#/"/>
4 <partialrelationinterpretation> 4 <partialrelationinterpretation>
5 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.0"/> 5 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.0"/>
6 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.0/@parameters.0"/> 6 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.0/@parameters.0"/>
7 <param2 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.0/@parameters.1"/> 7 <param2 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.0/@parameters.1"/>
8 </partialrelationinterpretation> 8 </partialrelationinterpretation>
9 <partialrelationinterpretation> 9 <partialrelationinterpretation>
10 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.1"/> 10 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.1"/>
11 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.1/@parameters.0"/> 11 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.1/@parameters.0"/>
12 <param2 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.1/@parameters.1"/> 12 <param2 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.1/@parameters.1"/>
13 </partialrelationinterpretation> 13 </partialrelationinterpretation>
14 <partialrelationinterpretation> 14 <partialrelationinterpretation>
15 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.2"/> 15 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.2"/>
16 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.2/@parameters.0"/> 16 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.2/@parameters.0"/>
17 <param2 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.2/@parameters.1"/> 17 <param2 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.2/@parameters.1"/>
18 </partialrelationinterpretation> 18 </partialrelationinterpretation>
19 <partialrelationinterpretation> 19 <partialrelationinterpretation>
20 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.3"/> 20 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.3"/>
21 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.3/@parameters.0"/> 21 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.3/@parameters.0"/>
22 <param2 xsi:type="language:StringTypeReference" href="outputs/debug/generation.logicproblem#//@relations.3/@parameters.1"/> 22 <param2 xsi:type="language:StringTypeReference" href="outputs/debug/generation.logicproblem#//@relations.3/@parameters.1"/>
23 </partialrelationinterpretation> 23 </partialrelationinterpretation>
24 <partialrelationinterpretation> 24 <partialrelationinterpretation>
25 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.4"/> 25 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.4"/>
26 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.4/@parameters.0"/> 26 <param1 xsi:type="language:ComplexTypeReference" href="outputs/debug/generation.logicproblem#//@relations.4/@parameters.0"/>
27 <param2 xsi:type="language:IntTypeReference" href="outputs/debug/generation.logicproblem#//@relations.4/@parameters.1"/> 27 <param2 xsi:type="language:IntTypeReference" href="outputs/debug/generation.logicproblem#//@relations.4/@parameters.1"/>
28 </partialrelationinterpretation> 28 </partialrelationinterpretation>
29 <newElements xsi:type="partialinterpretation:BooleanElement" name="true" valueSet="true" value="true"/> 29 <newElements xsi:type="partialinterpretation:BooleanElement" name="true" valueSet="true" value="true"/>
30 <newElements xsi:type="partialinterpretation:BooleanElement" name="false" valueSet="true"/> 30 <newElements xsi:type="partialinterpretation:BooleanElement" name="false" valueSet="true"/>
31 <newElements xsi:type="partialinterpretation:IntegerElement" name="1" valueSet="true" value="1"/> 31 <newElements xsi:type="partialinterpretation:IntegerElement" name="1" valueSet="true" value="1"/>
32 <newElements xsi:type="partialinterpretation:IntegerElement" name="2" valueSet="true" value="2"/> 32 <newElements xsi:type="partialinterpretation:IntegerElement" name="2" valueSet="true" value="2"/>
33 <newElements xsi:type="partialinterpretation:IntegerElement" name="3" valueSet="true" value="3"/> 33 <newElements xsi:type="partialinterpretation:IntegerElement" name="3" valueSet="true" value="3"/>
34 <newElements xsi:type="partialinterpretation:IntegerElement" name="4" valueSet="true" value="4"/> 34 <newElements xsi:type="partialinterpretation:IntegerElement" name="4" valueSet="true" value="4"/>
35 <newElements xsi:type="partialinterpretation:IntegerElement" name="5" valueSet="true" value="5"/> 35 <newElements xsi:type="partialinterpretation:IntegerElement" name="5" valueSet="true" value="5"/>
36 <partialtypeinterpratation xsi:type="partialinterpretation:PartialBooleanInterpretation" elements="//@newElements.0 //@newElements.1"/> 36 <partialtypeinterpratation xsi:type="partialinterpretation:PartialBooleanInterpretation" elements="//@newElements.0 //@newElements.1"/>
37 <partialtypeinterpratation xsi:type="partialinterpretation:PartialIntegerInterpretation" elements="//@newElements.2 //@newElements.3 //@newElements.4 //@newElements.5 //@newElements.6"/> 37 <partialtypeinterpratation xsi:type="partialinterpretation:PartialIntegerInterpretation" elements="//@newElements.2 //@newElements.3 //@newElements.4 //@newElements.5 //@newElements.6"/>
38 <partialtypeinterpratation xsi:type="partialinterpretation:PartialRealInterpretation" elements="//@openWorldElements.0"/> 38 <partialtypeinterpratation xsi:type="partialinterpretation:PartialRealInterpretation" elements="//@openWorldElements.0"/>
39 <partialtypeinterpratation xsi:type="partialinterpretation:PartialStringInterpretation" elements="//@openWorldElements.1"/> 39 <partialtypeinterpratation xsi:type="partialinterpretation:PartialStringInterpretation" elements="//@openWorldElements.1"/>
40 <partialtypeinterpratation xsi:type="partialinterpretation:PartialComplexTypeInterpretation" scopes="//@scopes.0"> 40 <partialtypeinterpratation xsi:type="partialinterpretation:PartialComplexTypeInterpretation" scopes="//@scopes.0">
41 <interpretationOf href="outputs/debug/generation.logicproblem#//@types.0"/> 41 <interpretationOf href="outputs/debug/generation.logicproblem#//@types.0"/>
42 </partialtypeinterpratation> 42 </partialtypeinterpratation>
43 <partialtypeinterpratation xsi:type="partialinterpretation:PartialComplexTypeInterpretation" scopes="//@scopes.1"> 43 <partialtypeinterpratation xsi:type="partialinterpretation:PartialComplexTypeInterpretation" scopes="//@scopes.1">
44 <interpretationOf href="outputs/debug/generation.logicproblem#//@types.1"/> 44 <interpretationOf href="outputs/debug/generation.logicproblem#//@types.1"/>
45 </partialtypeinterpratation> 45 </partialtypeinterpratation>
46 <openWorldElements xsi:type="partialinterpretation:RealElement" name="New Reals"/> 46 <openWorldElements xsi:type="partialinterpretation:RealElement" name="New Reals"/>
47 <openWorldElements xsi:type="partialinterpretation:StringElement" name="New Strings"/> 47 <openWorldElements xsi:type="partialinterpretation:StringElement" name="New Strings"/>
48 <openWorldElements name="New Objects"/> 48 <openWorldElements name="New Objects"/>
49 <scopes targetTypeInterpretation="//@partialtypeinterpratation.4"/> 49 <scopes targetTypeInterpretation="//@partialtypeinterpratation.4"/>
50 <scopes targetTypeInterpretation="//@partialtypeinterpratation.5"/> 50 <scopes targetTypeInterpretation="//@partialtypeinterpratation.5"/>
51</partialinterpretation:PartialInterpretation> 51</partialinterpretation:PartialInterpretation>
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/log.txt b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/log.txt
index 43befb00..1d3c9f62 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/log.txt
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/log.txt
@@ -1 +1 @@
Model generation started Model generation started
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/plugin.xml b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/plugin.xml
index 9364ebb2..941ef4d7 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/plugin.xml
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/plugin.xml
@@ -1,10 +1,10 @@
1<?xml version="1.0" encoding="UTF-8"?><plugin> 1<?xml version="1.0" encoding="UTF-8"?><plugin>
2 <extension id="queries.FamilyTreeConstraints" point="org.eclipse.viatra.query.runtime.queryspecification"> 2 <extension id="queries.FamilyTreeConstraints" point="org.eclipse.viatra.query.runtime.queryspecification">
3 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:queries.FamilyTreeConstraints" id="queries.FamilyTreeConstraints"> 3 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:queries.FamilyTreeConstraints" id="queries.FamilyTreeConstraints">
4 <query-specification fqn="queries.memberIsItsOwnParent"/> 4 <query-specification fqn="queries.memberIsItsOwnParent"/>
5 <query-specification fqn="queries.twoMembersHaveNoParent"/> 5 <query-specification fqn="queries.twoMembersHaveNoParent"/>
6 <query-specification fqn="queries.memberHasParent"/> 6 <query-specification fqn="queries.memberHasParent"/>
7 <query-specification fqn="queries.parentTooYoung"/> 7 <query-specification fqn="queries.parentTooYoung"/>
8 </group> 8 </group>
9 </extension> 9 </extension>
10</plugin> 10</plugin>
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.FamilyTreeConstraints.java._trace b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.FamilyTreeConstraints.java._trace
index 12849bfe..ab0f3a9a 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.FamilyTreeConstraints.java._trace
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.FamilyTreeConstraints.java._trace
Binary files differ
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.MemberIsItsOwnParent.java._trace b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.MemberIsItsOwnParent.java._trace
index 1b0dca98..aaf4d0c2 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.MemberIsItsOwnParent.java._trace
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.MemberIsItsOwnParent.java._trace
Binary files differ
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/FamilyTreeConstraints.java b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/FamilyTreeConstraints.java
index 738b41c0..97148b5e 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/FamilyTreeConstraints.java
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/FamilyTreeConstraints.java
@@ -1,86 +1,86 @@
1/** 1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql 2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */ 3 */
4package queries; 4package queries;
5 5
6import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; 6import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
7import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; 7import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
8import queries.MemberHasParent; 8import queries.MemberHasParent;
9import queries.MemberIsItsOwnParent; 9import queries.MemberIsItsOwnParent;
10import queries.ParentTooYoung; 10import queries.ParentTooYoung;
11import queries.TwoMembersHaveNoParent; 11import queries.TwoMembersHaveNoParent;
12 12
13/** 13/**
14 * A pattern group formed of all public patterns defined in familyTreeConstraints.vql. 14 * A pattern group formed of all public patterns defined in familyTreeConstraints.vql.
15 * 15 *
16 * <p>Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare 16 * <p>Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare
17 * a VIATRA Query engine for matching all patterns originally defined in file familyTreeConstraints.vql, 17 * a VIATRA Query engine for matching all patterns originally defined in file familyTreeConstraints.vql,
18 * in order to achieve better performance than one-by-one on-demand matcher initialization. 18 * in order to achieve better performance than one-by-one on-demand matcher initialization.
19 * 19 *
20 * <p> From package queries, the group contains the definition of the following patterns: <ul> 20 * <p> From package queries, the group contains the definition of the following patterns: <ul>
21 * <li>memberIsItsOwnParent</li> 21 * <li>memberIsItsOwnParent</li>
22 * <li>twoMembersHaveNoParent</li> 22 * <li>twoMembersHaveNoParent</li>
23 * <li>memberHasParent</li> 23 * <li>memberHasParent</li>
24 * <li>parentTooYoung</li> 24 * <li>parentTooYoung</li>
25 * </ul> 25 * </ul>
26 * 26 *
27 * @see IQueryGroup 27 * @see IQueryGroup
28 * 28 *
29 */ 29 */
30@SuppressWarnings("all") 30@SuppressWarnings("all")
31public final class FamilyTreeConstraints extends BaseGeneratedPatternGroup { 31public final class FamilyTreeConstraints extends BaseGeneratedPatternGroup {
32 /** 32 /**
33 * Access the pattern group. 33 * Access the pattern group.
34 * 34 *
35 * @return the singleton instance of the group 35 * @return the singleton instance of the group
36 * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications 36 * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications
37 * 37 *
38 */ 38 */
39 public static FamilyTreeConstraints instance() { 39 public static FamilyTreeConstraints instance() {
40 if (INSTANCE == null) { 40 if (INSTANCE == null) {
41 INSTANCE = new FamilyTreeConstraints(); 41 INSTANCE = new FamilyTreeConstraints();
42 } 42 }
43 return INSTANCE; 43 return INSTANCE;
44 } 44 }
45 45
46 private static FamilyTreeConstraints INSTANCE; 46 private static FamilyTreeConstraints INSTANCE;
47 47
48 private FamilyTreeConstraints() { 48 private FamilyTreeConstraints() {
49 querySpecifications.add(MemberIsItsOwnParent.instance()); 49 querySpecifications.add(MemberIsItsOwnParent.instance());
50 querySpecifications.add(TwoMembersHaveNoParent.instance()); 50 querySpecifications.add(TwoMembersHaveNoParent.instance());
51 querySpecifications.add(MemberHasParent.instance()); 51 querySpecifications.add(MemberHasParent.instance());
52 querySpecifications.add(ParentTooYoung.instance()); 52 querySpecifications.add(ParentTooYoung.instance());
53 } 53 }
54 54
55 public MemberIsItsOwnParent getMemberIsItsOwnParent() { 55 public MemberIsItsOwnParent getMemberIsItsOwnParent() {
56 return MemberIsItsOwnParent.instance(); 56 return MemberIsItsOwnParent.instance();
57 } 57 }
58 58
59 public MemberIsItsOwnParent.Matcher getMemberIsItsOwnParent(final ViatraQueryEngine engine) { 59 public MemberIsItsOwnParent.Matcher getMemberIsItsOwnParent(final ViatraQueryEngine engine) {
60 return MemberIsItsOwnParent.Matcher.on(engine); 60 return MemberIsItsOwnParent.Matcher.on(engine);
61 } 61 }
62 62
63 public TwoMembersHaveNoParent getTwoMembersHaveNoParent() { 63 public TwoMembersHaveNoParent getTwoMembersHaveNoParent() {
64 return TwoMembersHaveNoParent.instance(); 64 return TwoMembersHaveNoParent.instance();
65 } 65 }
66 66
67 public TwoMembersHaveNoParent.Matcher getTwoMembersHaveNoParent(final ViatraQueryEngine engine) { 67 public TwoMembersHaveNoParent.Matcher getTwoMembersHaveNoParent(final ViatraQueryEngine engine) {
68 return TwoMembersHaveNoParent.Matcher.on(engine); 68 return TwoMembersHaveNoParent.Matcher.on(engine);
69 } 69 }
70 70
71 public MemberHasParent getMemberHasParent() { 71 public MemberHasParent getMemberHasParent() {
72 return MemberHasParent.instance(); 72 return MemberHasParent.instance();
73 } 73 }
74 74
75 public MemberHasParent.Matcher getMemberHasParent(final ViatraQueryEngine engine) { 75 public MemberHasParent.Matcher getMemberHasParent(final ViatraQueryEngine engine) {
76 return MemberHasParent.Matcher.on(engine); 76 return MemberHasParent.Matcher.on(engine);
77 } 77 }
78 78
79 public ParentTooYoung getParentTooYoung() { 79 public ParentTooYoung getParentTooYoung() {
80 return ParentTooYoung.instance(); 80 return ParentTooYoung.instance();
81 } 81 }
82 82
83 public ParentTooYoung.Matcher getParentTooYoung(final ViatraQueryEngine engine) { 83 public ParentTooYoung.Matcher getParentTooYoung(final ViatraQueryEngine engine) {
84 return ParentTooYoung.Matcher.on(engine); 84 return ParentTooYoung.Matcher.on(engine);
85 } 85 }
86} 86}
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberHasParent.java b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberHasParent.java
index 82b83d0c..83bb4aac 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberHasParent.java
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberHasParent.java
@@ -1,551 +1,551 @@
1/** 1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql 2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */ 3 */
4package queries; 4package queries;
5 5
6import familytree.Member; 6import familytree.Member;
7import java.util.Arrays; 7import java.util.Arrays;
8import java.util.Collection; 8import java.util.Collection;
9import java.util.LinkedHashSet; 9import java.util.LinkedHashSet;
10import java.util.List; 10import java.util.List;
11import java.util.Objects; 11import java.util.Objects;
12import java.util.Optional; 12import java.util.Optional;
13import java.util.Set; 13import java.util.Set;
14import java.util.function.Consumer; 14import java.util.function.Consumer;
15import java.util.stream.Collectors; 15import java.util.stream.Collectors;
16import java.util.stream.Stream; 16import java.util.stream.Stream;
17import org.apache.log4j.Logger; 17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass; 18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch; 19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification; 20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; 21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; 22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; 23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; 24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; 25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; 26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; 27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; 28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; 29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; 30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; 31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; 32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; 33import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
34import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; 34import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; 35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; 36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
37import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; 37import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; 38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
39import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; 39import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
40 40
41/** 41/**
42 * A pattern-specific query specification that can instantiate Matcher in a type-safe way. 42 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
43 * 43 *
44 * <p>Original source: 44 * <p>Original source:
45 * <code><pre> 45 * <code><pre>
46 * pattern memberHasParent(m: Member) = { 46 * pattern memberHasParent(m: Member) = {
47 * Member.parents(m, _); 47 * Member.parents(m, _);
48 * } 48 * }
49 * </pre></code> 49 * </pre></code>
50 * 50 *
51 * @see Matcher 51 * @see Matcher
52 * @see Match 52 * @see Match
53 * 53 *
54 */ 54 */
55@SuppressWarnings("all") 55@SuppressWarnings("all")
56public final class MemberHasParent extends BaseGeneratedEMFQuerySpecification<MemberHasParent.Matcher> { 56public final class MemberHasParent extends BaseGeneratedEMFQuerySpecification<MemberHasParent.Matcher> {
57 /** 57 /**
58 * Pattern-specific match representation of the queries.memberHasParent pattern, 58 * Pattern-specific match representation of the queries.memberHasParent pattern,
59 * to be used in conjunction with {@link Matcher}. 59 * to be used in conjunction with {@link Matcher}.
60 * 60 *
61 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. 61 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
62 * Each instance is a (possibly partial) substitution of pattern parameters, 62 * Each instance is a (possibly partial) substitution of pattern parameters,
63 * usable to represent a match of the pattern in the result of a query, 63 * usable to represent a match of the pattern in the result of a query,
64 * or to specify the bound (fixed) input parameters when issuing a query. 64 * or to specify the bound (fixed) input parameters when issuing a query.
65 * 65 *
66 * @see Matcher 66 * @see Matcher
67 * 67 *
68 */ 68 */
69 public static abstract class Match extends BasePatternMatch { 69 public static abstract class Match extends BasePatternMatch {
70 private Member fM; 70 private Member fM;
71 71
72 private static List<String> parameterNames = makeImmutableList("m"); 72 private static List<String> parameterNames = makeImmutableList("m");
73 73
74 private Match(final Member pM) { 74 private Match(final Member pM) {
75 this.fM = pM; 75 this.fM = pM;
76 } 76 }
77 77
78 @Override 78 @Override
79 public Object get(final String parameterName) { 79 public Object get(final String parameterName) {
80 switch(parameterName) { 80 switch(parameterName) {
81 case "m": return this.fM; 81 case "m": return this.fM;
82 default: return null; 82 default: return null;
83 } 83 }
84 } 84 }
85 85
86 @Override 86 @Override
87 public Object get(final int index) { 87 public Object get(final int index) {
88 switch(index) { 88 switch(index) {
89 case 0: return this.fM; 89 case 0: return this.fM;
90 default: return null; 90 default: return null;
91 } 91 }
92 } 92 }
93 93
94 public Member getM() { 94 public Member getM() {
95 return this.fM; 95 return this.fM;
96 } 96 }
97 97
98 @Override 98 @Override
99 public boolean set(final String parameterName, final Object newValue) { 99 public boolean set(final String parameterName, final Object newValue) {
100 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 100 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
101 if ("m".equals(parameterName) ) { 101 if ("m".equals(parameterName) ) {
102 this.fM = (Member) newValue; 102 this.fM = (Member) newValue;
103 return true; 103 return true;
104 } 104 }
105 return false; 105 return false;
106 } 106 }
107 107
108 public void setM(final Member pM) { 108 public void setM(final Member pM) {
109 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 109 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
110 this.fM = pM; 110 this.fM = pM;
111 } 111 }
112 112
113 @Override 113 @Override
114 public String patternName() { 114 public String patternName() {
115 return "queries.memberHasParent"; 115 return "queries.memberHasParent";
116 } 116 }
117 117
118 @Override 118 @Override
119 public List<String> parameterNames() { 119 public List<String> parameterNames() {
120 return MemberHasParent.Match.parameterNames; 120 return MemberHasParent.Match.parameterNames;
121 } 121 }
122 122
123 @Override 123 @Override
124 public Object[] toArray() { 124 public Object[] toArray() {
125 return new Object[]{fM}; 125 return new Object[]{fM};
126 } 126 }
127 127
128 @Override 128 @Override
129 public MemberHasParent.Match toImmutable() { 129 public MemberHasParent.Match toImmutable() {
130 return isMutable() ? newMatch(fM) : this; 130 return isMutable() ? newMatch(fM) : this;
131 } 131 }
132 132
133 @Override 133 @Override
134 public String prettyPrint() { 134 public String prettyPrint() {
135 StringBuilder result = new StringBuilder(); 135 StringBuilder result = new StringBuilder();
136 result.append("\"m\"=" + prettyPrintValue(fM)); 136 result.append("\"m\"=" + prettyPrintValue(fM));
137 return result.toString(); 137 return result.toString();
138 } 138 }
139 139
140 @Override 140 @Override
141 public int hashCode() { 141 public int hashCode() {
142 return Objects.hash(fM); 142 return Objects.hash(fM);
143 } 143 }
144 144
145 @Override 145 @Override
146 public boolean equals(final Object obj) { 146 public boolean equals(final Object obj) {
147 if (this == obj) 147 if (this == obj)
148 return true; 148 return true;
149 if (obj == null) { 149 if (obj == null) {
150 return false; 150 return false;
151 } 151 }
152 if ((obj instanceof MemberHasParent.Match)) { 152 if ((obj instanceof MemberHasParent.Match)) {
153 MemberHasParent.Match other = (MemberHasParent.Match) obj; 153 MemberHasParent.Match other = (MemberHasParent.Match) obj;
154 return Objects.equals(fM, other.fM); 154 return Objects.equals(fM, other.fM);
155 } else { 155 } else {
156 // this should be infrequent 156 // this should be infrequent
157 if (!(obj instanceof IPatternMatch)) { 157 if (!(obj instanceof IPatternMatch)) {
158 return false; 158 return false;
159 } 159 }
160 IPatternMatch otherSig = (IPatternMatch) obj; 160 IPatternMatch otherSig = (IPatternMatch) obj;
161 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); 161 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
162 } 162 }
163 } 163 }
164 164
165 @Override 165 @Override
166 public MemberHasParent specification() { 166 public MemberHasParent specification() {
167 return MemberHasParent.instance(); 167 return MemberHasParent.instance();
168 } 168 }
169 169
170 /** 170 /**
171 * Returns an empty, mutable match. 171 * Returns an empty, mutable match.
172 * Fields of the mutable match can be filled to create a partial match, usable as matcher input. 172 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
173 * 173 *
174 * @return the empty match. 174 * @return the empty match.
175 * 175 *
176 */ 176 */
177 public static MemberHasParent.Match newEmptyMatch() { 177 public static MemberHasParent.Match newEmptyMatch() {
178 return new Mutable(null); 178 return new Mutable(null);
179 } 179 }
180 180
181 /** 181 /**
182 * Returns a mutable (partial) match. 182 * Returns a mutable (partial) match.
183 * Fields of the mutable match can be filled to create a partial match, usable as matcher input. 183 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
184 * 184 *
185 * @param pM the fixed value of pattern parameter m, or null if not bound. 185 * @param pM the fixed value of pattern parameter m, or null if not bound.
186 * @return the new, mutable (partial) match object. 186 * @return the new, mutable (partial) match object.
187 * 187 *
188 */ 188 */
189 public static MemberHasParent.Match newMutableMatch(final Member pM) { 189 public static MemberHasParent.Match newMutableMatch(final Member pM) {
190 return new Mutable(pM); 190 return new Mutable(pM);
191 } 191 }
192 192
193 /** 193 /**
194 * Returns a new (partial) match. 194 * Returns a new (partial) match.
195 * This can be used e.g. to call the matcher with a partial match. 195 * This can be used e.g. to call the matcher with a partial match.
196 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. 196 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
197 * @param pM the fixed value of pattern parameter m, or null if not bound. 197 * @param pM the fixed value of pattern parameter m, or null if not bound.
198 * @return the (partial) match object. 198 * @return the (partial) match object.
199 * 199 *
200 */ 200 */
201 public static MemberHasParent.Match newMatch(final Member pM) { 201 public static MemberHasParent.Match newMatch(final Member pM) {
202 return new Immutable(pM); 202 return new Immutable(pM);
203 } 203 }
204 204
205 private static final class Mutable extends MemberHasParent.Match { 205 private static final class Mutable extends MemberHasParent.Match {
206 Mutable(final Member pM) { 206 Mutable(final Member pM) {
207 super(pM); 207 super(pM);
208 } 208 }
209 209
210 @Override 210 @Override
211 public boolean isMutable() { 211 public boolean isMutable() {
212 return true; 212 return true;
213 } 213 }
214 } 214 }
215 215
216 private static final class Immutable extends MemberHasParent.Match { 216 private static final class Immutable extends MemberHasParent.Match {
217 Immutable(final Member pM) { 217 Immutable(final Member pM) {
218 super(pM); 218 super(pM);
219 } 219 }
220 220
221 @Override 221 @Override
222 public boolean isMutable() { 222 public boolean isMutable() {
223 return false; 223 return false;
224 } 224 }
225 } 225 }
226 } 226 }
227 227
228 /** 228 /**
229 * Generated pattern matcher API of the queries.memberHasParent pattern, 229 * Generated pattern matcher API of the queries.memberHasParent pattern,
230 * providing pattern-specific query methods. 230 * providing pattern-specific query methods.
231 * 231 *
232 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, 232 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
233 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. 233 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
234 * 234 *
235 * <p>Matches of the pattern will be represented as {@link Match}. 235 * <p>Matches of the pattern will be represented as {@link Match}.
236 * 236 *
237 * <p>Original source: 237 * <p>Original source:
238 * <code><pre> 238 * <code><pre>
239 * pattern memberHasParent(m: Member) = { 239 * pattern memberHasParent(m: Member) = {
240 * Member.parents(m, _); 240 * Member.parents(m, _);
241 * } 241 * }
242 * </pre></code> 242 * </pre></code>
243 * 243 *
244 * @see Match 244 * @see Match
245 * @see MemberHasParent 245 * @see MemberHasParent
246 * 246 *
247 */ 247 */
248 public static class Matcher extends BaseMatcher<MemberHasParent.Match> { 248 public static class Matcher extends BaseMatcher<MemberHasParent.Match> {
249 /** 249 /**
250 * Initializes the pattern matcher within an existing VIATRA Query engine. 250 * Initializes the pattern matcher within an existing VIATRA Query engine.
251 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. 251 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
252 * 252 *
253 * @param engine the existing VIATRA Query engine in which this matcher will be created. 253 * @param engine the existing VIATRA Query engine in which this matcher will be created.
254 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 254 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
255 * 255 *
256 */ 256 */
257 public static MemberHasParent.Matcher on(final ViatraQueryEngine engine) { 257 public static MemberHasParent.Matcher on(final ViatraQueryEngine engine) {
258 // check if matcher already exists 258 // check if matcher already exists
259 Matcher matcher = engine.getExistingMatcher(querySpecification()); 259 Matcher matcher = engine.getExistingMatcher(querySpecification());
260 if (matcher == null) { 260 if (matcher == null) {
261 matcher = (Matcher)engine.getMatcher(querySpecification()); 261 matcher = (Matcher)engine.getMatcher(querySpecification());
262 } 262 }
263 return matcher; 263 return matcher;
264 } 264 }
265 265
266 /** 266 /**
267 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 267 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
268 * @return an initialized matcher 268 * @return an initialized matcher
269 * @noreference This method is for internal matcher initialization by the framework, do not call it manually. 269 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
270 * 270 *
271 */ 271 */
272 public static MemberHasParent.Matcher create() { 272 public static MemberHasParent.Matcher create() {
273 return new Matcher(); 273 return new Matcher();
274 } 274 }
275 275
276 private static final int POSITION_M = 0; 276 private static final int POSITION_M = 0;
277 277
278 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MemberHasParent.Matcher.class); 278 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MemberHasParent.Matcher.class);
279 279
280 /** 280 /**
281 * Initializes the pattern matcher within an existing VIATRA Query engine. 281 * Initializes the pattern matcher within an existing VIATRA Query engine.
282 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. 282 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
283 * 283 *
284 * @param engine the existing VIATRA Query engine in which this matcher will be created. 284 * @param engine the existing VIATRA Query engine in which this matcher will be created.
285 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 285 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
286 * 286 *
287 */ 287 */
288 private Matcher() { 288 private Matcher() {
289 super(querySpecification()); 289 super(querySpecification());
290 } 290 }
291 291
292 /** 292 /**
293 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. 293 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
294 * @param pM the fixed value of pattern parameter m, or null if not bound. 294 * @param pM the fixed value of pattern parameter m, or null if not bound.
295 * @return matches represented as a Match object. 295 * @return matches represented as a Match object.
296 * 296 *
297 */ 297 */
298 public Collection<MemberHasParent.Match> getAllMatches(final Member pM) { 298 public Collection<MemberHasParent.Match> getAllMatches(final Member pM) {
299 return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet()); 299 return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet());
300 } 300 }
301 301
302 /** 302 /**
303 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. 303 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
304 * </p> 304 * </p>
305 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 305 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
306 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 306 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
307 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 307 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
308 * @param pM the fixed value of pattern parameter m, or null if not bound. 308 * @param pM the fixed value of pattern parameter m, or null if not bound.
309 * @return a stream of matches represented as a Match object. 309 * @return a stream of matches represented as a Match object.
310 * 310 *
311 */ 311 */
312 public Stream<MemberHasParent.Match> streamAllMatches(final Member pM) { 312 public Stream<MemberHasParent.Match> streamAllMatches(final Member pM) {
313 return rawStreamAllMatches(new Object[]{pM}); 313 return rawStreamAllMatches(new Object[]{pM});
314 } 314 }
315 315
316 /** 316 /**
317 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. 317 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
318 * Neither determinism nor randomness of selection is guaranteed. 318 * Neither determinism nor randomness of selection is guaranteed.
319 * @param pM the fixed value of pattern parameter m, or null if not bound. 319 * @param pM the fixed value of pattern parameter m, or null if not bound.
320 * @return a match represented as a Match object, or null if no match is found. 320 * @return a match represented as a Match object, or null if no match is found.
321 * 321 *
322 */ 322 */
323 public Optional<MemberHasParent.Match> getOneArbitraryMatch(final Member pM) { 323 public Optional<MemberHasParent.Match> getOneArbitraryMatch(final Member pM) {
324 return rawGetOneArbitraryMatch(new Object[]{pM}); 324 return rawGetOneArbitraryMatch(new Object[]{pM});
325 } 325 }
326 326
327 /** 327 /**
328 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, 328 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
329 * under any possible substitution of the unspecified parameters (if any). 329 * under any possible substitution of the unspecified parameters (if any).
330 * @param pM the fixed value of pattern parameter m, or null if not bound. 330 * @param pM the fixed value of pattern parameter m, or null if not bound.
331 * @return true if the input is a valid (partial) match of the pattern. 331 * @return true if the input is a valid (partial) match of the pattern.
332 * 332 *
333 */ 333 */
334 public boolean hasMatch(final Member pM) { 334 public boolean hasMatch(final Member pM) {
335 return rawHasMatch(new Object[]{pM}); 335 return rawHasMatch(new Object[]{pM});
336 } 336 }
337 337
338 /** 338 /**
339 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. 339 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
340 * @param pM the fixed value of pattern parameter m, or null if not bound. 340 * @param pM the fixed value of pattern parameter m, or null if not bound.
341 * @return the number of pattern matches found. 341 * @return the number of pattern matches found.
342 * 342 *
343 */ 343 */
344 public int countMatches(final Member pM) { 344 public int countMatches(final Member pM) {
345 return rawCountMatches(new Object[]{pM}); 345 return rawCountMatches(new Object[]{pM});
346 } 346 }
347 347
348 /** 348 /**
349 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. 349 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
350 * Neither determinism nor randomness of selection is guaranteed. 350 * Neither determinism nor randomness of selection is guaranteed.
351 * @param pM the fixed value of pattern parameter m, or null if not bound. 351 * @param pM the fixed value of pattern parameter m, or null if not bound.
352 * @param processor the action that will process the selected match. 352 * @param processor the action that will process the selected match.
353 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked 353 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
354 * 354 *
355 */ 355 */
356 public boolean forOneArbitraryMatch(final Member pM, final Consumer<? super MemberHasParent.Match> processor) { 356 public boolean forOneArbitraryMatch(final Member pM, final Consumer<? super MemberHasParent.Match> processor) {
357 return rawForOneArbitraryMatch(new Object[]{pM}, processor); 357 return rawForOneArbitraryMatch(new Object[]{pM}, processor);
358 } 358 }
359 359
360 /** 360 /**
361 * Returns a new (partial) match. 361 * Returns a new (partial) match.
362 * This can be used e.g. to call the matcher with a partial match. 362 * This can be used e.g. to call the matcher with a partial match.
363 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. 363 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
364 * @param pM the fixed value of pattern parameter m, or null if not bound. 364 * @param pM the fixed value of pattern parameter m, or null if not bound.
365 * @return the (partial) match object. 365 * @return the (partial) match object.
366 * 366 *
367 */ 367 */
368 public MemberHasParent.Match newMatch(final Member pM) { 368 public MemberHasParent.Match newMatch(final Member pM) {
369 return MemberHasParent.Match.newMatch(pM); 369 return MemberHasParent.Match.newMatch(pM);
370 } 370 }
371 371
372 /** 372 /**
373 * Retrieve the set of values that occur in matches for m. 373 * Retrieve the set of values that occur in matches for m.
374 * @return the Set of all values or empty set if there are no matches 374 * @return the Set of all values or empty set if there are no matches
375 * 375 *
376 */ 376 */
377 protected Stream<Member> rawStreamAllValuesOfm(final Object[] parameters) { 377 protected Stream<Member> rawStreamAllValuesOfm(final Object[] parameters) {
378 return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast); 378 return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast);
379 } 379 }
380 380
381 /** 381 /**
382 * Retrieve the set of values that occur in matches for m. 382 * Retrieve the set of values that occur in matches for m.
383 * @return the Set of all values or empty set if there are no matches 383 * @return the Set of all values or empty set if there are no matches
384 * 384 *
385 */ 385 */
386 public Set<Member> getAllValuesOfm() { 386 public Set<Member> getAllValuesOfm() {
387 return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet()); 387 return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet());
388 } 388 }
389 389
390 /** 390 /**
391 * Retrieve the set of values that occur in matches for m. 391 * Retrieve the set of values that occur in matches for m.
392 * @return the Set of all values or empty set if there are no matches 392 * @return the Set of all values or empty set if there are no matches
393 * 393 *
394 */ 394 */
395 public Stream<Member> streamAllValuesOfm() { 395 public Stream<Member> streamAllValuesOfm() {
396 return rawStreamAllValuesOfm(emptyArray()); 396 return rawStreamAllValuesOfm(emptyArray());
397 } 397 }
398 398
399 @Override 399 @Override
400 protected MemberHasParent.Match tupleToMatch(final Tuple t) { 400 protected MemberHasParent.Match tupleToMatch(final Tuple t) {
401 try { 401 try {
402 return MemberHasParent.Match.newMatch((Member) t.get(POSITION_M)); 402 return MemberHasParent.Match.newMatch((Member) t.get(POSITION_M));
403 } catch(ClassCastException e) { 403 } catch(ClassCastException e) {
404 LOGGER.error("Element(s) in tuple not properly typed!",e); 404 LOGGER.error("Element(s) in tuple not properly typed!",e);
405 return null; 405 return null;
406 } 406 }
407 } 407 }
408 408
409 @Override 409 @Override
410 protected MemberHasParent.Match arrayToMatch(final Object[] match) { 410 protected MemberHasParent.Match arrayToMatch(final Object[] match) {
411 try { 411 try {
412 return MemberHasParent.Match.newMatch((Member) match[POSITION_M]); 412 return MemberHasParent.Match.newMatch((Member) match[POSITION_M]);
413 } catch(ClassCastException e) { 413 } catch(ClassCastException e) {
414 LOGGER.error("Element(s) in array not properly typed!",e); 414 LOGGER.error("Element(s) in array not properly typed!",e);
415 return null; 415 return null;
416 } 416 }
417 } 417 }
418 418
419 @Override 419 @Override
420 protected MemberHasParent.Match arrayToMatchMutable(final Object[] match) { 420 protected MemberHasParent.Match arrayToMatchMutable(final Object[] match) {
421 try { 421 try {
422 return MemberHasParent.Match.newMutableMatch((Member) match[POSITION_M]); 422 return MemberHasParent.Match.newMutableMatch((Member) match[POSITION_M]);
423 } catch(ClassCastException e) { 423 } catch(ClassCastException e) {
424 LOGGER.error("Element(s) in array not properly typed!",e); 424 LOGGER.error("Element(s) in array not properly typed!",e);
425 return null; 425 return null;
426 } 426 }
427 } 427 }
428 428
429 /** 429 /**
430 * @return the singleton instance of the query specification of this pattern 430 * @return the singleton instance of the query specification of this pattern
431 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded 431 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
432 * 432 *
433 */ 433 */
434 public static IQuerySpecification<MemberHasParent.Matcher> querySpecification() { 434 public static IQuerySpecification<MemberHasParent.Matcher> querySpecification() {
435 return MemberHasParent.instance(); 435 return MemberHasParent.instance();
436 } 436 }
437 } 437 }
438 438
439 private MemberHasParent() { 439 private MemberHasParent() {
440 super(GeneratedPQuery.INSTANCE); 440 super(GeneratedPQuery.INSTANCE);
441 } 441 }
442 442
443 /** 443 /**
444 * @return the singleton instance of the query specification 444 * @return the singleton instance of the query specification
445 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded 445 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
446 * 446 *
447 */ 447 */
448 public static MemberHasParent instance() { 448 public static MemberHasParent instance() {
449 try{ 449 try{
450 return LazyHolder.INSTANCE; 450 return LazyHolder.INSTANCE;
451 } catch (ExceptionInInitializerError err) { 451 } catch (ExceptionInInitializerError err) {
452 throw processInitializerError(err); 452 throw processInitializerError(err);
453 } 453 }
454 } 454 }
455 455
456 @Override 456 @Override
457 protected MemberHasParent.Matcher instantiate(final ViatraQueryEngine engine) { 457 protected MemberHasParent.Matcher instantiate(final ViatraQueryEngine engine) {
458 return MemberHasParent.Matcher.on(engine); 458 return MemberHasParent.Matcher.on(engine);
459 } 459 }
460 460
461 @Override 461 @Override
462 public MemberHasParent.Matcher instantiate() { 462 public MemberHasParent.Matcher instantiate() {
463 return MemberHasParent.Matcher.create(); 463 return MemberHasParent.Matcher.create();
464 } 464 }
465 465
466 @Override 466 @Override
467 public MemberHasParent.Match newEmptyMatch() { 467 public MemberHasParent.Match newEmptyMatch() {
468 return MemberHasParent.Match.newEmptyMatch(); 468 return MemberHasParent.Match.newEmptyMatch();
469 } 469 }
470 470
471 @Override 471 @Override
472 public MemberHasParent.Match newMatch(final Object... parameters) { 472 public MemberHasParent.Match newMatch(final Object... parameters) {
473 return MemberHasParent.Match.newMatch((familytree.Member) parameters[0]); 473 return MemberHasParent.Match.newMatch((familytree.Member) parameters[0]);
474 } 474 }
475 475
476 /** 476 /**
477 * Inner class allowing the singleton instance of {@link MemberHasParent} to be created 477 * Inner class allowing the singleton instance of {@link MemberHasParent} to be created
478 * <b>not</b> at the class load time of the outer class, 478 * <b>not</b> at the class load time of the outer class,
479 * but rather at the first call to {@link MemberHasParent#instance()}. 479 * but rather at the first call to {@link MemberHasParent#instance()}.
480 * 480 *
481 * <p> This workaround is required e.g. to support recursion. 481 * <p> This workaround is required e.g. to support recursion.
482 * 482 *
483 */ 483 */
484 private static class LazyHolder { 484 private static class LazyHolder {
485 private static final MemberHasParent INSTANCE = new MemberHasParent(); 485 private static final MemberHasParent INSTANCE = new MemberHasParent();
486 486
487 /** 487 /**
488 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. 488 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
489 * This initialization order is required to support indirect recursion. 489 * This initialization order is required to support indirect recursion.
490 * 490 *
491 * <p> The static initializer is defined using a helper field to work around limitations of the code generator. 491 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
492 * 492 *
493 */ 493 */
494 private static final Object STATIC_INITIALIZER = ensureInitialized(); 494 private static final Object STATIC_INITIALIZER = ensureInitialized();
495 495
496 public static Object ensureInitialized() { 496 public static Object ensureInitialized() {
497 INSTANCE.ensureInitializedInternal(); 497 INSTANCE.ensureInitializedInternal();
498 return null; 498 return null;
499 } 499 }
500 } 500 }
501 501
502 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { 502 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
503 private static final MemberHasParent.GeneratedPQuery INSTANCE = new GeneratedPQuery(); 503 private static final MemberHasParent.GeneratedPQuery INSTANCE = new GeneratedPQuery();
504 504
505 private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); 505 private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
506 506
507 private final List<PParameter> parameters = Arrays.asList(parameter_m); 507 private final List<PParameter> parameters = Arrays.asList(parameter_m);
508 508
509 private GeneratedPQuery() { 509 private GeneratedPQuery() {
510 super(PVisibility.PUBLIC); 510 super(PVisibility.PUBLIC);
511 } 511 }
512 512
513 @Override 513 @Override
514 public String getFullyQualifiedName() { 514 public String getFullyQualifiedName() {
515 return "queries.memberHasParent"; 515 return "queries.memberHasParent";
516 } 516 }
517 517
518 @Override 518 @Override
519 public List<String> getParameterNames() { 519 public List<String> getParameterNames() {
520 return Arrays.asList("m"); 520 return Arrays.asList("m");
521 } 521 }
522 522
523 @Override 523 @Override
524 public List<PParameter> getParameters() { 524 public List<PParameter> getParameters() {
525 return parameters; 525 return parameters;
526 } 526 }
527 527
528 @Override 528 @Override
529 public Set<PBody> doGetContainedBodies() { 529 public Set<PBody> doGetContainedBodies() {
530 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); 530 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
531 Set<PBody> bodies = new LinkedHashSet<>(); 531 Set<PBody> bodies = new LinkedHashSet<>();
532 { 532 {
533 PBody body = new PBody(this); 533 PBody body = new PBody(this);
534 PVariable var_m = body.getOrCreateVariableByName("m"); 534 PVariable var_m = body.getOrCreateVariableByName("m");
535 PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); 535 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
536 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 536 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
537 body.setSymbolicParameters(Arrays.<ExportedParameter>asList( 537 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
538 new ExportedParameter(body, var_m, parameter_m) 538 new ExportedParameter(body, var_m, parameter_m)
539 )); 539 ));
540 // Member.parents(m, _) 540 // Member.parents(m, _)
541 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 541 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
542 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); 542 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
543 new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "parents"))); 543 new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "parents")));
544 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 544 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
545 new Equality(body, var__virtual_0_, var___0_); 545 new Equality(body, var__virtual_0_, var___0_);
546 bodies.add(body); 546 bodies.add(body);
547 } 547 }
548 return bodies; 548 return bodies;
549 } 549 }
550 } 550 }
551} 551}
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberIsItsOwnParent.java b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberIsItsOwnParent.java
index 67cdafb5..63cb882d 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberIsItsOwnParent.java
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberIsItsOwnParent.java
@@ -1,577 +1,577 @@
1/** 1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql 2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */ 3 */
4package queries; 4package queries;
5 5
6import familytree.Member; 6import familytree.Member;
7import java.util.Arrays; 7import java.util.Arrays;
8import java.util.Collection; 8import java.util.Collection;
9import java.util.LinkedHashSet; 9import java.util.LinkedHashSet;
10import java.util.List; 10import java.util.List;
11import java.util.Objects; 11import java.util.Objects;
12import java.util.Optional; 12import java.util.Optional;
13import java.util.Set; 13import java.util.Set;
14import java.util.function.Consumer; 14import java.util.function.Consumer;
15import java.util.stream.Collectors; 15import java.util.stream.Collectors;
16import java.util.stream.Stream; 16import java.util.stream.Stream;
17import org.apache.log4j.Logger; 17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass; 18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch; 19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification; 20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; 21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; 22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; 23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; 24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; 25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; 26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; 27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; 28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; 29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; 30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; 31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; 32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; 33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; 34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; 35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; 36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; 37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; 38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; 39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; 40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; 41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42 42
43/** 43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way. 44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 * 45 *
46 * <p>Original source: 46 * <p>Original source:
47 * <code><pre> 47 * <code><pre>
48 * {@literal @}Constraint(message="memberIsItsOwnParent", severity="error", key={m}) 48 * {@literal @}Constraint(message="memberIsItsOwnParent", severity="error", key={m})
49 * pattern memberIsItsOwnParent(m: Member) = { 49 * pattern memberIsItsOwnParent(m: Member) = {
50 * FamilyTree.members(_, m); 50 * FamilyTree.members(_, m);
51 * Member.parents(m, p); 51 * Member.parents(m, p);
52 * m == p; 52 * m == p;
53 * } 53 * }
54 * </pre></code> 54 * </pre></code>
55 * 55 *
56 * @see Matcher 56 * @see Matcher
57 * @see Match 57 * @see Match
58 * 58 *
59 */ 59 */
60@SuppressWarnings("all") 60@SuppressWarnings("all")
61public final class MemberIsItsOwnParent extends BaseGeneratedEMFQuerySpecification<MemberIsItsOwnParent.Matcher> { 61public final class MemberIsItsOwnParent extends BaseGeneratedEMFQuerySpecification<MemberIsItsOwnParent.Matcher> {
62 /** 62 /**
63 * Pattern-specific match representation of the queries.memberIsItsOwnParent pattern, 63 * Pattern-specific match representation of the queries.memberIsItsOwnParent pattern,
64 * to be used in conjunction with {@link Matcher}. 64 * to be used in conjunction with {@link Matcher}.
65 * 65 *
66 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. 66 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
67 * Each instance is a (possibly partial) substitution of pattern parameters, 67 * Each instance is a (possibly partial) substitution of pattern parameters,
68 * usable to represent a match of the pattern in the result of a query, 68 * usable to represent a match of the pattern in the result of a query,
69 * or to specify the bound (fixed) input parameters when issuing a query. 69 * or to specify the bound (fixed) input parameters when issuing a query.
70 * 70 *
71 * @see Matcher 71 * @see Matcher
72 * 72 *
73 */ 73 */
74 public static abstract class Match extends BasePatternMatch { 74 public static abstract class Match extends BasePatternMatch {
75 private Member fM; 75 private Member fM;
76 76
77 private static List<String> parameterNames = makeImmutableList("m"); 77 private static List<String> parameterNames = makeImmutableList("m");
78 78
79 private Match(final Member pM) { 79 private Match(final Member pM) {
80 this.fM = pM; 80 this.fM = pM;
81 } 81 }
82 82
83 @Override 83 @Override
84 public Object get(final String parameterName) { 84 public Object get(final String parameterName) {
85 switch(parameterName) { 85 switch(parameterName) {
86 case "m": return this.fM; 86 case "m": return this.fM;
87 default: return null; 87 default: return null;
88 } 88 }
89 } 89 }
90 90
91 @Override 91 @Override
92 public Object get(final int index) { 92 public Object get(final int index) {
93 switch(index) { 93 switch(index) {
94 case 0: return this.fM; 94 case 0: return this.fM;
95 default: return null; 95 default: return null;
96 } 96 }
97 } 97 }
98 98
99 public Member getM() { 99 public Member getM() {
100 return this.fM; 100 return this.fM;
101 } 101 }
102 102
103 @Override 103 @Override
104 public boolean set(final String parameterName, final Object newValue) { 104 public boolean set(final String parameterName, final Object newValue) {
105 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 105 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
106 if ("m".equals(parameterName) ) { 106 if ("m".equals(parameterName) ) {
107 this.fM = (Member) newValue; 107 this.fM = (Member) newValue;
108 return true; 108 return true;
109 } 109 }
110 return false; 110 return false;
111 } 111 }
112 112
113 public void setM(final Member pM) { 113 public void setM(final Member pM) {
114 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 114 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
115 this.fM = pM; 115 this.fM = pM;
116 } 116 }
117 117
118 @Override 118 @Override
119 public String patternName() { 119 public String patternName() {
120 return "queries.memberIsItsOwnParent"; 120 return "queries.memberIsItsOwnParent";
121 } 121 }
122 122
123 @Override 123 @Override
124 public List<String> parameterNames() { 124 public List<String> parameterNames() {
125 return MemberIsItsOwnParent.Match.parameterNames; 125 return MemberIsItsOwnParent.Match.parameterNames;
126 } 126 }
127 127
128 @Override 128 @Override
129 public Object[] toArray() { 129 public Object[] toArray() {
130 return new Object[]{fM}; 130 return new Object[]{fM};
131 } 131 }
132 132
133 @Override 133 @Override
134 public MemberIsItsOwnParent.Match toImmutable() { 134 public MemberIsItsOwnParent.Match toImmutable() {
135 return isMutable() ? newMatch(fM) : this; 135 return isMutable() ? newMatch(fM) : this;
136 } 136 }
137 137
138 @Override 138 @Override
139 public String prettyPrint() { 139 public String prettyPrint() {
140 StringBuilder result = new StringBuilder(); 140 StringBuilder result = new StringBuilder();
141 result.append("\"m\"=" + prettyPrintValue(fM)); 141 result.append("\"m\"=" + prettyPrintValue(fM));
142 return result.toString(); 142 return result.toString();
143 } 143 }
144 144
145 @Override 145 @Override
146 public int hashCode() { 146 public int hashCode() {
147 return Objects.hash(fM); 147 return Objects.hash(fM);
148 } 148 }
149 149
150 @Override 150 @Override
151 public boolean equals(final Object obj) { 151 public boolean equals(final Object obj) {
152 if (this == obj) 152 if (this == obj)
153 return true; 153 return true;
154 if (obj == null) { 154 if (obj == null) {
155 return false; 155 return false;
156 } 156 }
157 if ((obj instanceof MemberIsItsOwnParent.Match)) { 157 if ((obj instanceof MemberIsItsOwnParent.Match)) {
158 MemberIsItsOwnParent.Match other = (MemberIsItsOwnParent.Match) obj; 158 MemberIsItsOwnParent.Match other = (MemberIsItsOwnParent.Match) obj;
159 return Objects.equals(fM, other.fM); 159 return Objects.equals(fM, other.fM);
160 } else { 160 } else {
161 // this should be infrequent 161 // this should be infrequent
162 if (!(obj instanceof IPatternMatch)) { 162 if (!(obj instanceof IPatternMatch)) {
163 return false; 163 return false;
164 } 164 }
165 IPatternMatch otherSig = (IPatternMatch) obj; 165 IPatternMatch otherSig = (IPatternMatch) obj;
166 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); 166 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
167 } 167 }
168 } 168 }
169 169
170 @Override 170 @Override
171 public MemberIsItsOwnParent specification() { 171 public MemberIsItsOwnParent specification() {
172 return MemberIsItsOwnParent.instance(); 172 return MemberIsItsOwnParent.instance();
173 } 173 }
174 174
175 /** 175 /**
176 * Returns an empty, mutable match. 176 * Returns an empty, mutable match.
177 * Fields of the mutable match can be filled to create a partial match, usable as matcher input. 177 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
178 * 178 *
179 * @return the empty match. 179 * @return the empty match.
180 * 180 *
181 */ 181 */
182 public static MemberIsItsOwnParent.Match newEmptyMatch() { 182 public static MemberIsItsOwnParent.Match newEmptyMatch() {
183 return new Mutable(null); 183 return new Mutable(null);
184 } 184 }
185 185
186 /** 186 /**
187 * Returns a mutable (partial) match. 187 * Returns a mutable (partial) match.
188 * Fields of the mutable match can be filled to create a partial match, usable as matcher input. 188 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
189 * 189 *
190 * @param pM the fixed value of pattern parameter m, or null if not bound. 190 * @param pM the fixed value of pattern parameter m, or null if not bound.
191 * @return the new, mutable (partial) match object. 191 * @return the new, mutable (partial) match object.
192 * 192 *
193 */ 193 */
194 public static MemberIsItsOwnParent.Match newMutableMatch(final Member pM) { 194 public static MemberIsItsOwnParent.Match newMutableMatch(final Member pM) {
195 return new Mutable(pM); 195 return new Mutable(pM);
196 } 196 }
197 197
198 /** 198 /**
199 * Returns a new (partial) match. 199 * Returns a new (partial) match.
200 * This can be used e.g. to call the matcher with a partial match. 200 * This can be used e.g. to call the matcher with a partial match.
201 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. 201 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
202 * @param pM the fixed value of pattern parameter m, or null if not bound. 202 * @param pM the fixed value of pattern parameter m, or null if not bound.
203 * @return the (partial) match object. 203 * @return the (partial) match object.
204 * 204 *
205 */ 205 */
206 public static MemberIsItsOwnParent.Match newMatch(final Member pM) { 206 public static MemberIsItsOwnParent.Match newMatch(final Member pM) {
207 return new Immutable(pM); 207 return new Immutable(pM);
208 } 208 }
209 209
210 private static final class Mutable extends MemberIsItsOwnParent.Match { 210 private static final class Mutable extends MemberIsItsOwnParent.Match {
211 Mutable(final Member pM) { 211 Mutable(final Member pM) {
212 super(pM); 212 super(pM);
213 } 213 }
214 214
215 @Override 215 @Override
216 public boolean isMutable() { 216 public boolean isMutable() {
217 return true; 217 return true;
218 } 218 }
219 } 219 }
220 220
221 private static final class Immutable extends MemberIsItsOwnParent.Match { 221 private static final class Immutable extends MemberIsItsOwnParent.Match {
222 Immutable(final Member pM) { 222 Immutable(final Member pM) {
223 super(pM); 223 super(pM);
224 } 224 }
225 225
226 @Override 226 @Override
227 public boolean isMutable() { 227 public boolean isMutable() {
228 return false; 228 return false;
229 } 229 }
230 } 230 }
231 } 231 }
232 232
233 /** 233 /**
234 * Generated pattern matcher API of the queries.memberIsItsOwnParent pattern, 234 * Generated pattern matcher API of the queries.memberIsItsOwnParent pattern,
235 * providing pattern-specific query methods. 235 * providing pattern-specific query methods.
236 * 236 *
237 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, 237 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
238 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. 238 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
239 * 239 *
240 * <p>Matches of the pattern will be represented as {@link Match}. 240 * <p>Matches of the pattern will be represented as {@link Match}.
241 * 241 *
242 * <p>Original source: 242 * <p>Original source:
243 * <code><pre> 243 * <code><pre>
244 * {@literal @}Constraint(message="memberIsItsOwnParent", severity="error", key={m}) 244 * {@literal @}Constraint(message="memberIsItsOwnParent", severity="error", key={m})
245 * pattern memberIsItsOwnParent(m: Member) = { 245 * pattern memberIsItsOwnParent(m: Member) = {
246 * FamilyTree.members(_, m); 246 * FamilyTree.members(_, m);
247 * Member.parents(m, p); 247 * Member.parents(m, p);
248 * m == p; 248 * m == p;
249 * } 249 * }
250 * </pre></code> 250 * </pre></code>
251 * 251 *
252 * @see Match 252 * @see Match
253 * @see MemberIsItsOwnParent 253 * @see MemberIsItsOwnParent
254 * 254 *
255 */ 255 */
256 public static class Matcher extends BaseMatcher<MemberIsItsOwnParent.Match> { 256 public static class Matcher extends BaseMatcher<MemberIsItsOwnParent.Match> {
257 /** 257 /**
258 * Initializes the pattern matcher within an existing VIATRA Query engine. 258 * Initializes the pattern matcher within an existing VIATRA Query engine.
259 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. 259 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
260 * 260 *
261 * @param engine the existing VIATRA Query engine in which this matcher will be created. 261 * @param engine the existing VIATRA Query engine in which this matcher will be created.
262 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 262 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
263 * 263 *
264 */ 264 */
265 public static MemberIsItsOwnParent.Matcher on(final ViatraQueryEngine engine) { 265 public static MemberIsItsOwnParent.Matcher on(final ViatraQueryEngine engine) {
266 // check if matcher already exists 266 // check if matcher already exists
267 Matcher matcher = engine.getExistingMatcher(querySpecification()); 267 Matcher matcher = engine.getExistingMatcher(querySpecification());
268 if (matcher == null) { 268 if (matcher == null) {
269 matcher = (Matcher)engine.getMatcher(querySpecification()); 269 matcher = (Matcher)engine.getMatcher(querySpecification());
270 } 270 }
271 return matcher; 271 return matcher;
272 } 272 }
273 273
274 /** 274 /**
275 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 275 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
276 * @return an initialized matcher 276 * @return an initialized matcher
277 * @noreference This method is for internal matcher initialization by the framework, do not call it manually. 277 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
278 * 278 *
279 */ 279 */
280 public static MemberIsItsOwnParent.Matcher create() { 280 public static MemberIsItsOwnParent.Matcher create() {
281 return new Matcher(); 281 return new Matcher();
282 } 282 }
283 283
284 private static final int POSITION_M = 0; 284 private static final int POSITION_M = 0;
285 285
286 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MemberIsItsOwnParent.Matcher.class); 286 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MemberIsItsOwnParent.Matcher.class);
287 287
288 /** 288 /**
289 * Initializes the pattern matcher within an existing VIATRA Query engine. 289 * Initializes the pattern matcher within an existing VIATRA Query engine.
290 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. 290 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
291 * 291 *
292 * @param engine the existing VIATRA Query engine in which this matcher will be created. 292 * @param engine the existing VIATRA Query engine in which this matcher will be created.
293 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 293 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
294 * 294 *
295 */ 295 */
296 private Matcher() { 296 private Matcher() {
297 super(querySpecification()); 297 super(querySpecification());
298 } 298 }
299 299
300 /** 300 /**
301 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. 301 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
302 * @param pM the fixed value of pattern parameter m, or null if not bound. 302 * @param pM the fixed value of pattern parameter m, or null if not bound.
303 * @return matches represented as a Match object. 303 * @return matches represented as a Match object.
304 * 304 *
305 */ 305 */
306 public Collection<MemberIsItsOwnParent.Match> getAllMatches(final Member pM) { 306 public Collection<MemberIsItsOwnParent.Match> getAllMatches(final Member pM) {
307 return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet()); 307 return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet());
308 } 308 }
309 309
310 /** 310 /**
311 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. 311 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
312 * </p> 312 * </p>
313 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 313 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
314 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 314 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
315 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 315 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
316 * @param pM the fixed value of pattern parameter m, or null if not bound. 316 * @param pM the fixed value of pattern parameter m, or null if not bound.
317 * @return a stream of matches represented as a Match object. 317 * @return a stream of matches represented as a Match object.
318 * 318 *
319 */ 319 */
320 public Stream<MemberIsItsOwnParent.Match> streamAllMatches(final Member pM) { 320 public Stream<MemberIsItsOwnParent.Match> streamAllMatches(final Member pM) {
321 return rawStreamAllMatches(new Object[]{pM}); 321 return rawStreamAllMatches(new Object[]{pM});
322 } 322 }
323 323
324 /** 324 /**
325 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. 325 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
326 * Neither determinism nor randomness of selection is guaranteed. 326 * Neither determinism nor randomness of selection is guaranteed.
327 * @param pM the fixed value of pattern parameter m, or null if not bound. 327 * @param pM the fixed value of pattern parameter m, or null if not bound.
328 * @return a match represented as a Match object, or null if no match is found. 328 * @return a match represented as a Match object, or null if no match is found.
329 * 329 *
330 */ 330 */
331 public Optional<MemberIsItsOwnParent.Match> getOneArbitraryMatch(final Member pM) { 331 public Optional<MemberIsItsOwnParent.Match> getOneArbitraryMatch(final Member pM) {
332 return rawGetOneArbitraryMatch(new Object[]{pM}); 332 return rawGetOneArbitraryMatch(new Object[]{pM});
333 } 333 }
334 334
335 /** 335 /**
336 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, 336 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
337 * under any possible substitution of the unspecified parameters (if any). 337 * under any possible substitution of the unspecified parameters (if any).
338 * @param pM the fixed value of pattern parameter m, or null if not bound. 338 * @param pM the fixed value of pattern parameter m, or null if not bound.
339 * @return true if the input is a valid (partial) match of the pattern. 339 * @return true if the input is a valid (partial) match of the pattern.
340 * 340 *
341 */ 341 */
342 public boolean hasMatch(final Member pM) { 342 public boolean hasMatch(final Member pM) {
343 return rawHasMatch(new Object[]{pM}); 343 return rawHasMatch(new Object[]{pM});
344 } 344 }
345 345
346 /** 346 /**
347 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. 347 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
348 * @param pM the fixed value of pattern parameter m, or null if not bound. 348 * @param pM the fixed value of pattern parameter m, or null if not bound.
349 * @return the number of pattern matches found. 349 * @return the number of pattern matches found.
350 * 350 *
351 */ 351 */
352 public int countMatches(final Member pM) { 352 public int countMatches(final Member pM) {
353 return rawCountMatches(new Object[]{pM}); 353 return rawCountMatches(new Object[]{pM});
354 } 354 }
355 355
356 /** 356 /**
357 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. 357 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
358 * Neither determinism nor randomness of selection is guaranteed. 358 * Neither determinism nor randomness of selection is guaranteed.
359 * @param pM the fixed value of pattern parameter m, or null if not bound. 359 * @param pM the fixed value of pattern parameter m, or null if not bound.
360 * @param processor the action that will process the selected match. 360 * @param processor the action that will process the selected match.
361 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked 361 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
362 * 362 *
363 */ 363 */
364 public boolean forOneArbitraryMatch(final Member pM, final Consumer<? super MemberIsItsOwnParent.Match> processor) { 364 public boolean forOneArbitraryMatch(final Member pM, final Consumer<? super MemberIsItsOwnParent.Match> processor) {
365 return rawForOneArbitraryMatch(new Object[]{pM}, processor); 365 return rawForOneArbitraryMatch(new Object[]{pM}, processor);
366 } 366 }
367 367
368 /** 368 /**
369 * Returns a new (partial) match. 369 * Returns a new (partial) match.
370 * This can be used e.g. to call the matcher with a partial match. 370 * This can be used e.g. to call the matcher with a partial match.
371 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. 371 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
372 * @param pM the fixed value of pattern parameter m, or null if not bound. 372 * @param pM the fixed value of pattern parameter m, or null if not bound.
373 * @return the (partial) match object. 373 * @return the (partial) match object.
374 * 374 *
375 */ 375 */
376 public MemberIsItsOwnParent.Match newMatch(final Member pM) { 376 public MemberIsItsOwnParent.Match newMatch(final Member pM) {
377 return MemberIsItsOwnParent.Match.newMatch(pM); 377 return MemberIsItsOwnParent.Match.newMatch(pM);
378 } 378 }
379 379
380 /** 380 /**
381 * Retrieve the set of values that occur in matches for m. 381 * Retrieve the set of values that occur in matches for m.
382 * @return the Set of all values or empty set if there are no matches 382 * @return the Set of all values or empty set if there are no matches
383 * 383 *
384 */ 384 */
385 protected Stream<Member> rawStreamAllValuesOfm(final Object[] parameters) { 385 protected Stream<Member> rawStreamAllValuesOfm(final Object[] parameters) {
386 return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast); 386 return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast);
387 } 387 }
388 388
389 /** 389 /**
390 * Retrieve the set of values that occur in matches for m. 390 * Retrieve the set of values that occur in matches for m.
391 * @return the Set of all values or empty set if there are no matches 391 * @return the Set of all values or empty set if there are no matches
392 * 392 *
393 */ 393 */
394 public Set<Member> getAllValuesOfm() { 394 public Set<Member> getAllValuesOfm() {
395 return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet()); 395 return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet());
396 } 396 }
397 397
398 /** 398 /**
399 * Retrieve the set of values that occur in matches for m. 399 * Retrieve the set of values that occur in matches for m.
400 * @return the Set of all values or empty set if there are no matches 400 * @return the Set of all values or empty set if there are no matches
401 * 401 *
402 */ 402 */
403 public Stream<Member> streamAllValuesOfm() { 403 public Stream<Member> streamAllValuesOfm() {
404 return rawStreamAllValuesOfm(emptyArray()); 404 return rawStreamAllValuesOfm(emptyArray());
405 } 405 }
406 406
407 @Override 407 @Override
408 protected MemberIsItsOwnParent.Match tupleToMatch(final Tuple t) { 408 protected MemberIsItsOwnParent.Match tupleToMatch(final Tuple t) {
409 try { 409 try {
410 return MemberIsItsOwnParent.Match.newMatch((Member) t.get(POSITION_M)); 410 return MemberIsItsOwnParent.Match.newMatch((Member) t.get(POSITION_M));
411 } catch(ClassCastException e) { 411 } catch(ClassCastException e) {
412 LOGGER.error("Element(s) in tuple not properly typed!",e); 412 LOGGER.error("Element(s) in tuple not properly typed!",e);
413 return null; 413 return null;
414 } 414 }
415 } 415 }
416 416
417 @Override 417 @Override
418 protected MemberIsItsOwnParent.Match arrayToMatch(final Object[] match) { 418 protected MemberIsItsOwnParent.Match arrayToMatch(final Object[] match) {
419 try { 419 try {
420 return MemberIsItsOwnParent.Match.newMatch((Member) match[POSITION_M]); 420 return MemberIsItsOwnParent.Match.newMatch((Member) match[POSITION_M]);
421 } catch(ClassCastException e) { 421 } catch(ClassCastException e) {
422 LOGGER.error("Element(s) in array not properly typed!",e); 422 LOGGER.error("Element(s) in array not properly typed!",e);
423 return null; 423 return null;
424 } 424 }
425 } 425 }
426 426
427 @Override 427 @Override
428 protected MemberIsItsOwnParent.Match arrayToMatchMutable(final Object[] match) { 428 protected MemberIsItsOwnParent.Match arrayToMatchMutable(final Object[] match) {
429 try { 429 try {
430 return MemberIsItsOwnParent.Match.newMutableMatch((Member) match[POSITION_M]); 430 return MemberIsItsOwnParent.Match.newMutableMatch((Member) match[POSITION_M]);
431 } catch(ClassCastException e) { 431 } catch(ClassCastException e) {
432 LOGGER.error("Element(s) in array not properly typed!",e); 432 LOGGER.error("Element(s) in array not properly typed!",e);
433 return null; 433 return null;
434 } 434 }
435 } 435 }
436 436
437 /** 437 /**
438 * @return the singleton instance of the query specification of this pattern 438 * @return the singleton instance of the query specification of this pattern
439 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded 439 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
440 * 440 *
441 */ 441 */
442 public static IQuerySpecification<MemberIsItsOwnParent.Matcher> querySpecification() { 442 public static IQuerySpecification<MemberIsItsOwnParent.Matcher> querySpecification() {
443 return MemberIsItsOwnParent.instance(); 443 return MemberIsItsOwnParent.instance();
444 } 444 }
445 } 445 }
446 446
447 private MemberIsItsOwnParent() { 447 private MemberIsItsOwnParent() {
448 super(GeneratedPQuery.INSTANCE); 448 super(GeneratedPQuery.INSTANCE);
449 } 449 }
450 450
451 /** 451 /**
452 * @return the singleton instance of the query specification 452 * @return the singleton instance of the query specification
453 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded 453 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
454 * 454 *
455 */ 455 */
456 public static MemberIsItsOwnParent instance() { 456 public static MemberIsItsOwnParent instance() {
457 try{ 457 try{
458 return LazyHolder.INSTANCE; 458 return LazyHolder.INSTANCE;
459 } catch (ExceptionInInitializerError err) { 459 } catch (ExceptionInInitializerError err) {
460 throw processInitializerError(err); 460 throw processInitializerError(err);
461 } 461 }
462 } 462 }
463 463
464 @Override 464 @Override
465 protected MemberIsItsOwnParent.Matcher instantiate(final ViatraQueryEngine engine) { 465 protected MemberIsItsOwnParent.Matcher instantiate(final ViatraQueryEngine engine) {
466 return MemberIsItsOwnParent.Matcher.on(engine); 466 return MemberIsItsOwnParent.Matcher.on(engine);
467 } 467 }
468 468
469 @Override 469 @Override
470 public MemberIsItsOwnParent.Matcher instantiate() { 470 public MemberIsItsOwnParent.Matcher instantiate() {
471 return MemberIsItsOwnParent.Matcher.create(); 471 return MemberIsItsOwnParent.Matcher.create();
472 } 472 }
473 473
474 @Override 474 @Override
475 public MemberIsItsOwnParent.Match newEmptyMatch() { 475 public MemberIsItsOwnParent.Match newEmptyMatch() {
476 return MemberIsItsOwnParent.Match.newEmptyMatch(); 476 return MemberIsItsOwnParent.Match.newEmptyMatch();
477 } 477 }
478 478
479 @Override 479 @Override
480 public MemberIsItsOwnParent.Match newMatch(final Object... parameters) { 480 public MemberIsItsOwnParent.Match newMatch(final Object... parameters) {
481 return MemberIsItsOwnParent.Match.newMatch((familytree.Member) parameters[0]); 481 return MemberIsItsOwnParent.Match.newMatch((familytree.Member) parameters[0]);
482 } 482 }
483 483
484 /** 484 /**
485 * Inner class allowing the singleton instance of {@link MemberIsItsOwnParent} to be created 485 * Inner class allowing the singleton instance of {@link MemberIsItsOwnParent} to be created
486 * <b>not</b> at the class load time of the outer class, 486 * <b>not</b> at the class load time of the outer class,
487 * but rather at the first call to {@link MemberIsItsOwnParent#instance()}. 487 * but rather at the first call to {@link MemberIsItsOwnParent#instance()}.
488 * 488 *
489 * <p> This workaround is required e.g. to support recursion. 489 * <p> This workaround is required e.g. to support recursion.
490 * 490 *
491 */ 491 */
492 private static class LazyHolder { 492 private static class LazyHolder {
493 private static final MemberIsItsOwnParent INSTANCE = new MemberIsItsOwnParent(); 493 private static final MemberIsItsOwnParent INSTANCE = new MemberIsItsOwnParent();
494 494
495 /** 495 /**
496 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. 496 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
497 * This initialization order is required to support indirect recursion. 497 * This initialization order is required to support indirect recursion.
498 * 498 *
499 * <p> The static initializer is defined using a helper field to work around limitations of the code generator. 499 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
500 * 500 *
501 */ 501 */
502 private static final Object STATIC_INITIALIZER = ensureInitialized(); 502 private static final Object STATIC_INITIALIZER = ensureInitialized();
503 503
504 public static Object ensureInitialized() { 504 public static Object ensureInitialized() {
505 INSTANCE.ensureInitializedInternal(); 505 INSTANCE.ensureInitializedInternal();
506 return null; 506 return null;
507 } 507 }
508 } 508 }
509 509
510 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { 510 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
511 private static final MemberIsItsOwnParent.GeneratedPQuery INSTANCE = new GeneratedPQuery(); 511 private static final MemberIsItsOwnParent.GeneratedPQuery INSTANCE = new GeneratedPQuery();
512 512
513 private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); 513 private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
514 514
515 private final List<PParameter> parameters = Arrays.asList(parameter_m); 515 private final List<PParameter> parameters = Arrays.asList(parameter_m);
516 516
517 private GeneratedPQuery() { 517 private GeneratedPQuery() {
518 super(PVisibility.PUBLIC); 518 super(PVisibility.PUBLIC);
519 } 519 }
520 520
521 @Override 521 @Override
522 public String getFullyQualifiedName() { 522 public String getFullyQualifiedName() {
523 return "queries.memberIsItsOwnParent"; 523 return "queries.memberIsItsOwnParent";
524 } 524 }
525 525
526 @Override 526 @Override
527 public List<String> getParameterNames() { 527 public List<String> getParameterNames() {
528 return Arrays.asList("m"); 528 return Arrays.asList("m");
529 } 529 }
530 530
531 @Override 531 @Override
532 public List<PParameter> getParameters() { 532 public List<PParameter> getParameters() {
533 return parameters; 533 return parameters;
534 } 534 }
535 535
536 @Override 536 @Override
537 public Set<PBody> doGetContainedBodies() { 537 public Set<PBody> doGetContainedBodies() {
538 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); 538 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
539 Set<PBody> bodies = new LinkedHashSet<>(); 539 Set<PBody> bodies = new LinkedHashSet<>();
540 { 540 {
541 PBody body = new PBody(this); 541 PBody body = new PBody(this);
542 PVariable var_m = body.getOrCreateVariableByName("m"); 542 PVariable var_m = body.getOrCreateVariableByName("m");
543 PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); 543 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
544 PVariable var_p = body.getOrCreateVariableByName("p"); 544 PVariable var_p = body.getOrCreateVariableByName("p");
545 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 545 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
546 body.setSymbolicParameters(Arrays.<ExportedParameter>asList( 546 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
547 new ExportedParameter(body, var_m, parameter_m) 547 new ExportedParameter(body, var_m, parameter_m)
548 )); 548 ));
549 // FamilyTree.members(_, m) 549 // FamilyTree.members(_, m)
550 new TypeConstraint(body, Tuples.flatTupleOf(var___0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "FamilyTree"))); 550 new TypeConstraint(body, Tuples.flatTupleOf(var___0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "FamilyTree")));
551 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); 551 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
552 new TypeConstraint(body, Tuples.flatTupleOf(var___0_, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "FamilyTree", "members"))); 552 new TypeConstraint(body, Tuples.flatTupleOf(var___0_, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "FamilyTree", "members")));
553 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 553 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
554 new Equality(body, var__virtual_0_, var_m); 554 new Equality(body, var__virtual_0_, var_m);
555 // Member.parents(m, p) 555 // Member.parents(m, p)
556 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 556 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
557 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); 557 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
558 new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "parents"))); 558 new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "parents")));
559 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 559 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
560 new Equality(body, var__virtual_1_, var_p); 560 new Equality(body, var__virtual_1_, var_p);
561 // m == p 561 // m == p
562 new Equality(body, var_m, var_p); 562 new Equality(body, var_m, var_p);
563 bodies.add(body); 563 bodies.add(body);
564 } 564 }
565 { 565 {
566 PAnnotation annotation = new PAnnotation("Constraint"); 566 PAnnotation annotation = new PAnnotation("Constraint");
567 annotation.addAttribute("message", "memberIsItsOwnParent"); 567 annotation.addAttribute("message", "memberIsItsOwnParent");
568 annotation.addAttribute("severity", "error"); 568 annotation.addAttribute("severity", "error");
569 annotation.addAttribute("key", Arrays.asList(new Object[] { 569 annotation.addAttribute("key", Arrays.asList(new Object[] {
570 new ParameterReference("m") 570 new ParameterReference("m")
571 })); 571 }));
572 addAnnotation(annotation); 572 addAnnotation(annotation);
573 } 573 }
574 return bodies; 574 return bodies;
575 } 575 }
576 } 576 }
577} 577}
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/ParentTooYoung.java b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/ParentTooYoung.java
index e90186e2..726ab7e4 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/ParentTooYoung.java
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/ParentTooYoung.java
@@ -1,775 +1,775 @@
1/** 1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql 2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */ 3 */
4package queries; 4package queries;
5 5
6import familytree.Member; 6import familytree.Member;
7import java.util.Arrays; 7import java.util.Arrays;
8import java.util.Collection; 8import java.util.Collection;
9import java.util.LinkedHashSet; 9import java.util.LinkedHashSet;
10import java.util.List; 10import java.util.List;
11import java.util.Objects; 11import java.util.Objects;
12import java.util.Optional; 12import java.util.Optional;
13import java.util.Set; 13import java.util.Set;
14import java.util.function.Consumer; 14import java.util.function.Consumer;
15import java.util.stream.Collectors; 15import java.util.stream.Collectors;
16import java.util.stream.Stream; 16import java.util.stream.Stream;
17import org.apache.log4j.Logger; 17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass; 18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.emf.ecore.EDataType; 19import org.eclipse.emf.ecore.EDataType;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch; 20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification; 21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; 22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; 23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; 24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; 25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; 26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; 27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; 28import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
29import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; 29import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
30import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; 30import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
31import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; 31import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator;
32import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; 32import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider;
33import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; 33import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
34import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; 34import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; 35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
36import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; 36import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; 37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; 38import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; 39import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation;
40import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; 40import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; 41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; 42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
43import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; 43import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; 44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
45import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; 45import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
46import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; 46import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
47 47
48/** 48/**
49 * A pattern-specific query specification that can instantiate Matcher in a type-safe way. 49 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
50 * 50 *
51 * <p>Original source: 51 * <p>Original source:
52 * <code><pre> 52 * <code><pre>
53 * {@literal @}Constraint(message="parentTooYoung", severity="error", key={m, p}) 53 * {@literal @}Constraint(message="parentTooYoung", severity="error", key={m, p})
54 * pattern parentTooYoung(m: Member, p: Member) = { 54 * pattern parentTooYoung(m: Member, p: Member) = {
55 * FamilyTree.members(_, m); 55 * FamilyTree.members(_, m);
56 * Member.parents(m, p); 56 * Member.parents(m, p);
57 * Member.age(m, mAge); 57 * Member.age(m, mAge);
58 * Member.age(p, pAge); 58 * Member.age(p, pAge);
59 * check (mAge {@literal <}= (pAge + 12)); 59 * check (mAge {@literal <}= (pAge + 12));
60 * } 60 * }
61 * </pre></code> 61 * </pre></code>
62 * 62 *
63 * @see Matcher 63 * @see Matcher
64 * @see Match 64 * @see Match
65 * 65 *
66 */ 66 */
67@SuppressWarnings("all") 67@SuppressWarnings("all")
68public final class ParentTooYoung extends BaseGeneratedEMFQuerySpecification<ParentTooYoung.Matcher> { 68public final class ParentTooYoung extends BaseGeneratedEMFQuerySpecification<ParentTooYoung.Matcher> {
69 /** 69 /**
70 * Pattern-specific match representation of the queries.parentTooYoung pattern, 70 * Pattern-specific match representation of the queries.parentTooYoung pattern,
71 * to be used in conjunction with {@link Matcher}. 71 * to be used in conjunction with {@link Matcher}.
72 * 72 *
73 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. 73 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
74 * Each instance is a (possibly partial) substitution of pattern parameters, 74 * Each instance is a (possibly partial) substitution of pattern parameters,
75 * usable to represent a match of the pattern in the result of a query, 75 * usable to represent a match of the pattern in the result of a query,
76 * or to specify the bound (fixed) input parameters when issuing a query. 76 * or to specify the bound (fixed) input parameters when issuing a query.
77 * 77 *
78 * @see Matcher 78 * @see Matcher
79 * 79 *
80 */ 80 */
81 public static abstract class Match extends BasePatternMatch { 81 public static abstract class Match extends BasePatternMatch {
82 private Member fM; 82 private Member fM;
83 83
84 private Member fP; 84 private Member fP;
85 85
86 private static List<String> parameterNames = makeImmutableList("m", "p"); 86 private static List<String> parameterNames = makeImmutableList("m", "p");
87 87
88 private Match(final Member pM, final Member pP) { 88 private Match(final Member pM, final Member pP) {
89 this.fM = pM; 89 this.fM = pM;
90 this.fP = pP; 90 this.fP = pP;
91 } 91 }
92 92
93 @Override 93 @Override
94 public Object get(final String parameterName) { 94 public Object get(final String parameterName) {
95 switch(parameterName) { 95 switch(parameterName) {
96 case "m": return this.fM; 96 case "m": return this.fM;
97 case "p": return this.fP; 97 case "p": return this.fP;
98 default: return null; 98 default: return null;
99 } 99 }
100 } 100 }
101 101
102 @Override 102 @Override
103 public Object get(final int index) { 103 public Object get(final int index) {
104 switch(index) { 104 switch(index) {
105 case 0: return this.fM; 105 case 0: return this.fM;
106 case 1: return this.fP; 106 case 1: return this.fP;
107 default: return null; 107 default: return null;
108 } 108 }
109 } 109 }
110 110
111 public Member getM() { 111 public Member getM() {
112 return this.fM; 112 return this.fM;
113 } 113 }
114 114
115 public Member getP() { 115 public Member getP() {
116 return this.fP; 116 return this.fP;
117 } 117 }
118 118
119 @Override 119 @Override
120 public boolean set(final String parameterName, final Object newValue) { 120 public boolean set(final String parameterName, final Object newValue) {
121 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 121 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
122 if ("m".equals(parameterName) ) { 122 if ("m".equals(parameterName) ) {
123 this.fM = (Member) newValue; 123 this.fM = (Member) newValue;
124 return true; 124 return true;
125 } 125 }
126 if ("p".equals(parameterName) ) { 126 if ("p".equals(parameterName) ) {
127 this.fP = (Member) newValue; 127 this.fP = (Member) newValue;
128 return true; 128 return true;
129 } 129 }
130 return false; 130 return false;
131 } 131 }
132 132
133 public void setM(final Member pM) { 133 public void setM(final Member pM) {
134 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 134 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
135 this.fM = pM; 135 this.fM = pM;
136 } 136 }
137 137
138 public void setP(final Member pP) { 138 public void setP(final Member pP) {
139 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 139 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
140 this.fP = pP; 140 this.fP = pP;
141 } 141 }
142 142
143 @Override 143 @Override
144 public String patternName() { 144 public String patternName() {
145 return "queries.parentTooYoung"; 145 return "queries.parentTooYoung";
146 } 146 }
147 147
148 @Override 148 @Override
149 public List<String> parameterNames() { 149 public List<String> parameterNames() {
150 return ParentTooYoung.Match.parameterNames; 150 return ParentTooYoung.Match.parameterNames;
151 } 151 }
152 152
153 @Override 153 @Override
154 public Object[] toArray() { 154 public Object[] toArray() {
155 return new Object[]{fM, fP}; 155 return new Object[]{fM, fP};
156 } 156 }
157 157
158 @Override 158 @Override
159 public ParentTooYoung.Match toImmutable() { 159 public ParentTooYoung.Match toImmutable() {
160 return isMutable() ? newMatch(fM, fP) : this; 160 return isMutable() ? newMatch(fM, fP) : this;
161 } 161 }
162 162
163 @Override 163 @Override
164 public String prettyPrint() { 164 public String prettyPrint() {
165 StringBuilder result = new StringBuilder(); 165 StringBuilder result = new StringBuilder();
166 result.append("\"m\"=" + prettyPrintValue(fM) + ", "); 166 result.append("\"m\"=" + prettyPrintValue(fM) + ", ");
167 result.append("\"p\"=" + prettyPrintValue(fP)); 167 result.append("\"p\"=" + prettyPrintValue(fP));
168 return result.toString(); 168 return result.toString();
169 } 169 }
170 170
171 @Override 171 @Override
172 public int hashCode() { 172 public int hashCode() {
173 return Objects.hash(fM, fP); 173 return Objects.hash(fM, fP);
174 } 174 }
175 175
176 @Override 176 @Override
177 public boolean equals(final Object obj) { 177 public boolean equals(final Object obj) {
178 if (this == obj) 178 if (this == obj)
179 return true; 179 return true;
180 if (obj == null) { 180 if (obj == null) {
181 return false; 181 return false;
182 } 182 }
183 if ((obj instanceof ParentTooYoung.Match)) { 183 if ((obj instanceof ParentTooYoung.Match)) {
184 ParentTooYoung.Match other = (ParentTooYoung.Match) obj; 184 ParentTooYoung.Match other = (ParentTooYoung.Match) obj;
185 return Objects.equals(fM, other.fM) && Objects.equals(fP, other.fP); 185 return Objects.equals(fM, other.fM) && Objects.equals(fP, other.fP);
186 } else { 186 } else {
187 // this should be infrequent 187 // this should be infrequent
188 if (!(obj instanceof IPatternMatch)) { 188 if (!(obj instanceof IPatternMatch)) {
189 return false; 189 return false;
190 } 190 }
191 IPatternMatch otherSig = (IPatternMatch) obj; 191 IPatternMatch otherSig = (IPatternMatch) obj;
192 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); 192 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
193 } 193 }
194 } 194 }
195 195
196 @Override 196 @Override
197 public ParentTooYoung specification() { 197 public ParentTooYoung specification() {
198 return ParentTooYoung.instance(); 198 return ParentTooYoung.instance();
199 } 199 }
200 200
201 /** 201 /**
202 * Returns an empty, mutable match. 202 * Returns an empty, mutable match.
203 * Fields of the mutable match can be filled to create a partial match, usable as matcher input. 203 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
204 * 204 *
205 * @return the empty match. 205 * @return the empty match.
206 * 206 *
207 */ 207 */
208 public static ParentTooYoung.Match newEmptyMatch() { 208 public static ParentTooYoung.Match newEmptyMatch() {
209 return new Mutable(null, null); 209 return new Mutable(null, null);
210 } 210 }
211 211
212 /** 212 /**
213 * Returns a mutable (partial) match. 213 * Returns a mutable (partial) match.
214 * Fields of the mutable match can be filled to create a partial match, usable as matcher input. 214 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
215 * 215 *
216 * @param pM the fixed value of pattern parameter m, or null if not bound. 216 * @param pM the fixed value of pattern parameter m, or null if not bound.
217 * @param pP the fixed value of pattern parameter p, or null if not bound. 217 * @param pP the fixed value of pattern parameter p, or null if not bound.
218 * @return the new, mutable (partial) match object. 218 * @return the new, mutable (partial) match object.
219 * 219 *
220 */ 220 */
221 public static ParentTooYoung.Match newMutableMatch(final Member pM, final Member pP) { 221 public static ParentTooYoung.Match newMutableMatch(final Member pM, final Member pP) {
222 return new Mutable(pM, pP); 222 return new Mutable(pM, pP);
223 } 223 }
224 224
225 /** 225 /**
226 * Returns a new (partial) match. 226 * Returns a new (partial) match.
227 * This can be used e.g. to call the matcher with a partial match. 227 * This can be used e.g. to call the matcher with a partial match.
228 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. 228 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
229 * @param pM the fixed value of pattern parameter m, or null if not bound. 229 * @param pM the fixed value of pattern parameter m, or null if not bound.
230 * @param pP the fixed value of pattern parameter p, or null if not bound. 230 * @param pP the fixed value of pattern parameter p, or null if not bound.
231 * @return the (partial) match object. 231 * @return the (partial) match object.
232 * 232 *
233 */ 233 */
234 public static ParentTooYoung.Match newMatch(final Member pM, final Member pP) { 234 public static ParentTooYoung.Match newMatch(final Member pM, final Member pP) {
235 return new Immutable(pM, pP); 235 return new Immutable(pM, pP);
236 } 236 }
237 237
238 private static final class Mutable extends ParentTooYoung.Match { 238 private static final class Mutable extends ParentTooYoung.Match {
239 Mutable(final Member pM, final Member pP) { 239 Mutable(final Member pM, final Member pP) {
240 super(pM, pP); 240 super(pM, pP);
241 } 241 }
242 242
243 @Override 243 @Override
244 public boolean isMutable() { 244 public boolean isMutable() {
245 return true; 245 return true;
246 } 246 }
247 } 247 }
248 248
249 private static final class Immutable extends ParentTooYoung.Match { 249 private static final class Immutable extends ParentTooYoung.Match {
250 Immutable(final Member pM, final Member pP) { 250 Immutable(final Member pM, final Member pP) {
251 super(pM, pP); 251 super(pM, pP);
252 } 252 }
253 253
254 @Override 254 @Override
255 public boolean isMutable() { 255 public boolean isMutable() {
256 return false; 256 return false;
257 } 257 }
258 } 258 }
259 } 259 }
260 260
261 /** 261 /**
262 * Generated pattern matcher API of the queries.parentTooYoung pattern, 262 * Generated pattern matcher API of the queries.parentTooYoung pattern,
263 * providing pattern-specific query methods. 263 * providing pattern-specific query methods.
264 * 264 *
265 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, 265 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
266 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. 266 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
267 * 267 *
268 * <p>Matches of the pattern will be represented as {@link Match}. 268 * <p>Matches of the pattern will be represented as {@link Match}.
269 * 269 *
270 * <p>Original source: 270 * <p>Original source:
271 * <code><pre> 271 * <code><pre>
272 * {@literal @}Constraint(message="parentTooYoung", severity="error", key={m, p}) 272 * {@literal @}Constraint(message="parentTooYoung", severity="error", key={m, p})
273 * pattern parentTooYoung(m: Member, p: Member) = { 273 * pattern parentTooYoung(m: Member, p: Member) = {
274 * FamilyTree.members(_, m); 274 * FamilyTree.members(_, m);
275 * Member.parents(m, p); 275 * Member.parents(m, p);
276 * Member.age(m, mAge); 276 * Member.age(m, mAge);
277 * Member.age(p, pAge); 277 * Member.age(p, pAge);
278 * check (mAge {@literal <}= (pAge + 12)); 278 * check (mAge {@literal <}= (pAge + 12));
279 * } 279 * }
280 * </pre></code> 280 * </pre></code>
281 * 281 *
282 * @see Match 282 * @see Match
283 * @see ParentTooYoung 283 * @see ParentTooYoung
284 * 284 *
285 */ 285 */
286 public static class Matcher extends BaseMatcher<ParentTooYoung.Match> { 286 public static class Matcher extends BaseMatcher<ParentTooYoung.Match> {
287 /** 287 /**
288 * Initializes the pattern matcher within an existing VIATRA Query engine. 288 * Initializes the pattern matcher within an existing VIATRA Query engine.
289 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. 289 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
290 * 290 *
291 * @param engine the existing VIATRA Query engine in which this matcher will be created. 291 * @param engine the existing VIATRA Query engine in which this matcher will be created.
292 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 292 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
293 * 293 *
294 */ 294 */
295 public static ParentTooYoung.Matcher on(final ViatraQueryEngine engine) { 295 public static ParentTooYoung.Matcher on(final ViatraQueryEngine engine) {
296 // check if matcher already exists 296 // check if matcher already exists
297 Matcher matcher = engine.getExistingMatcher(querySpecification()); 297 Matcher matcher = engine.getExistingMatcher(querySpecification());
298 if (matcher == null) { 298 if (matcher == null) {
299 matcher = (Matcher)engine.getMatcher(querySpecification()); 299 matcher = (Matcher)engine.getMatcher(querySpecification());
300 } 300 }
301 return matcher; 301 return matcher;
302 } 302 }
303 303
304 /** 304 /**
305 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 305 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
306 * @return an initialized matcher 306 * @return an initialized matcher
307 * @noreference This method is for internal matcher initialization by the framework, do not call it manually. 307 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
308 * 308 *
309 */ 309 */
310 public static ParentTooYoung.Matcher create() { 310 public static ParentTooYoung.Matcher create() {
311 return new Matcher(); 311 return new Matcher();
312 } 312 }
313 313
314 private static final int POSITION_M = 0; 314 private static final int POSITION_M = 0;
315 315
316 private static final int POSITION_P = 1; 316 private static final int POSITION_P = 1;
317 317
318 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ParentTooYoung.Matcher.class); 318 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ParentTooYoung.Matcher.class);
319 319
320 /** 320 /**
321 * Initializes the pattern matcher within an existing VIATRA Query engine. 321 * Initializes the pattern matcher within an existing VIATRA Query engine.
322 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. 322 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
323 * 323 *
324 * @param engine the existing VIATRA Query engine in which this matcher will be created. 324 * @param engine the existing VIATRA Query engine in which this matcher will be created.
325 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 325 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
326 * 326 *
327 */ 327 */
328 private Matcher() { 328 private Matcher() {
329 super(querySpecification()); 329 super(querySpecification());
330 } 330 }
331 331
332 /** 332 /**
333 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. 333 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
334 * @param pM the fixed value of pattern parameter m, or null if not bound. 334 * @param pM the fixed value of pattern parameter m, or null if not bound.
335 * @param pP the fixed value of pattern parameter p, or null if not bound. 335 * @param pP the fixed value of pattern parameter p, or null if not bound.
336 * @return matches represented as a Match object. 336 * @return matches represented as a Match object.
337 * 337 *
338 */ 338 */
339 public Collection<ParentTooYoung.Match> getAllMatches(final Member pM, final Member pP) { 339 public Collection<ParentTooYoung.Match> getAllMatches(final Member pM, final Member pP) {
340 return rawStreamAllMatches(new Object[]{pM, pP}).collect(Collectors.toSet()); 340 return rawStreamAllMatches(new Object[]{pM, pP}).collect(Collectors.toSet());
341 } 341 }
342 342
343 /** 343 /**
344 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. 344 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
345 * </p> 345 * </p>
346 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 346 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
347 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 347 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
348 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 348 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
349 * @param pM the fixed value of pattern parameter m, or null if not bound. 349 * @param pM the fixed value of pattern parameter m, or null if not bound.
350 * @param pP the fixed value of pattern parameter p, or null if not bound. 350 * @param pP the fixed value of pattern parameter p, or null if not bound.
351 * @return a stream of matches represented as a Match object. 351 * @return a stream of matches represented as a Match object.
352 * 352 *
353 */ 353 */
354 public Stream<ParentTooYoung.Match> streamAllMatches(final Member pM, final Member pP) { 354 public Stream<ParentTooYoung.Match> streamAllMatches(final Member pM, final Member pP) {
355 return rawStreamAllMatches(new Object[]{pM, pP}); 355 return rawStreamAllMatches(new Object[]{pM, pP});
356 } 356 }
357 357
358 /** 358 /**
359 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. 359 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
360 * Neither determinism nor randomness of selection is guaranteed. 360 * Neither determinism nor randomness of selection is guaranteed.
361 * @param pM the fixed value of pattern parameter m, or null if not bound. 361 * @param pM the fixed value of pattern parameter m, or null if not bound.
362 * @param pP the fixed value of pattern parameter p, or null if not bound. 362 * @param pP the fixed value of pattern parameter p, or null if not bound.
363 * @return a match represented as a Match object, or null if no match is found. 363 * @return a match represented as a Match object, or null if no match is found.
364 * 364 *
365 */ 365 */
366 public Optional<ParentTooYoung.Match> getOneArbitraryMatch(final Member pM, final Member pP) { 366 public Optional<ParentTooYoung.Match> getOneArbitraryMatch(final Member pM, final Member pP) {
367 return rawGetOneArbitraryMatch(new Object[]{pM, pP}); 367 return rawGetOneArbitraryMatch(new Object[]{pM, pP});
368 } 368 }
369 369
370 /** 370 /**
371 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, 371 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
372 * under any possible substitution of the unspecified parameters (if any). 372 * under any possible substitution of the unspecified parameters (if any).
373 * @param pM the fixed value of pattern parameter m, or null if not bound. 373 * @param pM the fixed value of pattern parameter m, or null if not bound.
374 * @param pP the fixed value of pattern parameter p, or null if not bound. 374 * @param pP the fixed value of pattern parameter p, or null if not bound.
375 * @return true if the input is a valid (partial) match of the pattern. 375 * @return true if the input is a valid (partial) match of the pattern.
376 * 376 *
377 */ 377 */
378 public boolean hasMatch(final Member pM, final Member pP) { 378 public boolean hasMatch(final Member pM, final Member pP) {
379 return rawHasMatch(new Object[]{pM, pP}); 379 return rawHasMatch(new Object[]{pM, pP});
380 } 380 }
381 381
382 /** 382 /**
383 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. 383 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
384 * @param pM the fixed value of pattern parameter m, or null if not bound. 384 * @param pM the fixed value of pattern parameter m, or null if not bound.
385 * @param pP the fixed value of pattern parameter p, or null if not bound. 385 * @param pP the fixed value of pattern parameter p, or null if not bound.
386 * @return the number of pattern matches found. 386 * @return the number of pattern matches found.
387 * 387 *
388 */ 388 */
389 public int countMatches(final Member pM, final Member pP) { 389 public int countMatches(final Member pM, final Member pP) {
390 return rawCountMatches(new Object[]{pM, pP}); 390 return rawCountMatches(new Object[]{pM, pP});
391 } 391 }
392 392
393 /** 393 /**
394 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. 394 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
395 * Neither determinism nor randomness of selection is guaranteed. 395 * Neither determinism nor randomness of selection is guaranteed.
396 * @param pM the fixed value of pattern parameter m, or null if not bound. 396 * @param pM the fixed value of pattern parameter m, or null if not bound.
397 * @param pP the fixed value of pattern parameter p, or null if not bound. 397 * @param pP the fixed value of pattern parameter p, or null if not bound.
398 * @param processor the action that will process the selected match. 398 * @param processor the action that will process the selected match.
399 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked 399 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
400 * 400 *
401 */ 401 */
402 public boolean forOneArbitraryMatch(final Member pM, final Member pP, final Consumer<? super ParentTooYoung.Match> processor) { 402 public boolean forOneArbitraryMatch(final Member pM, final Member pP, final Consumer<? super ParentTooYoung.Match> processor) {
403 return rawForOneArbitraryMatch(new Object[]{pM, pP}, processor); 403 return rawForOneArbitraryMatch(new Object[]{pM, pP}, processor);
404 } 404 }
405 405
406 /** 406 /**
407 * Returns a new (partial) match. 407 * Returns a new (partial) match.
408 * This can be used e.g. to call the matcher with a partial match. 408 * This can be used e.g. to call the matcher with a partial match.
409 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. 409 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
410 * @param pM the fixed value of pattern parameter m, or null if not bound. 410 * @param pM the fixed value of pattern parameter m, or null if not bound.
411 * @param pP the fixed value of pattern parameter p, or null if not bound. 411 * @param pP the fixed value of pattern parameter p, or null if not bound.
412 * @return the (partial) match object. 412 * @return the (partial) match object.
413 * 413 *
414 */ 414 */
415 public ParentTooYoung.Match newMatch(final Member pM, final Member pP) { 415 public ParentTooYoung.Match newMatch(final Member pM, final Member pP) {
416 return ParentTooYoung.Match.newMatch(pM, pP); 416 return ParentTooYoung.Match.newMatch(pM, pP);
417 } 417 }
418 418
419 /** 419 /**
420 * Retrieve the set of values that occur in matches for m. 420 * Retrieve the set of values that occur in matches for m.
421 * @return the Set of all values or empty set if there are no matches 421 * @return the Set of all values or empty set if there are no matches
422 * 422 *
423 */ 423 */
424 protected Stream<Member> rawStreamAllValuesOfm(final Object[] parameters) { 424 protected Stream<Member> rawStreamAllValuesOfm(final Object[] parameters) {
425 return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast); 425 return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast);
426 } 426 }
427 427
428 /** 428 /**
429 * Retrieve the set of values that occur in matches for m. 429 * Retrieve the set of values that occur in matches for m.
430 * @return the Set of all values or empty set if there are no matches 430 * @return the Set of all values or empty set if there are no matches
431 * 431 *
432 */ 432 */
433 public Set<Member> getAllValuesOfm() { 433 public Set<Member> getAllValuesOfm() {
434 return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet()); 434 return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet());
435 } 435 }
436 436
437 /** 437 /**
438 * Retrieve the set of values that occur in matches for m. 438 * Retrieve the set of values that occur in matches for m.
439 * @return the Set of all values or empty set if there are no matches 439 * @return the Set of all values or empty set if there are no matches
440 * 440 *
441 */ 441 */
442 public Stream<Member> streamAllValuesOfm() { 442 public Stream<Member> streamAllValuesOfm() {
443 return rawStreamAllValuesOfm(emptyArray()); 443 return rawStreamAllValuesOfm(emptyArray());
444 } 444 }
445 445
446 /** 446 /**
447 * Retrieve the set of values that occur in matches for m. 447 * Retrieve the set of values that occur in matches for m.
448 * </p> 448 * </p>
449 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 449 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
450 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 450 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
451 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 451 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
452 * 452 *
453 * @return the Stream of all values or empty set if there are no matches 453 * @return the Stream of all values or empty set if there are no matches
454 * 454 *
455 */ 455 */
456 public Stream<Member> streamAllValuesOfm(final ParentTooYoung.Match partialMatch) { 456 public Stream<Member> streamAllValuesOfm(final ParentTooYoung.Match partialMatch) {
457 return rawStreamAllValuesOfm(partialMatch.toArray()); 457 return rawStreamAllValuesOfm(partialMatch.toArray());
458 } 458 }
459 459
460 /** 460 /**
461 * Retrieve the set of values that occur in matches for m. 461 * Retrieve the set of values that occur in matches for m.
462 * </p> 462 * </p>
463 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 463 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
464 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 464 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
465 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 465 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
466 * 466 *
467 * @return the Stream of all values or empty set if there are no matches 467 * @return the Stream of all values or empty set if there are no matches
468 * 468 *
469 */ 469 */
470 public Stream<Member> streamAllValuesOfm(final Member pP) { 470 public Stream<Member> streamAllValuesOfm(final Member pP) {
471 return rawStreamAllValuesOfm(new Object[]{null, pP}); 471 return rawStreamAllValuesOfm(new Object[]{null, pP});
472 } 472 }
473 473
474 /** 474 /**
475 * Retrieve the set of values that occur in matches for m. 475 * Retrieve the set of values that occur in matches for m.
476 * @return the Set of all values or empty set if there are no matches 476 * @return the Set of all values or empty set if there are no matches
477 * 477 *
478 */ 478 */
479 public Set<Member> getAllValuesOfm(final ParentTooYoung.Match partialMatch) { 479 public Set<Member> getAllValuesOfm(final ParentTooYoung.Match partialMatch) {
480 return rawStreamAllValuesOfm(partialMatch.toArray()).collect(Collectors.toSet()); 480 return rawStreamAllValuesOfm(partialMatch.toArray()).collect(Collectors.toSet());
481 } 481 }
482 482
483 /** 483 /**
484 * Retrieve the set of values that occur in matches for m. 484 * Retrieve the set of values that occur in matches for m.
485 * @return the Set of all values or empty set if there are no matches 485 * @return the Set of all values or empty set if there are no matches
486 * 486 *
487 */ 487 */
488 public Set<Member> getAllValuesOfm(final Member pP) { 488 public Set<Member> getAllValuesOfm(final Member pP) {
489 return rawStreamAllValuesOfm(new Object[]{null, pP}).collect(Collectors.toSet()); 489 return rawStreamAllValuesOfm(new Object[]{null, pP}).collect(Collectors.toSet());
490 } 490 }
491 491
492 /** 492 /**
493 * Retrieve the set of values that occur in matches for p. 493 * Retrieve the set of values that occur in matches for p.
494 * @return the Set of all values or empty set if there are no matches 494 * @return the Set of all values or empty set if there are no matches
495 * 495 *
496 */ 496 */
497 protected Stream<Member> rawStreamAllValuesOfp(final Object[] parameters) { 497 protected Stream<Member> rawStreamAllValuesOfp(final Object[] parameters) {
498 return rawStreamAllValues(POSITION_P, parameters).map(Member.class::cast); 498 return rawStreamAllValues(POSITION_P, parameters).map(Member.class::cast);
499 } 499 }
500 500
501 /** 501 /**
502 * Retrieve the set of values that occur in matches for p. 502 * Retrieve the set of values that occur in matches for p.
503 * @return the Set of all values or empty set if there are no matches 503 * @return the Set of all values or empty set if there are no matches
504 * 504 *
505 */ 505 */
506 public Set<Member> getAllValuesOfp() { 506 public Set<Member> getAllValuesOfp() {
507 return rawStreamAllValuesOfp(emptyArray()).collect(Collectors.toSet()); 507 return rawStreamAllValuesOfp(emptyArray()).collect(Collectors.toSet());
508 } 508 }
509 509
510 /** 510 /**
511 * Retrieve the set of values that occur in matches for p. 511 * Retrieve the set of values that occur in matches for p.
512 * @return the Set of all values or empty set if there are no matches 512 * @return the Set of all values or empty set if there are no matches
513 * 513 *
514 */ 514 */
515 public Stream<Member> streamAllValuesOfp() { 515 public Stream<Member> streamAllValuesOfp() {
516 return rawStreamAllValuesOfp(emptyArray()); 516 return rawStreamAllValuesOfp(emptyArray());
517 } 517 }
518 518
519 /** 519 /**
520 * Retrieve the set of values that occur in matches for p. 520 * Retrieve the set of values that occur in matches for p.
521 * </p> 521 * </p>
522 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 522 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
523 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 523 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
524 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 524 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
525 * 525 *
526 * @return the Stream of all values or empty set if there are no matches 526 * @return the Stream of all values or empty set if there are no matches
527 * 527 *
528 */ 528 */
529 public Stream<Member> streamAllValuesOfp(final ParentTooYoung.Match partialMatch) { 529 public Stream<Member> streamAllValuesOfp(final ParentTooYoung.Match partialMatch) {
530 return rawStreamAllValuesOfp(partialMatch.toArray()); 530 return rawStreamAllValuesOfp(partialMatch.toArray());
531 } 531 }
532 532
533 /** 533 /**
534 * Retrieve the set of values that occur in matches for p. 534 * Retrieve the set of values that occur in matches for p.
535 * </p> 535 * </p>
536 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 536 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
537 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 537 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
538 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 538 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
539 * 539 *
540 * @return the Stream of all values or empty set if there are no matches 540 * @return the Stream of all values or empty set if there are no matches
541 * 541 *
542 */ 542 */
543 public Stream<Member> streamAllValuesOfp(final Member pM) { 543 public Stream<Member> streamAllValuesOfp(final Member pM) {
544 return rawStreamAllValuesOfp(new Object[]{pM, null}); 544 return rawStreamAllValuesOfp(new Object[]{pM, null});
545 } 545 }
546 546
547 /** 547 /**
548 * Retrieve the set of values that occur in matches for p. 548 * Retrieve the set of values that occur in matches for p.
549 * @return the Set of all values or empty set if there are no matches 549 * @return the Set of all values or empty set if there are no matches
550 * 550 *
551 */ 551 */
552 public Set<Member> getAllValuesOfp(final ParentTooYoung.Match partialMatch) { 552 public Set<Member> getAllValuesOfp(final ParentTooYoung.Match partialMatch) {
553 return rawStreamAllValuesOfp(partialMatch.toArray()).collect(Collectors.toSet()); 553 return rawStreamAllValuesOfp(partialMatch.toArray()).collect(Collectors.toSet());
554 } 554 }
555 555
556 /** 556 /**
557 * Retrieve the set of values that occur in matches for p. 557 * Retrieve the set of values that occur in matches for p.
558 * @return the Set of all values or empty set if there are no matches 558 * @return the Set of all values or empty set if there are no matches
559 * 559 *
560 */ 560 */
561 public Set<Member> getAllValuesOfp(final Member pM) { 561 public Set<Member> getAllValuesOfp(final Member pM) {
562 return rawStreamAllValuesOfp(new Object[]{pM, null}).collect(Collectors.toSet()); 562 return rawStreamAllValuesOfp(new Object[]{pM, null}).collect(Collectors.toSet());
563 } 563 }
564 564
565 @Override 565 @Override
566 protected ParentTooYoung.Match tupleToMatch(final Tuple t) { 566 protected ParentTooYoung.Match tupleToMatch(final Tuple t) {
567 try { 567 try {
568 return ParentTooYoung.Match.newMatch((Member) t.get(POSITION_M), (Member) t.get(POSITION_P)); 568 return ParentTooYoung.Match.newMatch((Member) t.get(POSITION_M), (Member) t.get(POSITION_P));
569 } catch(ClassCastException e) { 569 } catch(ClassCastException e) {
570 LOGGER.error("Element(s) in tuple not properly typed!",e); 570 LOGGER.error("Element(s) in tuple not properly typed!",e);
571 return null; 571 return null;
572 } 572 }
573 } 573 }
574 574
575 @Override 575 @Override
576 protected ParentTooYoung.Match arrayToMatch(final Object[] match) { 576 protected ParentTooYoung.Match arrayToMatch(final Object[] match) {
577 try { 577 try {
578 return ParentTooYoung.Match.newMatch((Member) match[POSITION_M], (Member) match[POSITION_P]); 578 return ParentTooYoung.Match.newMatch((Member) match[POSITION_M], (Member) match[POSITION_P]);
579 } catch(ClassCastException e) { 579 } catch(ClassCastException e) {
580 LOGGER.error("Element(s) in array not properly typed!",e); 580 LOGGER.error("Element(s) in array not properly typed!",e);
581 return null; 581 return null;
582 } 582 }
583 } 583 }
584 584
585 @Override 585 @Override
586 protected ParentTooYoung.Match arrayToMatchMutable(final Object[] match) { 586 protected ParentTooYoung.Match arrayToMatchMutable(final Object[] match) {
587 try { 587 try {
588 return ParentTooYoung.Match.newMutableMatch((Member) match[POSITION_M], (Member) match[POSITION_P]); 588 return ParentTooYoung.Match.newMutableMatch((Member) match[POSITION_M], (Member) match[POSITION_P]);
589 } catch(ClassCastException e) { 589 } catch(ClassCastException e) {
590 LOGGER.error("Element(s) in array not properly typed!",e); 590 LOGGER.error("Element(s) in array not properly typed!",e);
591 return null; 591 return null;
592 } 592 }
593 } 593 }
594 594
595 /** 595 /**
596 * @return the singleton instance of the query specification of this pattern 596 * @return the singleton instance of the query specification of this pattern
597 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded 597 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
598 * 598 *
599 */ 599 */
600 public static IQuerySpecification<ParentTooYoung.Matcher> querySpecification() { 600 public static IQuerySpecification<ParentTooYoung.Matcher> querySpecification() {
601 return ParentTooYoung.instance(); 601 return ParentTooYoung.instance();
602 } 602 }
603 } 603 }
604 604
605 private ParentTooYoung() { 605 private ParentTooYoung() {
606 super(GeneratedPQuery.INSTANCE); 606 super(GeneratedPQuery.INSTANCE);
607 } 607 }
608 608
609 /** 609 /**
610 * @return the singleton instance of the query specification 610 * @return the singleton instance of the query specification
611 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded 611 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
612 * 612 *
613 */ 613 */
614 public static ParentTooYoung instance() { 614 public static ParentTooYoung instance() {
615 try{ 615 try{
616 return LazyHolder.INSTANCE; 616 return LazyHolder.INSTANCE;
617 } catch (ExceptionInInitializerError err) { 617 } catch (ExceptionInInitializerError err) {
618 throw processInitializerError(err); 618 throw processInitializerError(err);
619 } 619 }
620 } 620 }
621 621
622 @Override 622 @Override
623 protected ParentTooYoung.Matcher instantiate(final ViatraQueryEngine engine) { 623 protected ParentTooYoung.Matcher instantiate(final ViatraQueryEngine engine) {
624 return ParentTooYoung.Matcher.on(engine); 624 return ParentTooYoung.Matcher.on(engine);
625 } 625 }
626 626
627 @Override 627 @Override
628 public ParentTooYoung.Matcher instantiate() { 628 public ParentTooYoung.Matcher instantiate() {
629 return ParentTooYoung.Matcher.create(); 629 return ParentTooYoung.Matcher.create();
630 } 630 }
631 631
632 @Override 632 @Override
633 public ParentTooYoung.Match newEmptyMatch() { 633 public ParentTooYoung.Match newEmptyMatch() {
634 return ParentTooYoung.Match.newEmptyMatch(); 634 return ParentTooYoung.Match.newEmptyMatch();
635 } 635 }
636 636
637 @Override 637 @Override
638 public ParentTooYoung.Match newMatch(final Object... parameters) { 638 public ParentTooYoung.Match newMatch(final Object... parameters) {
639 return ParentTooYoung.Match.newMatch((familytree.Member) parameters[0], (familytree.Member) parameters[1]); 639 return ParentTooYoung.Match.newMatch((familytree.Member) parameters[0], (familytree.Member) parameters[1]);
640 } 640 }
641 641
642 /** 642 /**
643 * Inner class allowing the singleton instance of {@link ParentTooYoung} to be created 643 * Inner class allowing the singleton instance of {@link ParentTooYoung} to be created
644 * <b>not</b> at the class load time of the outer class, 644 * <b>not</b> at the class load time of the outer class,
645 * but rather at the first call to {@link ParentTooYoung#instance()}. 645 * but rather at the first call to {@link ParentTooYoung#instance()}.
646 * 646 *
647 * <p> This workaround is required e.g. to support recursion. 647 * <p> This workaround is required e.g. to support recursion.
648 * 648 *
649 */ 649 */
650 private static class LazyHolder { 650 private static class LazyHolder {
651 private static final ParentTooYoung INSTANCE = new ParentTooYoung(); 651 private static final ParentTooYoung INSTANCE = new ParentTooYoung();
652 652
653 /** 653 /**
654 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. 654 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
655 * This initialization order is required to support indirect recursion. 655 * This initialization order is required to support indirect recursion.
656 * 656 *
657 * <p> The static initializer is defined using a helper field to work around limitations of the code generator. 657 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
658 * 658 *
659 */ 659 */
660 private static final Object STATIC_INITIALIZER = ensureInitialized(); 660 private static final Object STATIC_INITIALIZER = ensureInitialized();
661 661
662 public static Object ensureInitialized() { 662 public static Object ensureInitialized() {
663 INSTANCE.ensureInitializedInternal(); 663 INSTANCE.ensureInitializedInternal();
664 return null; 664 return null;
665 } 665 }
666 } 666 }
667 667
668 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { 668 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
669 private static final ParentTooYoung.GeneratedPQuery INSTANCE = new GeneratedPQuery(); 669 private static final ParentTooYoung.GeneratedPQuery INSTANCE = new GeneratedPQuery();
670 670
671 private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); 671 private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
672 672
673 private final PParameter parameter_p = new PParameter("p", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); 673 private final PParameter parameter_p = new PParameter("p", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
674 674
675 private final List<PParameter> parameters = Arrays.asList(parameter_m, parameter_p); 675 private final List<PParameter> parameters = Arrays.asList(parameter_m, parameter_p);
676 676
677 private GeneratedPQuery() { 677 private GeneratedPQuery() {
678 super(PVisibility.PUBLIC); 678 super(PVisibility.PUBLIC);
679 } 679 }
680 680
681 @Override 681 @Override
682 public String getFullyQualifiedName() { 682 public String getFullyQualifiedName() {
683 return "queries.parentTooYoung"; 683 return "queries.parentTooYoung";
684 } 684 }
685 685
686 @Override 686 @Override
687 public List<String> getParameterNames() { 687 public List<String> getParameterNames() {
688 return Arrays.asList("m","p"); 688 return Arrays.asList("m","p");
689 } 689 }
690 690
691 @Override 691 @Override
692 public List<PParameter> getParameters() { 692 public List<PParameter> getParameters() {
693 return parameters; 693 return parameters;
694 } 694 }
695 695
696 @Override 696 @Override
697 public Set<PBody> doGetContainedBodies() { 697 public Set<PBody> doGetContainedBodies() {
698 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); 698 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
699 Set<PBody> bodies = new LinkedHashSet<>(); 699 Set<PBody> bodies = new LinkedHashSet<>();
700 { 700 {
701 PBody body = new PBody(this); 701 PBody body = new PBody(this);
702 PVariable var_m = body.getOrCreateVariableByName("m"); 702 PVariable var_m = body.getOrCreateVariableByName("m");
703 PVariable var_p = body.getOrCreateVariableByName("p"); 703 PVariable var_p = body.getOrCreateVariableByName("p");
704 PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); 704 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
705 PVariable var_mAge = body.getOrCreateVariableByName("mAge"); 705 PVariable var_mAge = body.getOrCreateVariableByName("mAge");
706 PVariable var_pAge = body.getOrCreateVariableByName("pAge"); 706 PVariable var_pAge = body.getOrCreateVariableByName("pAge");
707 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 707 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
708 new TypeConstraint(body, Tuples.flatTupleOf(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 708 new TypeConstraint(body, Tuples.flatTupleOf(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
709 body.setSymbolicParameters(Arrays.<ExportedParameter>asList( 709 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
710 new ExportedParameter(body, var_m, parameter_m), 710 new ExportedParameter(body, var_m, parameter_m),
711 new ExportedParameter(body, var_p, parameter_p) 711 new ExportedParameter(body, var_p, parameter_p)
712 )); 712 ));
713 // FamilyTree.members(_, m) 713 // FamilyTree.members(_, m)
714 new TypeConstraint(body, Tuples.flatTupleOf(var___0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "FamilyTree"))); 714 new TypeConstraint(body, Tuples.flatTupleOf(var___0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "FamilyTree")));
715 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); 715 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
716 new TypeConstraint(body, Tuples.flatTupleOf(var___0_, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "FamilyTree", "members"))); 716 new TypeConstraint(body, Tuples.flatTupleOf(var___0_, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "FamilyTree", "members")));
717 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 717 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
718 new Equality(body, var__virtual_0_, var_m); 718 new Equality(body, var__virtual_0_, var_m);
719 // Member.parents(m, p) 719 // Member.parents(m, p)
720 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 720 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
721 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); 721 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
722 new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "parents"))); 722 new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "parents")));
723 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 723 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
724 new Equality(body, var__virtual_1_, var_p); 724 new Equality(body, var__virtual_1_, var_p);
725 // Member.age(m, mAge) 725 // Member.age(m, mAge)
726 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 726 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
727 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); 727 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
728 new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "age"))); 728 new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "age")));
729 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); 729 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt")));
730 new Equality(body, var__virtual_2_, var_mAge); 730 new Equality(body, var__virtual_2_, var_mAge);
731 // Member.age(p, pAge) 731 // Member.age(p, pAge)
732 new TypeConstraint(body, Tuples.flatTupleOf(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 732 new TypeConstraint(body, Tuples.flatTupleOf(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
733 PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); 733 PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}");
734 new TypeConstraint(body, Tuples.flatTupleOf(var_p, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "age"))); 734 new TypeConstraint(body, Tuples.flatTupleOf(var_p, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "age")));
735 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); 735 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt")));
736 new Equality(body, var__virtual_3_, var_pAge); 736 new Equality(body, var__virtual_3_, var_pAge);
737 // check (mAge <= (pAge + 12)) 737 // check (mAge <= (pAge + 12))
738 new ExpressionEvaluation(body, new IExpressionEvaluator() { 738 new ExpressionEvaluation(body, new IExpressionEvaluator() {
739 739
740 @Override 740 @Override
741 public String getShortDescription() { 741 public String getShortDescription() {
742 return "Expression evaluation from pattern parentTooYoung"; 742 return "Expression evaluation from pattern parentTooYoung";
743 } 743 }
744 744
745 @Override 745 @Override
746 public Iterable<String> getInputParameterNames() { 746 public Iterable<String> getInputParameterNames() {
747 return Arrays.asList("mAge", "pAge");} 747 return Arrays.asList("mAge", "pAge");}
748 748
749 @Override 749 @Override
750 public Object evaluateExpression(IValueProvider provider) throws Exception { 750 public Object evaluateExpression(IValueProvider provider) throws Exception {
751 Integer mAge = (Integer) provider.getValue("mAge"); 751 Integer mAge = (Integer) provider.getValue("mAge");
752 Integer pAge = (Integer) provider.getValue("pAge"); 752 Integer pAge = (Integer) provider.getValue("pAge");
753 return evaluateExpression_1_1(mAge, pAge); 753 return evaluateExpression_1_1(mAge, pAge);
754 } 754 }
755 }, null); 755 }, null);
756 bodies.add(body); 756 bodies.add(body);
757 } 757 }
758 { 758 {
759 PAnnotation annotation = new PAnnotation("Constraint"); 759 PAnnotation annotation = new PAnnotation("Constraint");
760 annotation.addAttribute("message", "parentTooYoung"); 760 annotation.addAttribute("message", "parentTooYoung");
761 annotation.addAttribute("severity", "error"); 761 annotation.addAttribute("severity", "error");
762 annotation.addAttribute("key", Arrays.asList(new Object[] { 762 annotation.addAttribute("key", Arrays.asList(new Object[] {
763 new ParameterReference("m"), 763 new ParameterReference("m"),
764 new ParameterReference("p") 764 new ParameterReference("p")
765 })); 765 }));
766 addAnnotation(annotation); 766 addAnnotation(annotation);
767 } 767 }
768 return bodies; 768 return bodies;
769 } 769 }
770 } 770 }
771 771
772 private static boolean evaluateExpression_1_1(final Integer mAge, final Integer pAge) { 772 private static boolean evaluateExpression_1_1(final Integer mAge, final Integer pAge) {
773 return ((mAge).intValue() <= ((pAge).intValue() + 12)); 773 return ((mAge).intValue() <= ((pAge).intValue() + 12));
774 } 774 }
775} 775}
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/TwoMembersHaveNoParent.java b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/TwoMembersHaveNoParent.java
index 58ad57a6..365939dd 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/TwoMembersHaveNoParent.java
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/TwoMembersHaveNoParent.java
@@ -1,723 +1,723 @@
1/** 1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql 2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */ 3 */
4package queries; 4package queries;
5 5
6import familytree.Member; 6import familytree.Member;
7import java.util.Arrays; 7import java.util.Arrays;
8import java.util.Collection; 8import java.util.Collection;
9import java.util.LinkedHashSet; 9import java.util.LinkedHashSet;
10import java.util.List; 10import java.util.List;
11import java.util.Objects; 11import java.util.Objects;
12import java.util.Optional; 12import java.util.Optional;
13import java.util.Set; 13import java.util.Set;
14import java.util.function.Consumer; 14import java.util.function.Consumer;
15import java.util.stream.Collectors; 15import java.util.stream.Collectors;
16import java.util.stream.Stream; 16import java.util.stream.Stream;
17import org.apache.log4j.Logger; 17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass; 18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch; 19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification; 20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; 21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; 22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; 23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; 24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; 25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; 26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; 27import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
28import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; 28import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; 29import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
30import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; 30import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; 31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; 32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; 33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; 34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; 35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; 36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; 37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; 38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; 39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; 40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; 41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42import queries.MemberHasParent; 42import queries.MemberHasParent;
43 43
44/** 44/**
45 * A pattern-specific query specification that can instantiate Matcher in a type-safe way. 45 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
46 * 46 *
47 * <p>Original source: 47 * <p>Original source:
48 * <code><pre> 48 * <code><pre>
49 * {@literal @}Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2}) 49 * {@literal @}Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2})
50 * pattern twoMembersHaveNoParent(m1:Member, m2:Member) = { 50 * pattern twoMembersHaveNoParent(m1:Member, m2:Member) = {
51 * neg find memberHasParent(m1); 51 * neg find memberHasParent(m1);
52 * neg find memberHasParent(m2); 52 * neg find memberHasParent(m2);
53 * m1 != m2; 53 * m1 != m2;
54 * } 54 * }
55 * </pre></code> 55 * </pre></code>
56 * 56 *
57 * @see Matcher 57 * @see Matcher
58 * @see Match 58 * @see Match
59 * 59 *
60 */ 60 */
61@SuppressWarnings("all") 61@SuppressWarnings("all")
62public final class TwoMembersHaveNoParent extends BaseGeneratedEMFQuerySpecification<TwoMembersHaveNoParent.Matcher> { 62public final class TwoMembersHaveNoParent extends BaseGeneratedEMFQuerySpecification<TwoMembersHaveNoParent.Matcher> {
63 /** 63 /**
64 * Pattern-specific match representation of the queries.twoMembersHaveNoParent pattern, 64 * Pattern-specific match representation of the queries.twoMembersHaveNoParent pattern,
65 * to be used in conjunction with {@link Matcher}. 65 * to be used in conjunction with {@link Matcher}.
66 * 66 *
67 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. 67 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
68 * Each instance is a (possibly partial) substitution of pattern parameters, 68 * Each instance is a (possibly partial) substitution of pattern parameters,
69 * usable to represent a match of the pattern in the result of a query, 69 * usable to represent a match of the pattern in the result of a query,
70 * or to specify the bound (fixed) input parameters when issuing a query. 70 * or to specify the bound (fixed) input parameters when issuing a query.
71 * 71 *
72 * @see Matcher 72 * @see Matcher
73 * 73 *
74 */ 74 */
75 public static abstract class Match extends BasePatternMatch { 75 public static abstract class Match extends BasePatternMatch {
76 private Member fM1; 76 private Member fM1;
77 77
78 private Member fM2; 78 private Member fM2;
79 79
80 private static List<String> parameterNames = makeImmutableList("m1", "m2"); 80 private static List<String> parameterNames = makeImmutableList("m1", "m2");
81 81
82 private Match(final Member pM1, final Member pM2) { 82 private Match(final Member pM1, final Member pM2) {
83 this.fM1 = pM1; 83 this.fM1 = pM1;
84 this.fM2 = pM2; 84 this.fM2 = pM2;
85 } 85 }
86 86
87 @Override 87 @Override
88 public Object get(final String parameterName) { 88 public Object get(final String parameterName) {
89 switch(parameterName) { 89 switch(parameterName) {
90 case "m1": return this.fM1; 90 case "m1": return this.fM1;
91 case "m2": return this.fM2; 91 case "m2": return this.fM2;
92 default: return null; 92 default: return null;
93 } 93 }
94 } 94 }
95 95
96 @Override 96 @Override
97 public Object get(final int index) { 97 public Object get(final int index) {
98 switch(index) { 98 switch(index) {
99 case 0: return this.fM1; 99 case 0: return this.fM1;
100 case 1: return this.fM2; 100 case 1: return this.fM2;
101 default: return null; 101 default: return null;
102 } 102 }
103 } 103 }
104 104
105 public Member getM1() { 105 public Member getM1() {
106 return this.fM1; 106 return this.fM1;
107 } 107 }
108 108
109 public Member getM2() { 109 public Member getM2() {
110 return this.fM2; 110 return this.fM2;
111 } 111 }
112 112
113 @Override 113 @Override
114 public boolean set(final String parameterName, final Object newValue) { 114 public boolean set(final String parameterName, final Object newValue) {
115 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 115 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
116 if ("m1".equals(parameterName) ) { 116 if ("m1".equals(parameterName) ) {
117 this.fM1 = (Member) newValue; 117 this.fM1 = (Member) newValue;
118 return true; 118 return true;
119 } 119 }
120 if ("m2".equals(parameterName) ) { 120 if ("m2".equals(parameterName) ) {
121 this.fM2 = (Member) newValue; 121 this.fM2 = (Member) newValue;
122 return true; 122 return true;
123 } 123 }
124 return false; 124 return false;
125 } 125 }
126 126
127 public void setM1(final Member pM1) { 127 public void setM1(final Member pM1) {
128 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 128 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
129 this.fM1 = pM1; 129 this.fM1 = pM1;
130 } 130 }
131 131
132 public void setM2(final Member pM2) { 132 public void setM2(final Member pM2) {
133 if (!isMutable()) throw new java.lang.UnsupportedOperationException(); 133 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
134 this.fM2 = pM2; 134 this.fM2 = pM2;
135 } 135 }
136 136
137 @Override 137 @Override
138 public String patternName() { 138 public String patternName() {
139 return "queries.twoMembersHaveNoParent"; 139 return "queries.twoMembersHaveNoParent";
140 } 140 }
141 141
142 @Override 142 @Override
143 public List<String> parameterNames() { 143 public List<String> parameterNames() {
144 return TwoMembersHaveNoParent.Match.parameterNames; 144 return TwoMembersHaveNoParent.Match.parameterNames;
145 } 145 }
146 146
147 @Override 147 @Override
148 public Object[] toArray() { 148 public Object[] toArray() {
149 return new Object[]{fM1, fM2}; 149 return new Object[]{fM1, fM2};
150 } 150 }
151 151
152 @Override 152 @Override
153 public TwoMembersHaveNoParent.Match toImmutable() { 153 public TwoMembersHaveNoParent.Match toImmutable() {
154 return isMutable() ? newMatch(fM1, fM2) : this; 154 return isMutable() ? newMatch(fM1, fM2) : this;
155 } 155 }
156 156
157 @Override 157 @Override
158 public String prettyPrint() { 158 public String prettyPrint() {
159 StringBuilder result = new StringBuilder(); 159 StringBuilder result = new StringBuilder();
160 result.append("\"m1\"=" + prettyPrintValue(fM1) + ", "); 160 result.append("\"m1\"=" + prettyPrintValue(fM1) + ", ");
161 result.append("\"m2\"=" + prettyPrintValue(fM2)); 161 result.append("\"m2\"=" + prettyPrintValue(fM2));
162 return result.toString(); 162 return result.toString();
163 } 163 }
164 164
165 @Override 165 @Override
166 public int hashCode() { 166 public int hashCode() {
167 return Objects.hash(fM1, fM2); 167 return Objects.hash(fM1, fM2);
168 } 168 }
169 169
170 @Override 170 @Override
171 public boolean equals(final Object obj) { 171 public boolean equals(final Object obj) {
172 if (this == obj) 172 if (this == obj)
173 return true; 173 return true;
174 if (obj == null) { 174 if (obj == null) {
175 return false; 175 return false;
176 } 176 }
177 if ((obj instanceof TwoMembersHaveNoParent.Match)) { 177 if ((obj instanceof TwoMembersHaveNoParent.Match)) {
178 TwoMembersHaveNoParent.Match other = (TwoMembersHaveNoParent.Match) obj; 178 TwoMembersHaveNoParent.Match other = (TwoMembersHaveNoParent.Match) obj;
179 return Objects.equals(fM1, other.fM1) && Objects.equals(fM2, other.fM2); 179 return Objects.equals(fM1, other.fM1) && Objects.equals(fM2, other.fM2);
180 } else { 180 } else {
181 // this should be infrequent 181 // this should be infrequent
182 if (!(obj instanceof IPatternMatch)) { 182 if (!(obj instanceof IPatternMatch)) {
183 return false; 183 return false;
184 } 184 }
185 IPatternMatch otherSig = (IPatternMatch) obj; 185 IPatternMatch otherSig = (IPatternMatch) obj;
186 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); 186 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
187 } 187 }
188 } 188 }
189 189
190 @Override 190 @Override
191 public TwoMembersHaveNoParent specification() { 191 public TwoMembersHaveNoParent specification() {
192 return TwoMembersHaveNoParent.instance(); 192 return TwoMembersHaveNoParent.instance();
193 } 193 }
194 194
195 /** 195 /**
196 * Returns an empty, mutable match. 196 * Returns an empty, mutable match.
197 * Fields of the mutable match can be filled to create a partial match, usable as matcher input. 197 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
198 * 198 *
199 * @return the empty match. 199 * @return the empty match.
200 * 200 *
201 */ 201 */
202 public static TwoMembersHaveNoParent.Match newEmptyMatch() { 202 public static TwoMembersHaveNoParent.Match newEmptyMatch() {
203 return new Mutable(null, null); 203 return new Mutable(null, null);
204 } 204 }
205 205
206 /** 206 /**
207 * Returns a mutable (partial) match. 207 * Returns a mutable (partial) match.
208 * Fields of the mutable match can be filled to create a partial match, usable as matcher input. 208 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
209 * 209 *
210 * @param pM1 the fixed value of pattern parameter m1, or null if not bound. 210 * @param pM1 the fixed value of pattern parameter m1, or null if not bound.
211 * @param pM2 the fixed value of pattern parameter m2, or null if not bound. 211 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
212 * @return the new, mutable (partial) match object. 212 * @return the new, mutable (partial) match object.
213 * 213 *
214 */ 214 */
215 public static TwoMembersHaveNoParent.Match newMutableMatch(final Member pM1, final Member pM2) { 215 public static TwoMembersHaveNoParent.Match newMutableMatch(final Member pM1, final Member pM2) {
216 return new Mutable(pM1, pM2); 216 return new Mutable(pM1, pM2);
217 } 217 }
218 218
219 /** 219 /**
220 * Returns a new (partial) match. 220 * Returns a new (partial) match.
221 * This can be used e.g. to call the matcher with a partial match. 221 * This can be used e.g. to call the matcher with a partial match.
222 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. 222 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
223 * @param pM1 the fixed value of pattern parameter m1, or null if not bound. 223 * @param pM1 the fixed value of pattern parameter m1, or null if not bound.
224 * @param pM2 the fixed value of pattern parameter m2, or null if not bound. 224 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
225 * @return the (partial) match object. 225 * @return the (partial) match object.
226 * 226 *
227 */ 227 */
228 public static TwoMembersHaveNoParent.Match newMatch(final Member pM1, final Member pM2) { 228 public static TwoMembersHaveNoParent.Match newMatch(final Member pM1, final Member pM2) {
229 return new Immutable(pM1, pM2); 229 return new Immutable(pM1, pM2);
230 } 230 }
231 231
232 private static final class Mutable extends TwoMembersHaveNoParent.Match { 232 private static final class Mutable extends TwoMembersHaveNoParent.Match {
233 Mutable(final Member pM1, final Member pM2) { 233 Mutable(final Member pM1, final Member pM2) {
234 super(pM1, pM2); 234 super(pM1, pM2);
235 } 235 }
236 236
237 @Override 237 @Override
238 public boolean isMutable() { 238 public boolean isMutable() {
239 return true; 239 return true;
240 } 240 }
241 } 241 }
242 242
243 private static final class Immutable extends TwoMembersHaveNoParent.Match { 243 private static final class Immutable extends TwoMembersHaveNoParent.Match {
244 Immutable(final Member pM1, final Member pM2) { 244 Immutable(final Member pM1, final Member pM2) {
245 super(pM1, pM2); 245 super(pM1, pM2);
246 } 246 }
247 247
248 @Override 248 @Override
249 public boolean isMutable() { 249 public boolean isMutable() {
250 return false; 250 return false;
251 } 251 }
252 } 252 }
253 } 253 }
254 254
255 /** 255 /**
256 * Generated pattern matcher API of the queries.twoMembersHaveNoParent pattern, 256 * Generated pattern matcher API of the queries.twoMembersHaveNoParent pattern,
257 * providing pattern-specific query methods. 257 * providing pattern-specific query methods.
258 * 258 *
259 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, 259 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
260 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. 260 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
261 * 261 *
262 * <p>Matches of the pattern will be represented as {@link Match}. 262 * <p>Matches of the pattern will be represented as {@link Match}.
263 * 263 *
264 * <p>Original source: 264 * <p>Original source:
265 * <code><pre> 265 * <code><pre>
266 * {@literal @}Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2}) 266 * {@literal @}Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2})
267 * pattern twoMembersHaveNoParent(m1:Member, m2:Member) = { 267 * pattern twoMembersHaveNoParent(m1:Member, m2:Member) = {
268 * neg find memberHasParent(m1); 268 * neg find memberHasParent(m1);
269 * neg find memberHasParent(m2); 269 * neg find memberHasParent(m2);
270 * m1 != m2; 270 * m1 != m2;
271 * } 271 * }
272 * </pre></code> 272 * </pre></code>
273 * 273 *
274 * @see Match 274 * @see Match
275 * @see TwoMembersHaveNoParent 275 * @see TwoMembersHaveNoParent
276 * 276 *
277 */ 277 */
278 public static class Matcher extends BaseMatcher<TwoMembersHaveNoParent.Match> { 278 public static class Matcher extends BaseMatcher<TwoMembersHaveNoParent.Match> {
279 /** 279 /**
280 * Initializes the pattern matcher within an existing VIATRA Query engine. 280 * Initializes the pattern matcher within an existing VIATRA Query engine.
281 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. 281 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
282 * 282 *
283 * @param engine the existing VIATRA Query engine in which this matcher will be created. 283 * @param engine the existing VIATRA Query engine in which this matcher will be created.
284 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 284 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
285 * 285 *
286 */ 286 */
287 public static TwoMembersHaveNoParent.Matcher on(final ViatraQueryEngine engine) { 287 public static TwoMembersHaveNoParent.Matcher on(final ViatraQueryEngine engine) {
288 // check if matcher already exists 288 // check if matcher already exists
289 Matcher matcher = engine.getExistingMatcher(querySpecification()); 289 Matcher matcher = engine.getExistingMatcher(querySpecification());
290 if (matcher == null) { 290 if (matcher == null) {
291 matcher = (Matcher)engine.getMatcher(querySpecification()); 291 matcher = (Matcher)engine.getMatcher(querySpecification());
292 } 292 }
293 return matcher; 293 return matcher;
294 } 294 }
295 295
296 /** 296 /**
297 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 297 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
298 * @return an initialized matcher 298 * @return an initialized matcher
299 * @noreference This method is for internal matcher initialization by the framework, do not call it manually. 299 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
300 * 300 *
301 */ 301 */
302 public static TwoMembersHaveNoParent.Matcher create() { 302 public static TwoMembersHaveNoParent.Matcher create() {
303 return new Matcher(); 303 return new Matcher();
304 } 304 }
305 305
306 private static final int POSITION_M1 = 0; 306 private static final int POSITION_M1 = 0;
307 307
308 private static final int POSITION_M2 = 1; 308 private static final int POSITION_M2 = 1;
309 309
310 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TwoMembersHaveNoParent.Matcher.class); 310 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TwoMembersHaveNoParent.Matcher.class);
311 311
312 /** 312 /**
313 * Initializes the pattern matcher within an existing VIATRA Query engine. 313 * Initializes the pattern matcher within an existing VIATRA Query engine.
314 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. 314 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
315 * 315 *
316 * @param engine the existing VIATRA Query engine in which this matcher will be created. 316 * @param engine the existing VIATRA Query engine in which this matcher will be created.
317 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation 317 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
318 * 318 *
319 */ 319 */
320 private Matcher() { 320 private Matcher() {
321 super(querySpecification()); 321 super(querySpecification());
322 } 322 }
323 323
324 /** 324 /**
325 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. 325 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
326 * @param pM1 the fixed value of pattern parameter m1, or null if not bound. 326 * @param pM1 the fixed value of pattern parameter m1, or null if not bound.
327 * @param pM2 the fixed value of pattern parameter m2, or null if not bound. 327 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
328 * @return matches represented as a Match object. 328 * @return matches represented as a Match object.
329 * 329 *
330 */ 330 */
331 public Collection<TwoMembersHaveNoParent.Match> getAllMatches(final Member pM1, final Member pM2) { 331 public Collection<TwoMembersHaveNoParent.Match> getAllMatches(final Member pM1, final Member pM2) {
332 return rawStreamAllMatches(new Object[]{pM1, pM2}).collect(Collectors.toSet()); 332 return rawStreamAllMatches(new Object[]{pM1, pM2}).collect(Collectors.toSet());
333 } 333 }
334 334
335 /** 335 /**
336 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. 336 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
337 * </p> 337 * </p>
338 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 338 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
339 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 339 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
340 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 340 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
341 * @param pM1 the fixed value of pattern parameter m1, or null if not bound. 341 * @param pM1 the fixed value of pattern parameter m1, or null if not bound.
342 * @param pM2 the fixed value of pattern parameter m2, or null if not bound. 342 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
343 * @return a stream of matches represented as a Match object. 343 * @return a stream of matches represented as a Match object.
344 * 344 *
345 */ 345 */
346 public Stream<TwoMembersHaveNoParent.Match> streamAllMatches(final Member pM1, final Member pM2) { 346 public Stream<TwoMembersHaveNoParent.Match> streamAllMatches(final Member pM1, final Member pM2) {
347 return rawStreamAllMatches(new Object[]{pM1, pM2}); 347 return rawStreamAllMatches(new Object[]{pM1, pM2});
348 } 348 }
349 349
350 /** 350 /**
351 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. 351 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
352 * Neither determinism nor randomness of selection is guaranteed. 352 * Neither determinism nor randomness of selection is guaranteed.
353 * @param pM1 the fixed value of pattern parameter m1, or null if not bound. 353 * @param pM1 the fixed value of pattern parameter m1, or null if not bound.
354 * @param pM2 the fixed value of pattern parameter m2, or null if not bound. 354 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
355 * @return a match represented as a Match object, or null if no match is found. 355 * @return a match represented as a Match object, or null if no match is found.
356 * 356 *
357 */ 357 */
358 public Optional<TwoMembersHaveNoParent.Match> getOneArbitraryMatch(final Member pM1, final Member pM2) { 358 public Optional<TwoMembersHaveNoParent.Match> getOneArbitraryMatch(final Member pM1, final Member pM2) {
359 return rawGetOneArbitraryMatch(new Object[]{pM1, pM2}); 359 return rawGetOneArbitraryMatch(new Object[]{pM1, pM2});
360 } 360 }
361 361
362 /** 362 /**
363 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, 363 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
364 * under any possible substitution of the unspecified parameters (if any). 364 * under any possible substitution of the unspecified parameters (if any).
365 * @param pM1 the fixed value of pattern parameter m1, or null if not bound. 365 * @param pM1 the fixed value of pattern parameter m1, or null if not bound.
366 * @param pM2 the fixed value of pattern parameter m2, or null if not bound. 366 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
367 * @return true if the input is a valid (partial) match of the pattern. 367 * @return true if the input is a valid (partial) match of the pattern.
368 * 368 *
369 */ 369 */
370 public boolean hasMatch(final Member pM1, final Member pM2) { 370 public boolean hasMatch(final Member pM1, final Member pM2) {
371 return rawHasMatch(new Object[]{pM1, pM2}); 371 return rawHasMatch(new Object[]{pM1, pM2});
372 } 372 }
373 373
374 /** 374 /**
375 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. 375 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
376 * @param pM1 the fixed value of pattern parameter m1, or null if not bound. 376 * @param pM1 the fixed value of pattern parameter m1, or null if not bound.
377 * @param pM2 the fixed value of pattern parameter m2, or null if not bound. 377 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
378 * @return the number of pattern matches found. 378 * @return the number of pattern matches found.
379 * 379 *
380 */ 380 */
381 public int countMatches(final Member pM1, final Member pM2) { 381 public int countMatches(final Member pM1, final Member pM2) {
382 return rawCountMatches(new Object[]{pM1, pM2}); 382 return rawCountMatches(new Object[]{pM1, pM2});
383 } 383 }
384 384
385 /** 385 /**
386 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. 386 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
387 * Neither determinism nor randomness of selection is guaranteed. 387 * Neither determinism nor randomness of selection is guaranteed.
388 * @param pM1 the fixed value of pattern parameter m1, or null if not bound. 388 * @param pM1 the fixed value of pattern parameter m1, or null if not bound.
389 * @param pM2 the fixed value of pattern parameter m2, or null if not bound. 389 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
390 * @param processor the action that will process the selected match. 390 * @param processor the action that will process the selected match.
391 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked 391 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
392 * 392 *
393 */ 393 */
394 public boolean forOneArbitraryMatch(final Member pM1, final Member pM2, final Consumer<? super TwoMembersHaveNoParent.Match> processor) { 394 public boolean forOneArbitraryMatch(final Member pM1, final Member pM2, final Consumer<? super TwoMembersHaveNoParent.Match> processor) {
395 return rawForOneArbitraryMatch(new Object[]{pM1, pM2}, processor); 395 return rawForOneArbitraryMatch(new Object[]{pM1, pM2}, processor);
396 } 396 }
397 397
398 /** 398 /**
399 * Returns a new (partial) match. 399 * Returns a new (partial) match.
400 * This can be used e.g. to call the matcher with a partial match. 400 * This can be used e.g. to call the matcher with a partial match.
401 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. 401 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
402 * @param pM1 the fixed value of pattern parameter m1, or null if not bound. 402 * @param pM1 the fixed value of pattern parameter m1, or null if not bound.
403 * @param pM2 the fixed value of pattern parameter m2, or null if not bound. 403 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
404 * @return the (partial) match object. 404 * @return the (partial) match object.
405 * 405 *
406 */ 406 */
407 public TwoMembersHaveNoParent.Match newMatch(final Member pM1, final Member pM2) { 407 public TwoMembersHaveNoParent.Match newMatch(final Member pM1, final Member pM2) {
408 return TwoMembersHaveNoParent.Match.newMatch(pM1, pM2); 408 return TwoMembersHaveNoParent.Match.newMatch(pM1, pM2);
409 } 409 }
410 410
411 /** 411 /**
412 * Retrieve the set of values that occur in matches for m1. 412 * Retrieve the set of values that occur in matches for m1.
413 * @return the Set of all values or empty set if there are no matches 413 * @return the Set of all values or empty set if there are no matches
414 * 414 *
415 */ 415 */
416 protected Stream<Member> rawStreamAllValuesOfm1(final Object[] parameters) { 416 protected Stream<Member> rawStreamAllValuesOfm1(final Object[] parameters) {
417 return rawStreamAllValues(POSITION_M1, parameters).map(Member.class::cast); 417 return rawStreamAllValues(POSITION_M1, parameters).map(Member.class::cast);
418 } 418 }
419 419
420 /** 420 /**
421 * Retrieve the set of values that occur in matches for m1. 421 * Retrieve the set of values that occur in matches for m1.
422 * @return the Set of all values or empty set if there are no matches 422 * @return the Set of all values or empty set if there are no matches
423 * 423 *
424 */ 424 */
425 public Set<Member> getAllValuesOfm1() { 425 public Set<Member> getAllValuesOfm1() {
426 return rawStreamAllValuesOfm1(emptyArray()).collect(Collectors.toSet()); 426 return rawStreamAllValuesOfm1(emptyArray()).collect(Collectors.toSet());
427 } 427 }
428 428
429 /** 429 /**
430 * Retrieve the set of values that occur in matches for m1. 430 * Retrieve the set of values that occur in matches for m1.
431 * @return the Set of all values or empty set if there are no matches 431 * @return the Set of all values or empty set if there are no matches
432 * 432 *
433 */ 433 */
434 public Stream<Member> streamAllValuesOfm1() { 434 public Stream<Member> streamAllValuesOfm1() {
435 return rawStreamAllValuesOfm1(emptyArray()); 435 return rawStreamAllValuesOfm1(emptyArray());
436 } 436 }
437 437
438 /** 438 /**
439 * Retrieve the set of values that occur in matches for m1. 439 * Retrieve the set of values that occur in matches for m1.
440 * </p> 440 * </p>
441 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 441 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
442 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 442 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
443 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 443 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
444 * 444 *
445 * @return the Stream of all values or empty set if there are no matches 445 * @return the Stream of all values or empty set if there are no matches
446 * 446 *
447 */ 447 */
448 public Stream<Member> streamAllValuesOfm1(final TwoMembersHaveNoParent.Match partialMatch) { 448 public Stream<Member> streamAllValuesOfm1(final TwoMembersHaveNoParent.Match partialMatch) {
449 return rawStreamAllValuesOfm1(partialMatch.toArray()); 449 return rawStreamAllValuesOfm1(partialMatch.toArray());
450 } 450 }
451 451
452 /** 452 /**
453 * Retrieve the set of values that occur in matches for m1. 453 * Retrieve the set of values that occur in matches for m1.
454 * </p> 454 * </p>
455 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 455 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
456 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 456 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
457 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 457 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
458 * 458 *
459 * @return the Stream of all values or empty set if there are no matches 459 * @return the Stream of all values or empty set if there are no matches
460 * 460 *
461 */ 461 */
462 public Stream<Member> streamAllValuesOfm1(final Member pM2) { 462 public Stream<Member> streamAllValuesOfm1(final Member pM2) {
463 return rawStreamAllValuesOfm1(new Object[]{null, pM2}); 463 return rawStreamAllValuesOfm1(new Object[]{null, pM2});
464 } 464 }
465 465
466 /** 466 /**
467 * Retrieve the set of values that occur in matches for m1. 467 * Retrieve the set of values that occur in matches for m1.
468 * @return the Set of all values or empty set if there are no matches 468 * @return the Set of all values or empty set if there are no matches
469 * 469 *
470 */ 470 */
471 public Set<Member> getAllValuesOfm1(final TwoMembersHaveNoParent.Match partialMatch) { 471 public Set<Member> getAllValuesOfm1(final TwoMembersHaveNoParent.Match partialMatch) {
472 return rawStreamAllValuesOfm1(partialMatch.toArray()).collect(Collectors.toSet()); 472 return rawStreamAllValuesOfm1(partialMatch.toArray()).collect(Collectors.toSet());
473 } 473 }
474 474
475 /** 475 /**
476 * Retrieve the set of values that occur in matches for m1. 476 * Retrieve the set of values that occur in matches for m1.
477 * @return the Set of all values or empty set if there are no matches 477 * @return the Set of all values or empty set if there are no matches
478 * 478 *
479 */ 479 */
480 public Set<Member> getAllValuesOfm1(final Member pM2) { 480 public Set<Member> getAllValuesOfm1(final Member pM2) {
481 return rawStreamAllValuesOfm1(new Object[]{null, pM2}).collect(Collectors.toSet()); 481 return rawStreamAllValuesOfm1(new Object[]{null, pM2}).collect(Collectors.toSet());
482 } 482 }
483 483
484 /** 484 /**
485 * Retrieve the set of values that occur in matches for m2. 485 * Retrieve the set of values that occur in matches for m2.
486 * @return the Set of all values or empty set if there are no matches 486 * @return the Set of all values or empty set if there are no matches
487 * 487 *
488 */ 488 */
489 protected Stream<Member> rawStreamAllValuesOfm2(final Object[] parameters) { 489 protected Stream<Member> rawStreamAllValuesOfm2(final Object[] parameters) {
490 return rawStreamAllValues(POSITION_M2, parameters).map(Member.class::cast); 490 return rawStreamAllValues(POSITION_M2, parameters).map(Member.class::cast);
491 } 491 }
492 492
493 /** 493 /**
494 * Retrieve the set of values that occur in matches for m2. 494 * Retrieve the set of values that occur in matches for m2.
495 * @return the Set of all values or empty set if there are no matches 495 * @return the Set of all values or empty set if there are no matches
496 * 496 *
497 */ 497 */
498 public Set<Member> getAllValuesOfm2() { 498 public Set<Member> getAllValuesOfm2() {
499 return rawStreamAllValuesOfm2(emptyArray()).collect(Collectors.toSet()); 499 return rawStreamAllValuesOfm2(emptyArray()).collect(Collectors.toSet());
500 } 500 }
501 501
502 /** 502 /**
503 * Retrieve the set of values that occur in matches for m2. 503 * Retrieve the set of values that occur in matches for m2.
504 * @return the Set of all values or empty set if there are no matches 504 * @return the Set of all values or empty set if there are no matches
505 * 505 *
506 */ 506 */
507 public Stream<Member> streamAllValuesOfm2() { 507 public Stream<Member> streamAllValuesOfm2() {
508 return rawStreamAllValuesOfm2(emptyArray()); 508 return rawStreamAllValuesOfm2(emptyArray());
509 } 509 }
510 510
511 /** 511 /**
512 * Retrieve the set of values that occur in matches for m2. 512 * Retrieve the set of values that occur in matches for m2.
513 * </p> 513 * </p>
514 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 514 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
515 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 515 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
516 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 516 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
517 * 517 *
518 * @return the Stream of all values or empty set if there are no matches 518 * @return the Stream of all values or empty set if there are no matches
519 * 519 *
520 */ 520 */
521 public Stream<Member> streamAllValuesOfm2(final TwoMembersHaveNoParent.Match partialMatch) { 521 public Stream<Member> streamAllValuesOfm2(final TwoMembersHaveNoParent.Match partialMatch) {
522 return rawStreamAllValuesOfm2(partialMatch.toArray()); 522 return rawStreamAllValuesOfm2(partialMatch.toArray());
523 } 523 }
524 524
525 /** 525 /**
526 * Retrieve the set of values that occur in matches for m2. 526 * Retrieve the set of values that occur in matches for m2.
527 * </p> 527 * </p>
528 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. 528 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
529 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. 529 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
530 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. 530 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
531 * 531 *
532 * @return the Stream of all values or empty set if there are no matches 532 * @return the Stream of all values or empty set if there are no matches
533 * 533 *
534 */ 534 */
535 public Stream<Member> streamAllValuesOfm2(final Member pM1) { 535 public Stream<Member> streamAllValuesOfm2(final Member pM1) {
536 return rawStreamAllValuesOfm2(new Object[]{pM1, null}); 536 return rawStreamAllValuesOfm2(new Object[]{pM1, null});
537 } 537 }
538 538
539 /** 539 /**
540 * Retrieve the set of values that occur in matches for m2. 540 * Retrieve the set of values that occur in matches for m2.
541 * @return the Set of all values or empty set if there are no matches 541 * @return the Set of all values or empty set if there are no matches
542 * 542 *
543 */ 543 */
544 public Set<Member> getAllValuesOfm2(final TwoMembersHaveNoParent.Match partialMatch) { 544 public Set<Member> getAllValuesOfm2(final TwoMembersHaveNoParent.Match partialMatch) {
545 return rawStreamAllValuesOfm2(partialMatch.toArray()).collect(Collectors.toSet()); 545 return rawStreamAllValuesOfm2(partialMatch.toArray()).collect(Collectors.toSet());
546 } 546 }
547 547
548 /** 548 /**
549 * Retrieve the set of values that occur in matches for m2. 549 * Retrieve the set of values that occur in matches for m2.
550 * @return the Set of all values or empty set if there are no matches 550 * @return the Set of all values or empty set if there are no matches
551 * 551 *
552 */ 552 */
553 public Set<Member> getAllValuesOfm2(final Member pM1) { 553 public Set<Member> getAllValuesOfm2(final Member pM1) {
554 return rawStreamAllValuesOfm2(new Object[]{pM1, null}).collect(Collectors.toSet()); 554 return rawStreamAllValuesOfm2(new Object[]{pM1, null}).collect(Collectors.toSet());
555 } 555 }
556 556
557 @Override 557 @Override
558 protected TwoMembersHaveNoParent.Match tupleToMatch(final Tuple t) { 558 protected TwoMembersHaveNoParent.Match tupleToMatch(final Tuple t) {
559 try { 559 try {
560 return TwoMembersHaveNoParent.Match.newMatch((Member) t.get(POSITION_M1), (Member) t.get(POSITION_M2)); 560 return TwoMembersHaveNoParent.Match.newMatch((Member) t.get(POSITION_M1), (Member) t.get(POSITION_M2));
561 } catch(ClassCastException e) { 561 } catch(ClassCastException e) {
562 LOGGER.error("Element(s) in tuple not properly typed!",e); 562 LOGGER.error("Element(s) in tuple not properly typed!",e);
563 return null; 563 return null;
564 } 564 }
565 } 565 }
566 566
567 @Override 567 @Override
568 protected TwoMembersHaveNoParent.Match arrayToMatch(final Object[] match) { 568 protected TwoMembersHaveNoParent.Match arrayToMatch(final Object[] match) {
569 try { 569 try {
570 return TwoMembersHaveNoParent.Match.newMatch((Member) match[POSITION_M1], (Member) match[POSITION_M2]); 570 return TwoMembersHaveNoParent.Match.newMatch((Member) match[POSITION_M1], (Member) match[POSITION_M2]);
571 } catch(ClassCastException e) { 571 } catch(ClassCastException e) {
572 LOGGER.error("Element(s) in array not properly typed!",e); 572 LOGGER.error("Element(s) in array not properly typed!",e);
573 return null; 573 return null;
574 } 574 }
575 } 575 }
576 576
577 @Override 577 @Override
578 protected TwoMembersHaveNoParent.Match arrayToMatchMutable(final Object[] match) { 578 protected TwoMembersHaveNoParent.Match arrayToMatchMutable(final Object[] match) {
579 try { 579 try {
580 return TwoMembersHaveNoParent.Match.newMutableMatch((Member) match[POSITION_M1], (Member) match[POSITION_M2]); 580 return TwoMembersHaveNoParent.Match.newMutableMatch((Member) match[POSITION_M1], (Member) match[POSITION_M2]);
581 } catch(ClassCastException e) { 581 } catch(ClassCastException e) {
582 LOGGER.error("Element(s) in array not properly typed!",e); 582 LOGGER.error("Element(s) in array not properly typed!",e);
583 return null; 583 return null;
584 } 584 }
585 } 585 }
586 586
587 /** 587 /**
588 * @return the singleton instance of the query specification of this pattern 588 * @return the singleton instance of the query specification of this pattern
589 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded 589 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
590 * 590 *
591 */ 591 */
592 public static IQuerySpecification<TwoMembersHaveNoParent.Matcher> querySpecification() { 592 public static IQuerySpecification<TwoMembersHaveNoParent.Matcher> querySpecification() {
593 return TwoMembersHaveNoParent.instance(); 593 return TwoMembersHaveNoParent.instance();
594 } 594 }
595 } 595 }
596 596
597 private TwoMembersHaveNoParent() { 597 private TwoMembersHaveNoParent() {
598 super(GeneratedPQuery.INSTANCE); 598 super(GeneratedPQuery.INSTANCE);
599 } 599 }
600 600
601 /** 601 /**
602 * @return the singleton instance of the query specification 602 * @return the singleton instance of the query specification
603 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded 603 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
604 * 604 *
605 */ 605 */
606 public static TwoMembersHaveNoParent instance() { 606 public static TwoMembersHaveNoParent instance() {
607 try{ 607 try{
608 return LazyHolder.INSTANCE; 608 return LazyHolder.INSTANCE;
609 } catch (ExceptionInInitializerError err) { 609 } catch (ExceptionInInitializerError err) {
610 throw processInitializerError(err); 610 throw processInitializerError(err);
611 } 611 }
612 } 612 }
613 613
614 @Override 614 @Override
615 protected TwoMembersHaveNoParent.Matcher instantiate(final ViatraQueryEngine engine) { 615 protected TwoMembersHaveNoParent.Matcher instantiate(final ViatraQueryEngine engine) {
616 return TwoMembersHaveNoParent.Matcher.on(engine); 616 return TwoMembersHaveNoParent.Matcher.on(engine);
617 } 617 }
618 618
619 @Override 619 @Override
620 public TwoMembersHaveNoParent.Matcher instantiate() { 620 public TwoMembersHaveNoParent.Matcher instantiate() {
621 return TwoMembersHaveNoParent.Matcher.create(); 621 return TwoMembersHaveNoParent.Matcher.create();
622 } 622 }
623 623
624 @Override 624 @Override
625 public TwoMembersHaveNoParent.Match newEmptyMatch() { 625 public TwoMembersHaveNoParent.Match newEmptyMatch() {
626 return TwoMembersHaveNoParent.Match.newEmptyMatch(); 626 return TwoMembersHaveNoParent.Match.newEmptyMatch();
627 } 627 }
628 628
629 @Override 629 @Override
630 public TwoMembersHaveNoParent.Match newMatch(final Object... parameters) { 630 public TwoMembersHaveNoParent.Match newMatch(final Object... parameters) {
631 return TwoMembersHaveNoParent.Match.newMatch((familytree.Member) parameters[0], (familytree.Member) parameters[1]); 631 return TwoMembersHaveNoParent.Match.newMatch((familytree.Member) parameters[0], (familytree.Member) parameters[1]);
632 } 632 }
633 633
634 /** 634 /**
635 * Inner class allowing the singleton instance of {@link TwoMembersHaveNoParent} to be created 635 * Inner class allowing the singleton instance of {@link TwoMembersHaveNoParent} to be created
636 * <b>not</b> at the class load time of the outer class, 636 * <b>not</b> at the class load time of the outer class,
637 * but rather at the first call to {@link TwoMembersHaveNoParent#instance()}. 637 * but rather at the first call to {@link TwoMembersHaveNoParent#instance()}.
638 * 638 *
639 * <p> This workaround is required e.g. to support recursion. 639 * <p> This workaround is required e.g. to support recursion.
640 * 640 *
641 */ 641 */
642 private static class LazyHolder { 642 private static class LazyHolder {
643 private static final TwoMembersHaveNoParent INSTANCE = new TwoMembersHaveNoParent(); 643 private static final TwoMembersHaveNoParent INSTANCE = new TwoMembersHaveNoParent();
644 644
645 /** 645 /**
646 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. 646 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
647 * This initialization order is required to support indirect recursion. 647 * This initialization order is required to support indirect recursion.
648 * 648 *
649 * <p> The static initializer is defined using a helper field to work around limitations of the code generator. 649 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
650 * 650 *
651 */ 651 */
652 private static final Object STATIC_INITIALIZER = ensureInitialized(); 652 private static final Object STATIC_INITIALIZER = ensureInitialized();
653 653
654 public static Object ensureInitialized() { 654 public static Object ensureInitialized() {
655 INSTANCE.ensureInitializedInternal(); 655 INSTANCE.ensureInitializedInternal();
656 return null; 656 return null;
657 } 657 }
658 } 658 }
659 659
660 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { 660 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
661 private static final TwoMembersHaveNoParent.GeneratedPQuery INSTANCE = new GeneratedPQuery(); 661 private static final TwoMembersHaveNoParent.GeneratedPQuery INSTANCE = new GeneratedPQuery();
662 662
663 private final PParameter parameter_m1 = new PParameter("m1", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); 663 private final PParameter parameter_m1 = new PParameter("m1", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
664 664
665 private final PParameter parameter_m2 = new PParameter("m2", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); 665 private final PParameter parameter_m2 = new PParameter("m2", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
666 666
667 private final List<PParameter> parameters = Arrays.asList(parameter_m1, parameter_m2); 667 private final List<PParameter> parameters = Arrays.asList(parameter_m1, parameter_m2);
668 668
669 private GeneratedPQuery() { 669 private GeneratedPQuery() {
670 super(PVisibility.PUBLIC); 670 super(PVisibility.PUBLIC);
671 } 671 }
672 672
673 @Override 673 @Override
674 public String getFullyQualifiedName() { 674 public String getFullyQualifiedName() {
675 return "queries.twoMembersHaveNoParent"; 675 return "queries.twoMembersHaveNoParent";
676 } 676 }
677 677
678 @Override 678 @Override
679 public List<String> getParameterNames() { 679 public List<String> getParameterNames() {
680 return Arrays.asList("m1","m2"); 680 return Arrays.asList("m1","m2");
681 } 681 }
682 682
683 @Override 683 @Override
684 public List<PParameter> getParameters() { 684 public List<PParameter> getParameters() {
685 return parameters; 685 return parameters;
686 } 686 }
687 687
688 @Override 688 @Override
689 public Set<PBody> doGetContainedBodies() { 689 public Set<PBody> doGetContainedBodies() {
690 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); 690 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
691 Set<PBody> bodies = new LinkedHashSet<>(); 691 Set<PBody> bodies = new LinkedHashSet<>();
692 { 692 {
693 PBody body = new PBody(this); 693 PBody body = new PBody(this);
694 PVariable var_m1 = body.getOrCreateVariableByName("m1"); 694 PVariable var_m1 = body.getOrCreateVariableByName("m1");
695 PVariable var_m2 = body.getOrCreateVariableByName("m2"); 695 PVariable var_m2 = body.getOrCreateVariableByName("m2");
696 new TypeConstraint(body, Tuples.flatTupleOf(var_m1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 696 new TypeConstraint(body, Tuples.flatTupleOf(var_m1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
697 new TypeConstraint(body, Tuples.flatTupleOf(var_m2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); 697 new TypeConstraint(body, Tuples.flatTupleOf(var_m2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
698 body.setSymbolicParameters(Arrays.<ExportedParameter>asList( 698 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
699 new ExportedParameter(body, var_m1, parameter_m1), 699 new ExportedParameter(body, var_m1, parameter_m1),
700 new ExportedParameter(body, var_m2, parameter_m2) 700 new ExportedParameter(body, var_m2, parameter_m2)
701 )); 701 ));
702 // neg find memberHasParent(m1) 702 // neg find memberHasParent(m1)
703 new NegativePatternCall(body, Tuples.flatTupleOf(var_m1), MemberHasParent.instance().getInternalQueryRepresentation()); 703 new NegativePatternCall(body, Tuples.flatTupleOf(var_m1), MemberHasParent.instance().getInternalQueryRepresentation());
704 // neg find memberHasParent(m2) 704 // neg find memberHasParent(m2)
705 new NegativePatternCall(body, Tuples.flatTupleOf(var_m2), MemberHasParent.instance().getInternalQueryRepresentation()); 705 new NegativePatternCall(body, Tuples.flatTupleOf(var_m2), MemberHasParent.instance().getInternalQueryRepresentation());
706 // m1 != m2 706 // m1 != m2
707 new Inequality(body, var_m1, var_m2); 707 new Inequality(body, var_m1, var_m2);
708 bodies.add(body); 708 bodies.add(body);
709 } 709 }
710 { 710 {
711 PAnnotation annotation = new PAnnotation("Constraint"); 711 PAnnotation annotation = new PAnnotation("Constraint");
712 annotation.addAttribute("message", "twoMembersHaveNoParent"); 712 annotation.addAttribute("message", "twoMembersHaveNoParent");
713 annotation.addAttribute("severity", "error"); 713 annotation.addAttribute("severity", "error");
714 annotation.addAttribute("key", Arrays.asList(new Object[] { 714 annotation.addAttribute("key", Arrays.asList(new Object[] {
715 new ParameterReference("m1"), 715 new ParameterReference("m1"),
716 new ParameterReference("m2") 716 new ParameterReference("m2")
717 })); 717 }));
718 addAnnotation(annotation); 718 addAnnotation(annotation);
719 } 719 }
720 return bodies; 720 return bodies;
721 } 721 }
722 } 722 }
723} 723}
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/plugin.xml b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/plugin.xml
index 63aa0b02..8b036ff2 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/plugin.xml
+++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/plugin.xml
@@ -1,42 +1,42 @@
1<?xml version="1.0" encoding="UTF-8"?><plugin> 1<?xml version="1.0" encoding="UTF-8"?><plugin>
2 <extension id="queries.Case_study_A" point="org.eclipse.viatra.query.runtime.queryspecification"> 2 <extension id="queries.Case_study_A" point="org.eclipse.viatra.query.runtime.queryspecification">
3 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:queries.Case_study_A" id="queries.Case_study_A"> 3 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:queries.Case_study_A" id="queries.Case_study_A">
4 <query-specification fqn="queries.inv03"/> 4 <query-specification fqn="queries.inv03"/>
5 <query-specification fqn="queries.x_inv03_eligAll"/> 5 <query-specification fqn="queries.x_inv03_eligAll"/>
6 <query-specification fqn="queries.x_inv03_hasAll"/> 6 <query-specification fqn="queries.x_inv03_hasAll"/>
7 <query-specification fqn="queries.inv05"/> 7 <query-specification fqn="queries.inv05"/>
8 <query-specification fqn="queries.x_inv05_inRange"/> 8 <query-specification fqn="queries.x_inv05_inRange"/>
9 <query-specification fqn="queries.inv06"/> 9 <query-specification fqn="queries.inv06"/>
10 <query-specification fqn="queries.inv07"/> 10 <query-specification fqn="queries.inv07"/>
11 <query-specification fqn="queries.inv08"/> 11 <query-specification fqn="queries.inv08"/>
12 <query-specification fqn="queries.x_inv08_notEI"/> 12 <query-specification fqn="queries.x_inv08_notEI"/>
13 <query-specification fqn="queries.x_inv08_noType"/> 13 <query-specification fqn="queries.x_inv08_noType"/>
14 <query-specification fqn="queries.x_inv08_inRange"/> 14 <query-specification fqn="queries.x_inv08_inRange"/>
15 <query-specification fqn="queries.inv10"/> 15 <query-specification fqn="queries.inv10"/>
16 <query-specification fqn="queries.inv11"/> 16 <query-specification fqn="queries.inv11"/>
17 <query-specification fqn="queries.x_inv11_incOver100"/> 17 <query-specification fqn="queries.x_inv11_incOver100"/>
18 <query-specification fqn="queries.x_inv11_incNotOver100"/> 18 <query-specification fqn="queries.x_inv11_incNotOver100"/>
19 <query-specification fqn="queries.inv12"/> 19 <query-specification fqn="queries.inv12"/>
20 <query-specification fqn="queries.x_inv12_notNonRes"/> 20 <query-specification fqn="queries.x_inv12_notNonRes"/>
21 <query-specification fqn="queries.x_inv12_notZZ"/> 21 <query-specification fqn="queries.x_inv12_notZZ"/>
22 <query-specification fqn="queries.inv13"/> 22 <query-specification fqn="queries.inv13"/>
23 <query-specification fqn="queries.x_inv13"/> 23 <query-specification fqn="queries.x_inv13"/>
24 <query-specification fqn="queries.inv15"/> 24 <query-specification fqn="queries.inv15"/>
25 <query-specification fqn="queries.x_inv15"/> 25 <query-specification fqn="queries.x_inv15"/>
26 <query-specification fqn="queries.inv17"/> 26 <query-specification fqn="queries.inv17"/>
27 <query-specification fqn="queries.inv20"/> 27 <query-specification fqn="queries.inv20"/>
28 <query-specification fqn="queries.inv33"/> 28 <query-specification fqn="queries.inv33"/>
29 <query-specification fqn="queries.inv34"/> 29 <query-specification fqn="queries.inv34"/>
30 <query-specification fqn="queries.inv35"/> 30 <query-specification fqn="queries.inv35"/>
31 <query-specification fqn="queries.inv47"/> 31 <query-specification fqn="queries.inv47"/>
32 <query-specification fqn="queries.x_inv47"/> 32 <query-specification fqn="queries.x_inv47"/>
33 <query-specification fqn="queries.inv48"/> 33 <query-specification fqn="queries.inv48"/>
34 <query-specification fqn="queries.x_inv48_notDis"/> 34 <query-specification fqn="queries.x_inv48_notDis"/>
35 <query-specification fqn="queries.x_inv48_Dis"/> 35 <query-specification fqn="queries.x_inv48_Dis"/>
36 <query-specification fqn="queries.x_inv48_3"/> 36 <query-specification fqn="queries.x_inv48_3"/>
37 <query-specification fqn="queries.inv49"/> 37 <query-specification fqn="queries.inv49"/>
38 <query-specification fqn="queries.x_inv49_1"/> 38 <query-specification fqn="queries.x_inv49_1"/>
39 <query-specification fqn="queries.x_inv49_2"/> 39 <query-specification fqn="queries.x_inv49_2"/>
40 </group> 40 </group>
41 </extension> 41 </extension>
42</plugin> 42</plugin>
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbin b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbin
index 3430ce88..163f84a1 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbin
+++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/.GeneratePledgeModels.xtendbin
Binary files differ
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java
index 35ddb32f..2809679d 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java
+++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/xtend-gen/run/GeneratePledgeModels.java
@@ -1,314 +1,314 @@
1package run; 1package run;
2 2
3import Taxation.TaxationPackage; 3import Taxation.TaxationPackage;
4import com.google.common.base.Objects; 4import com.google.common.base.Objects;
5import com.google.common.collect.Iterables; 5import com.google.common.collect.Iterables;
6import com.google.inject.Injector; 6import com.google.inject.Injector;
7import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic; 7import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic;
8import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration; 8import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration;
9import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace; 9import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace;
10import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; 10import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor;
11import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel; 11import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel;
12import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicModelInterpretation; 12import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicModelInterpretation;
13import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; 13import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput;
14import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type; 14import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type;
15import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem; 15import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem;
16import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult; 16import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult;
17import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult; 17import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult;
18import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.Statistics; 18import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.Statistics;
19import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore; 19import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore;
20import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic; 20import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic;
21import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; 21import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor;
22import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic; 22import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic;
23import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation; 23import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation;
24import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; 24import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml;
25import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; 25import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation;
26import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DebugConfiguration; 26import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DebugConfiguration;
27import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner; 27import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner;
28import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; 28import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration;
29import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser; 29import hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz.GraphvizVisualiser;
30import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; 30import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace;
31import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace; 31import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace;
32import java.math.BigDecimal; 32import java.math.BigDecimal;
33import java.text.SimpleDateFormat; 33import java.text.SimpleDateFormat;
34import java.util.Collections; 34import java.util.Collections;
35import java.util.Date; 35import java.util.Date;
36import java.util.HashMap; 36import java.util.HashMap;
37import java.util.List; 37import java.util.List;
38import java.util.Map; 38import java.util.Map;
39import java.util.Set; 39import java.util.Set;
40import java.util.TreeSet; 40import java.util.TreeSet;
41import org.eclipse.emf.common.util.EList; 41import org.eclipse.emf.common.util.EList;
42import org.eclipse.emf.ecore.EAttribute; 42import org.eclipse.emf.ecore.EAttribute;
43import org.eclipse.emf.ecore.EClass; 43import org.eclipse.emf.ecore.EClass;
44import org.eclipse.emf.ecore.EEnum; 44import org.eclipse.emf.ecore.EEnum;
45import org.eclipse.emf.ecore.EEnumLiteral; 45import org.eclipse.emf.ecore.EEnumLiteral;
46import org.eclipse.emf.ecore.EObject; 46import org.eclipse.emf.ecore.EObject;
47import org.eclipse.emf.ecore.EPackage; 47import org.eclipse.emf.ecore.EPackage;
48import org.eclipse.emf.ecore.EReference; 48import org.eclipse.emf.ecore.EReference;
49import org.eclipse.emf.ecore.EStructuralFeature; 49import org.eclipse.emf.ecore.EStructuralFeature;
50import org.eclipse.emf.ecore.resource.Resource; 50import org.eclipse.emf.ecore.resource.Resource;
51import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; 51import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
52import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup; 52import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup;
53import org.eclipse.viatra.query.runtime.api.IQueryGroup; 53import org.eclipse.viatra.query.runtime.api.IQueryGroup;
54import org.eclipse.viatra.query.runtime.api.IQuerySpecification; 54import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
55import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; 55import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
56import org.eclipse.viatra.query.runtime.rete.matcher.ReteEngine; 56import org.eclipse.viatra.query.runtime.rete.matcher.ReteEngine;
57import org.eclipse.xtend2.lib.StringConcatenation; 57import org.eclipse.xtend2.lib.StringConcatenation;
58import org.eclipse.xtext.xbase.lib.CollectionExtensions; 58import org.eclipse.xtext.xbase.lib.CollectionExtensions;
59import org.eclipse.xtext.xbase.lib.CollectionLiterals; 59import org.eclipse.xtext.xbase.lib.CollectionLiterals;
60import org.eclipse.xtext.xbase.lib.Exceptions; 60import org.eclipse.xtext.xbase.lib.Exceptions;
61import org.eclipse.xtext.xbase.lib.ExclusiveRange; 61import org.eclipse.xtext.xbase.lib.ExclusiveRange;
62import org.eclipse.xtext.xbase.lib.Functions.Function1; 62import org.eclipse.xtext.xbase.lib.Functions.Function1;
63import org.eclipse.xtext.xbase.lib.InputOutput; 63import org.eclipse.xtext.xbase.lib.InputOutput;
64import org.eclipse.xtext.xbase.lib.IterableExtensions; 64import org.eclipse.xtext.xbase.lib.IterableExtensions;
65import org.eclipse.xtext.xbase.lib.ListExtensions; 65import org.eclipse.xtext.xbase.lib.ListExtensions;
66import org.eclipse.xtext.xbase.lib.ObjectExtensions; 66import org.eclipse.xtext.xbase.lib.ObjectExtensions;
67import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; 67import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
68 68
69@SuppressWarnings("all") 69@SuppressWarnings("all")
70public class GeneratePledgeModels { 70public class GeneratePledgeModels {
71 public static void main(final String[] args) { 71 public static void main(final String[] args) {
72 try { 72 try {
73 final Injector x = new EMFPatternLanguageStandaloneSetup().createInjectorAndDoEMFRegistration(); 73 final Injector x = new EMFPatternLanguageStandaloneSetup().createInjectorAndDoEMFRegistration();
74 Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); 74 Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
75 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); 75 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl();
76 _extensionToFactoryMap.put("xmi", _xMIResourceFactoryImpl); 76 _extensionToFactoryMap.put("xmi", _xMIResourceFactoryImpl);
77 Map<String, Object> _extensionToFactoryMap_1 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); 77 Map<String, Object> _extensionToFactoryMap_1 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
78 XMIResourceFactoryImpl _xMIResourceFactoryImpl_1 = new XMIResourceFactoryImpl(); 78 XMIResourceFactoryImpl _xMIResourceFactoryImpl_1 = new XMIResourceFactoryImpl();
79 _extensionToFactoryMap_1.put("logicproblem", _xMIResourceFactoryImpl_1); 79 _extensionToFactoryMap_1.put("logicproblem", _xMIResourceFactoryImpl_1);
80 Map<String, Object> _extensionToFactoryMap_2 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); 80 Map<String, Object> _extensionToFactoryMap_2 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
81 XMIResourceFactoryImpl _xMIResourceFactoryImpl_2 = new XMIResourceFactoryImpl(); 81 XMIResourceFactoryImpl _xMIResourceFactoryImpl_2 = new XMIResourceFactoryImpl();
82 _extensionToFactoryMap_2.put("partialmodel", _xMIResourceFactoryImpl_2); 82 _extensionToFactoryMap_2.put("partialmodel", _xMIResourceFactoryImpl_2);
83 ReteEngine.class.getClass(); 83 ReteEngine.class.getClass();
84 final Ecore2Logic ecore2Logic = new Ecore2Logic(); 84 final Ecore2Logic ecore2Logic = new Ecore2Logic();
85 final Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic); 85 final Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic);
86 final Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic); 86 final Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic);
87 final InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic(); 87 final InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic();
88 long _currentTimeMillis = System.currentTimeMillis(); 88 long _currentTimeMillis = System.currentTimeMillis();
89 final Date date = new Date(_currentTimeMillis); 89 final Date date = new Date(_currentTimeMillis);
90 final SimpleDateFormat format = new SimpleDateFormat("dd-HHmm"); 90 final SimpleDateFormat format = new SimpleDateFormat("dd-HHmm");
91 final String formattedDate = format.format(date); 91 final String formattedDate = format.format(date);
92 StringConcatenation _builder = new StringConcatenation(); 92 StringConcatenation _builder = new StringConcatenation();
93 _builder.append("inputs/"); 93 _builder.append("inputs/");
94 final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), ""); 94 final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), "");
95 StringConcatenation _builder_1 = new StringConcatenation(); 95 StringConcatenation _builder_1 = new StringConcatenation();
96 _builder_1.append("output/"); 96 _builder_1.append("output/");
97 String _plus = (_builder_1.toString() + formattedDate); 97 String _plus = (_builder_1.toString() + formattedDate);
98 StringConcatenation _builder_2 = new StringConcatenation(); 98 StringConcatenation _builder_2 = new StringConcatenation();
99 _builder_2.append("/"); 99 _builder_2.append("/");
100 String _plus_1 = (_plus + _builder_2); 100 String _plus_1 = (_plus + _builder_2);
101 final FileSystemWorkspace workspace = new FileSystemWorkspace(_plus_1, ""); 101 final FileSystemWorkspace workspace = new FileSystemWorkspace(_plus_1, "");
102 StringConcatenation _builder_3 = new StringConcatenation(); 102 StringConcatenation _builder_3 = new StringConcatenation();
103 _builder_3.append("output/"); 103 _builder_3.append("output/");
104 String _plus_2 = (_builder_3.toString() + formattedDate); 104 String _plus_2 = (_builder_3.toString() + formattedDate);
105 StringConcatenation _builder_4 = new StringConcatenation(); 105 StringConcatenation _builder_4 = new StringConcatenation();
106 _builder_4.append("/debug/"); 106 _builder_4.append("/debug/");
107 String _plus_3 = (_plus_2 + _builder_4); 107 String _plus_3 = (_plus_2 + _builder_4);
108 final FileSystemWorkspace debug = new FileSystemWorkspace(_plus_3, ""); 108 final FileSystemWorkspace debug = new FileSystemWorkspace(_plus_3, "");
109 workspace.initAndClear(); 109 workspace.initAndClear();
110 InputOutput.<String>println("Input and output workspaces are created"); 110 InputOutput.<String>println("Input and output workspaces are created");
111 final EcoreMetamodelDescriptor metamodel = GeneratePledgeModels.loadMetamodel(TaxationPackage.eINSTANCE); 111 final EcoreMetamodelDescriptor metamodel = GeneratePledgeModels.loadMetamodel(TaxationPackage.eINSTANCE);
112 final EList<EObject> partialModel = GeneratePledgeModels.loadPartialModel(inputs, "Household.xmi"); 112 final EList<EObject> partialModel = GeneratePledgeModels.loadPartialModel(inputs, "Household.xmi");
113 InputOutput.<String>println("DSL loaded"); 113 InputOutput.<String>println("DSL loaded");
114 final int SIZE = 2; 114 final int SIZE = 2;
115 int REPS = 1; 115 int REPS = 1;
116 final int RUNTIME = 600; 116 final int RUNTIME = 600;
117 Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration(); 117 Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration();
118 final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration); 118 final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration);
119 LogicProblem problem = modelGenerationProblem.getOutput(); 119 LogicProblem problem = modelGenerationProblem.getOutput();
120 debug.writeModel(problem, "problem.logicproblem"); 120 debug.writeModel(problem, "problem.logicproblem");
121 InputOutput.<String>println("Problem created"); 121 InputOutput.<String>println("Problem created");
122 for (int i = 0; (i < REPS); i++) { 122 for (int i = 0; (i < REPS); i++) {
123 { 123 {
124 ViatraReasoner reasoner = new ViatraReasoner(); 124 ViatraReasoner reasoner = new ViatraReasoner();
125 final TreeSet<Integer> knownIntegers = new TreeSet<Integer>(); 125 final TreeSet<Integer> knownIntegers = new TreeSet<Integer>();
126 CollectionExtensions.<Integer>addAll(knownIntegers, Integer.valueOf(0)); 126 CollectionExtensions.<Integer>addAll(knownIntegers, Integer.valueOf(0));
127 final TreeSet<BigDecimal> knownReals = new TreeSet<BigDecimal>(); 127 final TreeSet<BigDecimal> knownReals = new TreeSet<BigDecimal>();
128 BigDecimal _bigDecimal = new BigDecimal("0.0"); 128 BigDecimal _bigDecimal = new BigDecimal("0.0");
129 CollectionExtensions.<BigDecimal>addAll(knownReals, _bigDecimal); 129 CollectionExtensions.<BigDecimal>addAll(knownReals, _bigDecimal);
130 final TreeSet<String> knownStrings = new TreeSet<String>(); 130 final TreeSet<String> knownStrings = new TreeSet<String>();
131 CollectionExtensions.<String>addAll(knownStrings, "r0", "r1", "r2"); 131 CollectionExtensions.<String>addAll(knownStrings, "r0", "r1", "r2");
132 ViatraReasonerConfiguration _viatraReasonerConfiguration = new ViatraReasonerConfiguration(); 132 ViatraReasonerConfiguration _viatraReasonerConfiguration = new ViatraReasonerConfiguration();
133 final Procedure1<ViatraReasonerConfiguration> _function = (ViatraReasonerConfiguration it) -> { 133 final Procedure1<ViatraReasonerConfiguration> _function = (ViatraReasonerConfiguration it) -> {
134 it.documentationLevel = DocumentationLevel.FULL; 134 it.documentationLevel = DocumentationLevel.FULL;
135 DebugConfiguration _debugConfiguration = new DebugConfiguration(); 135 DebugConfiguration _debugConfiguration = new DebugConfiguration();
136 final Procedure1<DebugConfiguration> _function_1 = (DebugConfiguration it_1) -> { 136 final Procedure1<DebugConfiguration> _function_1 = (DebugConfiguration it_1) -> {
137 it_1.logging = true; 137 it_1.logging = true;
138 }; 138 };
139 DebugConfiguration _doubleArrow = ObjectExtensions.<DebugConfiguration>operator_doubleArrow(_debugConfiguration, _function_1); 139 DebugConfiguration _doubleArrow = ObjectExtensions.<DebugConfiguration>operator_doubleArrow(_debugConfiguration, _function_1);
140 it.debugCongiguration = _doubleArrow; 140 it.debugCongiguration = _doubleArrow;
141 it.runtimeLimit = RUNTIME; 141 it.runtimeLimit = RUNTIME;
142 boolean _isEmpty = knownIntegers.isEmpty(); 142 boolean _isEmpty = knownIntegers.isEmpty();
143 boolean _not = (!_isEmpty); 143 boolean _not = (!_isEmpty);
144 if (_not) { 144 if (_not) {
145 it.typeScopes.knownIntegers = knownIntegers; 145 it.typeScopes.knownIntegers = knownIntegers;
146 } 146 }
147 boolean _isEmpty_1 = knownReals.isEmpty(); 147 boolean _isEmpty_1 = knownReals.isEmpty();
148 boolean _not_1 = (!_isEmpty_1); 148 boolean _not_1 = (!_isEmpty_1);
149 if (_not_1) { 149 if (_not_1) {
150 it.typeScopes.knownReals = knownReals; 150 it.typeScopes.knownReals = knownReals;
151 } 151 }
152 }; 152 };
153 final ViatraReasonerConfiguration solverConfig = ObjectExtensions.<ViatraReasonerConfiguration>operator_doubleArrow(_viatraReasonerConfiguration, _function); 153 final ViatraReasonerConfiguration solverConfig = ObjectExtensions.<ViatraReasonerConfiguration>operator_doubleArrow(_viatraReasonerConfiguration, _function);
154 InputOutput.<String>println((("Run #" + Integer.valueOf(i)) + ":")); 154 InputOutput.<String>println((("Run #" + Integer.valueOf(i)) + ":"));
155 final long startTime = System.currentTimeMillis(); 155 final long startTime = System.currentTimeMillis();
156 LogicResult solution = reasoner.solve(problem, solverConfig, debug); 156 LogicResult solution = reasoner.solve(problem, solverConfig, debug);
157 long _currentTimeMillis_1 = System.currentTimeMillis(); 157 long _currentTimeMillis_1 = System.currentTimeMillis();
158 final long totalTime = (_currentTimeMillis_1 - startTime); 158 final long totalTime = (_currentTimeMillis_1 - startTime);
159 InputOutput.<String>println(" Problem Solved"); 159 InputOutput.<String>println(" Problem Solved");
160 GeneratePledgeModels.writeStats(solution, totalTime, solverConfig); 160 GeneratePledgeModels.writeStats(solution, totalTime, solverConfig);
161 if ((solution instanceof ModelResult)) { 161 if ((solution instanceof ModelResult)) {
162 GeneratePledgeModels.writeRepresentation(solution, workspace, i); 162 GeneratePledgeModels.writeRepresentation(solution, workspace, i);
163 GeneratePledgeModels.writeInterpretation(solution, logic2Ecore, workspace, i, reasoner, modelGenerationProblem); 163 GeneratePledgeModels.writeInterpretation(solution, logic2Ecore, workspace, i, reasoner, modelGenerationProblem);
164 InputOutput.<String>println(" Solution saved and visualised"); 164 InputOutput.<String>println(" Solution saved and visualised");
165 } else { 165 } else {
166 String _string = solution.getClass().getSimpleName().toString(); 166 String _string = solution.getClass().getSimpleName().toString();
167 String _plus_4 = (" Returned: " + _string); 167 String _plus_4 = (" Returned: " + _string);
168 InputOutput.<String>println(_plus_4); 168 InputOutput.<String>println(_plus_4);
169 } 169 }
170 final Runtime r = Runtime.getRuntime(); 170 final Runtime r = Runtime.getRuntime();
171 r.gc(); 171 r.gc();
172 r.gc(); 172 r.gc();
173 r.gc(); 173 r.gc();
174 Thread.sleep(3000); 174 Thread.sleep(3000);
175 } 175 }
176 } 176 }
177 InputOutput.<String>println("---End---"); 177 InputOutput.<String>println("---End---");
178 } catch (Throwable _e) { 178 } catch (Throwable _e) {
179 throw Exceptions.sneakyThrow(_e); 179 throw Exceptions.sneakyThrow(_e);
180 } 180 }
181 } 181 }
182 182
183 public static Map<Type, Integer> getTypeMap(final Map<Class, Integer> classMap, final EcoreMetamodelDescriptor metamodel, final Ecore2Logic e2l, final Ecore2Logic_Trace trace) { 183 public static Map<Type, Integer> getTypeMap(final Map<Class, Integer> classMap, final EcoreMetamodelDescriptor metamodel, final Ecore2Logic e2l, final Ecore2Logic_Trace trace) {
184 final HashMap<Type, Integer> typeMap = new HashMap<Type, Integer>(); 184 final HashMap<Type, Integer> typeMap = new HashMap<Type, Integer>();
185 final Function1<EClass, String> _function = (EClass s) -> { 185 final Function1<EClass, String> _function = (EClass s) -> {
186 return s.getName(); 186 return s.getName();
187 }; 187 };
188 final Map<String, EClass> listMap = IterableExtensions.<String, EClass>toMap(metamodel.getClasses(), _function); 188 final Map<String, EClass> listMap = IterableExtensions.<String, EClass>toMap(metamodel.getClasses(), _function);
189 Set<Class> _keySet = classMap.keySet(); 189 Set<Class> _keySet = classMap.keySet();
190 for (final Class elem : _keySet) { 190 for (final Class elem : _keySet) {
191 typeMap.put( 191 typeMap.put(
192 e2l.TypeofEClass(trace, 192 e2l.TypeofEClass(trace,
193 listMap.get(elem.getSimpleName())), classMap.get(elem)); 193 listMap.get(elem.getSimpleName())), classMap.get(elem));
194 } 194 }
195 return typeMap; 195 return typeMap;
196 } 196 }
197 197
198 public static EcoreMetamodelDescriptor loadMetamodel(final EPackage pckg) { 198 public static EcoreMetamodelDescriptor loadMetamodel(final EPackage pckg) {
199 final List<EClass> classes = IterableExtensions.<EClass>toList(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class)); 199 final List<EClass> classes = IterableExtensions.<EClass>toList(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class));
200 final List<EEnum> enums = IterableExtensions.<EEnum>toList(Iterables.<EEnum>filter(pckg.getEClassifiers(), EEnum.class)); 200 final List<EEnum> enums = IterableExtensions.<EEnum>toList(Iterables.<EEnum>filter(pckg.getEClassifiers(), EEnum.class));
201 final Function1<EEnum, EList<EEnumLiteral>> _function = (EEnum it) -> { 201 final Function1<EEnum, EList<EEnumLiteral>> _function = (EEnum it) -> {
202 return it.getELiterals(); 202 return it.getELiterals();
203 }; 203 };
204 final List<EEnumLiteral> literals = IterableExtensions.<EEnumLiteral>toList(Iterables.<EEnumLiteral>concat(ListExtensions.<EEnum, EList<EEnumLiteral>>map(enums, _function))); 204 final List<EEnumLiteral> literals = IterableExtensions.<EEnumLiteral>toList(Iterables.<EEnumLiteral>concat(ListExtensions.<EEnum, EList<EEnumLiteral>>map(enums, _function)));
205 final Function1<EClass, EList<EReference>> _function_1 = (EClass it) -> { 205 final Function1<EClass, EList<EReference>> _function_1 = (EClass it) -> {
206 return it.getEReferences(); 206 return it.getEReferences();
207 }; 207 };
208 final List<EReference> references = IterableExtensions.<EReference>toList(Iterables.<EReference>concat(ListExtensions.<EClass, EList<EReference>>map(classes, _function_1))); 208 final List<EReference> references = IterableExtensions.<EReference>toList(Iterables.<EReference>concat(ListExtensions.<EClass, EList<EReference>>map(classes, _function_1)));
209 final Function1<EClass, EList<EAttribute>> _function_2 = (EClass it) -> { 209 final Function1<EClass, EList<EAttribute>> _function_2 = (EClass it) -> {
210 return it.getEAttributes(); 210 return it.getEAttributes();
211 }; 211 };
212 final List<EAttribute> attributes = IterableExtensions.<EAttribute>toList(Iterables.<EAttribute>concat(ListExtensions.<EClass, EList<EAttribute>>map(classes, _function_2))); 212 final List<EAttribute> attributes = IterableExtensions.<EAttribute>toList(Iterables.<EAttribute>concat(ListExtensions.<EClass, EList<EAttribute>>map(classes, _function_2)));
213 return new EcoreMetamodelDescriptor(classes, Collections.<EClass>unmodifiableSet(CollectionLiterals.<EClass>newHashSet()), false, enums, literals, references, attributes); 213 return new EcoreMetamodelDescriptor(classes, Collections.<EClass>unmodifiableSet(CollectionLiterals.<EClass>newHashSet()), false, enums, literals, references, attributes);
214 } 214 }
215 215
216 public static EList<EObject> loadPartialModel(final ReasonerWorkspace inputs, final String path) { 216 public static EList<EObject> loadPartialModel(final ReasonerWorkspace inputs, final String path) {
217 EList<EObject> _xblockexpression = null; 217 EList<EObject> _xblockexpression = null;
218 { 218 {
219 Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); 219 Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
220 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); 220 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl();
221 _extensionToFactoryMap.put("*", _xMIResourceFactoryImpl); 221 _extensionToFactoryMap.put("*", _xMIResourceFactoryImpl);
222 _xblockexpression = inputs.<EObject>readModel(EObject.class, path).eResource().getContents(); 222 _xblockexpression = inputs.<EObject>readModel(EObject.class, path).eResource().getContents();
223 } 223 }
224 return _xblockexpression; 224 return _xblockexpression;
225 } 225 }
226 226
227 public static ViatraQuerySetDescriptor loadQueries(final EcoreMetamodelDescriptor metamodel, final IQueryGroup i) { 227 public static ViatraQuerySetDescriptor loadQueries(final EcoreMetamodelDescriptor metamodel, final IQueryGroup i) {
228 final List<IQuerySpecification<?>> patterns = IterableExtensions.<IQuerySpecification<?>>toList(i.getSpecifications()); 228 final List<IQuerySpecification<?>> patterns = IterableExtensions.<IQuerySpecification<?>>toList(i.getSpecifications());
229 final Function1<IQuerySpecification<?>, Boolean> _function = (IQuerySpecification<?> it) -> { 229 final Function1<IQuerySpecification<?>, Boolean> _function = (IQuerySpecification<?> it) -> {
230 final Function1<PAnnotation, Boolean> _function_1 = (PAnnotation it_1) -> { 230 final Function1<PAnnotation, Boolean> _function_1 = (PAnnotation it_1) -> {
231 String _name = it_1.getName(); 231 String _name = it_1.getName();
232 return Boolean.valueOf(Objects.equal(_name, "Constraint")); 232 return Boolean.valueOf(Objects.equal(_name, "Constraint"));
233 }; 233 };
234 return Boolean.valueOf(IterableExtensions.<PAnnotation>exists(it.getAllAnnotations(), _function_1)); 234 return Boolean.valueOf(IterableExtensions.<PAnnotation>exists(it.getAllAnnotations(), _function_1));
235 }; 235 };
236 final Set<IQuerySpecification<?>> wfPatterns = IterableExtensions.<IQuerySpecification<?>>toSet(IterableExtensions.<IQuerySpecification<?>>filter(patterns, _function)); 236 final Set<IQuerySpecification<?>> wfPatterns = IterableExtensions.<IQuerySpecification<?>>toSet(IterableExtensions.<IQuerySpecification<?>>filter(patterns, _function));
237 final Map<IQuerySpecification<?>, EStructuralFeature> derivedFeatures = CollectionLiterals.<IQuerySpecification<?>, EStructuralFeature>emptyMap(); 237 final Map<IQuerySpecification<?>, EStructuralFeature> derivedFeatures = CollectionLiterals.<IQuerySpecification<?>, EStructuralFeature>emptyMap();
238 final ViatraQuerySetDescriptor res = new ViatraQuerySetDescriptor(patterns, wfPatterns, derivedFeatures); 238 final ViatraQuerySetDescriptor res = new ViatraQuerySetDescriptor(patterns, wfPatterns, derivedFeatures);
239 return res; 239 return res;
240 } 240 }
241 241
242 public static void writeInterpretation(final LogicResult solution, final Logic2Ecore logic2Ecore, final ReasonerWorkspace workspace, final int i, final ViatraReasoner reasoner, final TracedOutput<LogicProblem, Ecore2Logic_Trace> mgProb) { 242 public static void writeInterpretation(final LogicResult solution, final Logic2Ecore logic2Ecore, final ReasonerWorkspace workspace, final int i, final ViatraReasoner reasoner, final TracedOutput<LogicProblem, Ecore2Logic_Trace> mgProb) {
243 final List<? extends LogicModelInterpretation> interpretations = reasoner.getInterpretations(((ModelResult) solution)); 243 final List<? extends LogicModelInterpretation> interpretations = reasoner.getInterpretations(((ModelResult) solution));
244 int _size = interpretations.size(); 244 int _size = interpretations.size();
245 ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); 245 ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
246 for (final Integer interpIndex : _doubleDotLessThan) { 246 for (final Integer interpIndex : _doubleDotLessThan) {
247 { 247 {
248 final LogicModelInterpretation interpretation = interpretations.get((interpIndex).intValue()); 248 final LogicModelInterpretation interpretation = interpretations.get((interpIndex).intValue());
249 final EObject model = logic2Ecore.transformInterpretation(interpretation, mgProb.getTrace()); 249 final EObject model = logic2Ecore.transformInterpretation(interpretation, mgProb.getTrace());
250 StringConcatenation _builder = new StringConcatenation(); 250 StringConcatenation _builder = new StringConcatenation();
251 _builder.append("solution"); 251 _builder.append("solution");
252 _builder.append(i); 252 _builder.append(i);
253 _builder.append("_"); 253 _builder.append("_");
254 _builder.append(interpIndex); 254 _builder.append(interpIndex);
255 _builder.append(".xmi"); 255 _builder.append(".xmi");
256 workspace.writeModel(model, _builder.toString()); 256 workspace.writeModel(model, _builder.toString());
257 } 257 }
258 } 258 }
259 } 259 }
260 260
261 public static void writeRepresentation(final LogicResult solution, final ReasonerWorkspace workspace, final int i) { 261 public static void writeRepresentation(final LogicResult solution, final ReasonerWorkspace workspace, final int i) {
262 final EList<Object> representations = solution.getRepresentation(); 262 final EList<Object> representations = solution.getRepresentation();
263 int _size = representations.size(); 263 int _size = representations.size();
264 ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true); 264 ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _size, true);
265 for (final Integer representationIndex : _doubleDotLessThan) { 265 for (final Integer representationIndex : _doubleDotLessThan) {
266 { 266 {
267 final Object representation = representations.get((representationIndex).intValue()); 267 final Object representation = representations.get((representationIndex).intValue());
268 if ((representation instanceof PartialInterpretation)) { 268 if ((representation instanceof PartialInterpretation)) {
269 final String gml = new PartialInterpretation2Gml().transform(((PartialInterpretation)representation)); 269 final String gml = new PartialInterpretation2Gml().transform(((PartialInterpretation)representation));
270 StringConcatenation _builder = new StringConcatenation(); 270 StringConcatenation _builder = new StringConcatenation();
271 _builder.append("solution"); 271 _builder.append("solution");
272 _builder.append(i); 272 _builder.append(i);
273 _builder.append("_"); 273 _builder.append("_");
274 _builder.append(representationIndex); 274 _builder.append(representationIndex);
275 _builder.append(".gml"); 275 _builder.append(".gml");
276 workspace.writeText(_builder.toString(), gml); 276 workspace.writeText(_builder.toString(), gml);
277 final PartialInterpretationVisualisation png = new GraphvizVisualiser().visualiseConcretization(((PartialInterpretation)representation)); 277 final PartialInterpretationVisualisation png = new GraphvizVisualiser().visualiseConcretization(((PartialInterpretation)representation));
278 StringConcatenation _builder_1 = new StringConcatenation(); 278 StringConcatenation _builder_1 = new StringConcatenation();
279 _builder_1.append("solution"); 279 _builder_1.append("solution");
280 _builder_1.append(i); 280 _builder_1.append(i);
281 _builder_1.append("_"); 281 _builder_1.append("_");
282 _builder_1.append(representationIndex); 282 _builder_1.append(representationIndex);
283 _builder_1.append(".png"); 283 _builder_1.append(".png");
284 png.writeToFile(workspace, _builder_1.toString()); 284 png.writeToFile(workspace, _builder_1.toString());
285 } else { 285 } else {
286 StringConcatenation _builder_2 = new StringConcatenation(); 286 StringConcatenation _builder_2 = new StringConcatenation();
287 _builder_2.append("solution"); 287 _builder_2.append("solution");
288 _builder_2.append(representationIndex); 288 _builder_2.append(representationIndex);
289 _builder_2.append(".txt"); 289 _builder_2.append(".txt");
290 workspace.writeText(_builder_2.toString(), representation.toString()); 290 workspace.writeText(_builder_2.toString(), representation.toString());
291 } 291 }
292 } 292 }
293 } 293 }
294 } 294 }
295 295
296 public static String writeStats(final LogicResult solution, final long time, final ViatraReasonerConfiguration config) { 296 public static String writeStats(final LogicResult solution, final long time, final ViatraReasonerConfiguration config) {
297 String _xblockexpression = null; 297 String _xblockexpression = null;
298 { 298 {
299 final Statistics stats = solution.getStatistics(); 299 final Statistics stats = solution.getStatistics();
300 InputOutput.<String>println(" Statistics:"); 300 InputOutput.<String>println(" Statistics:");
301 Object _xifexpression = null; 301 Object _xifexpression = null;
302 if ((config.typeScopes.maxNewElements == 2147483647)) { 302 if ((config.typeScopes.maxNewElements == 2147483647)) {
303 _xifexpression = "*"; 303 _xifexpression = "*";
304 } else { 304 } else {
305 _xifexpression = Integer.valueOf(config.typeScopes.maxNewElements); 305 _xifexpression = Integer.valueOf(config.typeScopes.maxNewElements);
306 } 306 }
307 String _plus = (((" #new nodes : [" + Integer.valueOf(config.typeScopes.minNewElements)) + "..") + _xifexpression); 307 String _plus = (((" #new nodes : [" + Integer.valueOf(config.typeScopes.minNewElements)) + "..") + _xifexpression);
308 String _plus_1 = (_plus + "]"); 308 String _plus_1 = (_plus + "]");
309 InputOutput.<String>println(_plus_1); 309 InputOutput.<String>println(_plus_1);
310 _xblockexpression = InputOutput.<String>println(((" \"solve\" time: " + Double.valueOf((((double) time) / 1000))) + " s")); 310 _xblockexpression = InputOutput.<String>println(((" \"solve\" time: " + Double.valueOf((((double) time) / 1000))) + " s"));
311 } 311 }
312 return _xblockexpression; 312 return _xblockexpression;
313 } 313 }
314} 314}
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml
index 2f4febdb..c760d4ef 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml
+++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml
@@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8"?><plugin/> <?xml version="1.0" encoding="UTF-8"?><plugin/>