aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Aren Babikian <aren.babikian@mail.mcgill.ca>2020-12-12 19:32:03 -0500
committerLibravatar Aren Babikian <aren.babikian@mail.mcgill.ca>2020-12-12 19:32:03 -0500
commitdbff2af693d0fd758210abb16cdc7c906004dcc7 (patch)
treec6c0ffd3b546480ac5cd8352f62fd0b6ae32661d
parentPrefer the global scope insted of nsURI in application configuration (diff)
downloadVIATRA-Generator-dbff2af693d0fd758210abb16cdc7c906004dcc7.tar.gz
VIATRA-Generator-dbff2af693d0fd758210abb16cdc7c906004dcc7.tar.zst
VIATRA-Generator-dbff2af693d0fd758210abb16cdc7c906004dcc7.zip
remove auto-generated files and fix gitignores
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application.ide/.gitignore1
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbinbin1700 -> 0 bytes
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbinbin2525 -> 0 bytes
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.gitignore6
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeModule.java13
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeSetup.java24
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/.gitignore1
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/.gitignore3
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/contentassist/.gitignore3
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/highlight/.gitignore6
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/labeling/.gitignore6
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/outline/.gitignore3
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/quickfix/.gitignore3
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticHighlightCalculator.xtendbinbin5333 -> 0 bytes
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticTextAttributeProvider.xtendbinbin4902 -> 0 bytes
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.gitignore6
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticHighlightCalculator.java83
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticTextAttributeProvider.java63
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.SolverLanguageValidator.xtendbinbin1716 -> 0 bytes
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore3
-rw-r--r--Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/SolverLanguageValidator.java15
-rw-r--r--Application/org.eclipse.viatra.solver.language/.gitignore1
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/.gitignore6
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/generator/.gitignore3
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.SolverLanguageTokenDefInjectingParser.xtendbinbin2741 -> 0 bytes
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.gitignore9
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/SolverLanguageTokenDefInjectingParser.java26
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/scoping/.gitignore3
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.SolverLanguageSyntheticTokenSyntacticSequencer.xtendbinbin2757 -> 0 bytes
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.gitignore3
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntheticTokenSyntacticSequencer.java24
-rw-r--r--Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore3
-rw-r--r--Solvers/VIATRA-Solver/org.eclipse.viatra.dse/.gitignore1
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.model/.gitignore1
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/.gitignore3
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/.gitignore1
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._tracebin773 -> 0 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.MemberIsItsOwnParent.java._tracebin3540 -> 0 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.gitignore13
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/familyTreeConstraints.vql41
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/errors.txt22
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated792
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generation.logicproblem340
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/init.partialmodel51
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/log.txt1
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.gml916
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.pngbin90845 -> 0 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.xmi8
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.FamilyTreeConstraints.java._tracebin773 -> 0 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.MemberIsItsOwnParent.java._tracebin3540 -> 0 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.gitignore13
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/FamilyTreeConstraints.java97
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberHasParent.java551
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberIsItsOwnParent.java577
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/NegativeAge.java593
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/ParentTooYoung.java775
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/TwoMembersHaveNoParent.java723
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/.gitignore2
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/.UML2TGF.xtendbinbin6885 -> 0 bytes
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/.gitignore3
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/UML2TGF.java234
-rw-r--r--Tests/MODELS2020-CaseStudies/case.study.pledge.run/.gitignore1
62 files changed, 10 insertions, 6066 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/.gitignore b/Application/hu.bme.mit.inf.dslreasoner.application.ide/.gitignore
index ae3c1726..b33f6aff 100644
--- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/.gitignore
+++ b/Application/hu.bme.mit.inf.dslreasoner.application.ide/.gitignore
@@ -1 +1,2 @@
1/bin/ 1/bin/
2/xtend-gen/
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin
deleted file mode 100644
index 1c86e38f..00000000
--- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin
+++ /dev/null
Binary files differ
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin
deleted file mode 100644
index 57c8ab25..00000000
--- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin
+++ /dev/null
Binary files differ
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.gitignore b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.gitignore
deleted file mode 100644
index c41377d5..00000000
--- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
1/.ApplicationConfigurationIdeModule.java._trace
2/.ApplicationConfigurationIdeSetup.java._trace
3/.ApplicationConfigurationIdeModule.xtendbin
4/.ApplicationConfigurationIdeSetup.xtendbin
5/ApplicationConfigurationIdeModule.java
6/ApplicationConfigurationIdeSetup.java
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeModule.java b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeModule.java
deleted file mode 100644
index f4d40594..00000000
--- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeModule.java
+++ /dev/null
@@ -1,13 +0,0 @@
1/**
2 * generated by Xtext 2.12.0
3 */
4package hu.bme.mit.inf.dslreasoner.application.ide;
5
6import hu.bme.mit.inf.dslreasoner.application.ide.AbstractApplicationConfigurationIdeModule;
7
8/**
9 * Use this class to register ide components.
10 */
11@SuppressWarnings("all")
12public class ApplicationConfigurationIdeModule extends AbstractApplicationConfigurationIdeModule {
13}
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeSetup.java b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeSetup.java
deleted file mode 100644
index 2281147c..00000000
--- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeSetup.java
+++ /dev/null
@@ -1,24 +0,0 @@
1/**
2 * generated by Xtext 2.12.0
3 */
4package hu.bme.mit.inf.dslreasoner.application.ide;
5
6import com.google.inject.Guice;
7import com.google.inject.Injector;
8import hu.bme.mit.inf.dslreasoner.application.ApplicationConfigurationRuntimeModule;
9import hu.bme.mit.inf.dslreasoner.application.ApplicationConfigurationStandaloneSetup;
10import hu.bme.mit.inf.dslreasoner.application.ide.ApplicationConfigurationIdeModule;
11import org.eclipse.xtext.util.Modules2;
12
13/**
14 * Initialization support for running Xtext languages as language servers.
15 */
16@SuppressWarnings("all")
17public class ApplicationConfigurationIdeSetup extends ApplicationConfigurationStandaloneSetup {
18 @Override
19 public Injector createInjector() {
20 ApplicationConfigurationRuntimeModule _applicationConfigurationRuntimeModule = new ApplicationConfigurationRuntimeModule();
21 ApplicationConfigurationIdeModule _applicationConfigurationIdeModule = new ApplicationConfigurationIdeModule();
22 return Guice.createInjector(Modules2.mixin(_applicationConfigurationRuntimeModule, _applicationConfigurationIdeModule));
23 }
24}
diff --git a/Application/org.eclipse.viatra.solver.language.ui/.gitignore b/Application/org.eclipse.viatra.solver.language.ui/.gitignore
index ae3c1726..b33f6aff 100644
--- a/Application/org.eclipse.viatra.solver.language.ui/.gitignore
+++ b/Application/org.eclipse.viatra.solver.language.ui/.gitignore
@@ -1 +1,2 @@
1/bin/ 1/bin/
2/xtend-gen/
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/.gitignore b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/.gitignore
deleted file mode 100644
index 54297e9d..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.SolverLanguageUiModule.java._trace
2/.SolverLanguageUiModule.xtendbin
3/SolverLanguageUiModule.java
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/contentassist/.gitignore b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/contentassist/.gitignore
deleted file mode 100644
index 7bf487b6..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/contentassist/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.SolverLanguageProposalProvider.java._trace
2/.SolverLanguageProposalProvider.xtendbin
3/SolverLanguageProposalProvider.java
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/highlight/.gitignore b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/highlight/.gitignore
deleted file mode 100644
index 682fd167..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/highlight/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
1/.SolverSemanticHighlightCalculator.java._trace
2/.SolverSemanticHighlightCalculator.xtendbin
3/.SolverSemanticTextAttributeProvider.java._trace
4/.SolverSemanticTextAttributeProvider.xtendbin
5/SolverSemanticHighlightCalculator.java
6/SolverSemanticTextAttributeProvider.java
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/labeling/.gitignore b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/labeling/.gitignore
deleted file mode 100644
index 4f407d4c..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/labeling/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
1/.SolverLanguageDescriptionLabelProvider.java._trace
2/.SolverLanguageDescriptionLabelProvider.xtendbin
3/.SolverLanguageLabelProvider.java._trace
4/.SolverLanguageLabelProvider.xtendbin
5/SolverLanguageDescriptionLabelProvider.java
6/SolverLanguageLabelProvider.java
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/outline/.gitignore b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/outline/.gitignore
deleted file mode 100644
index 63ce4740..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/outline/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.SolverLanguageOutlineTreeProvider.java._trace
2/.SolverLanguageOutlineTreeProvider.xtendbin
3/SolverLanguageOutlineTreeProvider.java
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/quickfix/.gitignore b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/quickfix/.gitignore
deleted file mode 100644
index 37dbeadb..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/quickfix/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.SolverLanguageQuickfixProvider.java._trace
2/.SolverLanguageQuickfixProvider.xtendbin
3/SolverLanguageQuickfixProvider.java
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticHighlightCalculator.xtendbin b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticHighlightCalculator.xtendbin
deleted file mode 100644
index a107bf27..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticHighlightCalculator.xtendbin
+++ /dev/null
Binary files differ
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticTextAttributeProvider.xtendbin b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticTextAttributeProvider.xtendbin
deleted file mode 100644
index 994dbd52..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticTextAttributeProvider.xtendbin
+++ /dev/null
Binary files differ
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.gitignore b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.gitignore
deleted file mode 100644
index 61ce5bef..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
1/.SolverSemanticHighlightCalculator.java._trace
2/.SolverSemanticTextAttributeProvider.java._trace
3/.SolverSemanticHighlightCalculator.xtendbin
4/.SolverSemanticTextAttributeProvider.xtendbin
5/SolverSemanticHighlightCalculator.java
6/SolverSemanticTextAttributeProvider.java
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticHighlightCalculator.java b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticHighlightCalculator.java
deleted file mode 100644
index 2935dfd7..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticHighlightCalculator.java
+++ /dev/null
@@ -1,83 +0,0 @@
1package org.eclipse.viatra.solver.language.ui.syntaxcoloring;
2
3import com.google.common.collect.Iterators;
4import java.util.Iterator;
5import java.util.Random;
6import java.util.WeakHashMap;
7import org.eclipse.viatra.solver.language.solverLanguage.Reference;
8import org.eclipse.xtend2.lib.StringConcatenation;
9import org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultSemanticHighlightingCalculator;
10import org.eclipse.xtext.ide.editor.syntaxcoloring.IHighlightedPositionAcceptor;
11import org.eclipse.xtext.nodemodel.ICompositeNode;
12import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
13import org.eclipse.xtext.resource.XtextResource;
14import org.eclipse.xtext.util.CancelIndicator;
15
16@SuppressWarnings("all")
17public class SolverSemanticHighlightCalculator extends DefaultSemanticHighlightingCalculator {
18 public static final String SYMBOL_CODE = "SymbolCode::";
19
20 private final WeakHashMap<String, String> symbolName2ID = new WeakHashMap<String, String>();
21
22 @Override
23 public void provideHighlightingFor(final XtextResource resource, final IHighlightedPositionAcceptor acceptor, final CancelIndicator cancelIndicator) {
24 if (((resource == null) || (resource.getParseResult() == null))) {
25 return;
26 } else {
27 final Iterator<Reference> modelSymbols = Iterators.<Reference>filter(resource.getAllContents(), Reference.class);
28 while (modelSymbols.hasNext()) {
29 {
30 final Reference symbolElement = modelSymbols.next();
31 final ICompositeNode node = NodeModelUtils.getNode(symbolElement);
32 acceptor.addPosition(
33 node.getOffset(),
34 node.getLength(),
35 this.getSymbolCode(node.getText()));
36 }
37 }
38 }
39 }
40
41 public String getSymbolCode(final String name) {
42 boolean _containsKey = this.symbolName2ID.containsKey(name);
43 if (_containsKey) {
44 return this.symbolName2ID.get(name);
45 } else {
46 final String id = this.calculateSymbolCode(name);
47 this.symbolName2ID.put(name, id);
48 return id;
49 }
50 }
51
52 public String calculateSymbolCode(final String name) {
53 int _hashCode = name.hashCode();
54 final Random random = new Random(_hashCode);
55 final float hue = this.huePick(random.nextFloat());
56 float _nextFloat = random.nextFloat();
57 double _multiply = (_nextFloat * 0.3);
58 final double saturation = (0.2 + _multiply);
59 float _nextFloat_1 = random.nextFloat();
60 double _multiply_1 = (_nextFloat_1 * 0.2);
61 final double brightness = (_multiply_1 + 0.7f);
62 StringConcatenation _builder = new StringConcatenation();
63 _builder.append(SolverSemanticHighlightCalculator.SYMBOL_CODE);
64 _builder.append(" ");
65 _builder.append(hue);
66 _builder.append(" ");
67 _builder.append(saturation);
68 _builder.append(" ");
69 _builder.append(brightness);
70 return _builder.toString();
71 }
72
73 private float huePick(final float random) {
74 final int pink = 300;
75 final int tolerance = 10;
76 final float degree = (random * (360 - (2 * tolerance)));
77 if ((degree < (pink - tolerance))) {
78 return degree;
79 } else {
80 return (degree + (2 * tolerance));
81 }
82 }
83}
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticTextAttributeProvider.java b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticTextAttributeProvider.java
deleted file mode 100644
index 04824ad1..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticTextAttributeProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
1package org.eclipse.viatra.solver.language.ui.syntaxcoloring;
2
3import com.google.inject.Inject;
4import java.util.WeakHashMap;
5import org.eclipse.jface.text.TextAttribute;
6import org.eclipse.swt.graphics.Color;
7import org.eclipse.swt.graphics.Font;
8import org.eclipse.swt.graphics.RGB;
9import org.eclipse.viatra.solver.language.ui.syntaxcoloring.SolverSemanticHighlightCalculator;
10import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
11import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfiguration;
12import org.eclipse.xtext.ui.editor.syntaxcoloring.PreferenceStoreAccessor;
13import org.eclipse.xtext.ui.editor.syntaxcoloring.TextAttributeProvider;
14import org.eclipse.xtext.ui.editor.utils.EditorUtils;
15import org.eclipse.xtext.ui.editor.utils.TextStyle;
16
17@SuppressWarnings("all")
18public class SolverSemanticTextAttributeProvider extends TextAttributeProvider {
19 private final TextStyle defaultTextStyle = new TextStyle();
20
21 private final WeakHashMap<String, TextAttribute> colorID2TextAttribute = new WeakHashMap<String, TextAttribute>();
22
23 @Inject
24 public SolverSemanticTextAttributeProvider(final IHighlightingConfiguration highlightingConfig, final IPreferenceStoreAccess preferenceStoreAccess, final PreferenceStoreAccessor prefStoreAccessor) {
25 super(highlightingConfig, preferenceStoreAccess, prefStoreAccessor);
26 }
27
28 @Override
29 public TextAttribute getAttribute(final String id) {
30 TextAttribute _xifexpression = null;
31 boolean _isMetamodelElementColorID = this.isMetamodelElementColorID(id);
32 if (_isMetamodelElementColorID) {
33 boolean _containsKey = this.colorID2TextAttribute.containsKey(id);
34 if (_containsKey) {
35 return this.colorID2TextAttribute.get(id);
36 } else {
37 final TextAttribute style = this.metamodelElementTextStyle(id);
38 this.colorID2TextAttribute.put(id, style);
39 return style;
40 }
41 } else {
42 _xifexpression = super.getAttribute(id);
43 }
44 return _xifexpression;
45 }
46
47 private boolean isMetamodelElementColorID(final String id) {
48 return id.startsWith(SolverSemanticHighlightCalculator.SYMBOL_CODE);
49 }
50
51 private TextAttribute metamodelElementTextStyle(final String id) {
52 final String[] texts = id.split(" ");
53 float _parseFloat = Float.parseFloat(texts[1]);
54 float _parseFloat_1 = Float.parseFloat(texts[2]);
55 float _parseFloat_2 = Float.parseFloat(texts[3]);
56 final RGB backgroundColor = new RGB(_parseFloat, _parseFloat_1, _parseFloat_2);
57 Color _colorFromRGB = EditorUtils.colorFromRGB(this.defaultTextStyle.getColor());
58 Color _colorFromRGB_1 = EditorUtils.colorFromRGB(backgroundColor);
59 int _style = this.defaultTextStyle.getStyle();
60 Font _fontFromFontData = EditorUtils.fontFromFontData(this.defaultTextStyle.getFontData());
61 return new TextAttribute(_colorFromRGB, _colorFromRGB_1, _style, _fontFromFontData);
62 }
63}
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.SolverLanguageValidator.xtendbin b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.SolverLanguageValidator.xtendbin
deleted file mode 100644
index 9839769e..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.SolverLanguageValidator.xtendbin
+++ /dev/null
Binary files differ
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore
deleted file mode 100644
index 565d4b27..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.SolverLanguageValidator.java._trace
2/.SolverLanguageValidator.xtendbin
3/SolverLanguageValidator.java
diff --git a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/SolverLanguageValidator.java b/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/SolverLanguageValidator.java
deleted file mode 100644
index 2b8f158a..00000000
--- a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/SolverLanguageValidator.java
+++ /dev/null
@@ -1,15 +0,0 @@
1/**
2 * generated by Xtext 2.18.0.M3
3 */
4package org.eclipse.viatra.solver.language.validation;
5
6import org.eclipse.viatra.solver.language.validation.AbstractSolverLanguageValidator;
7
8/**
9 * This class contains custom validation rules.
10 *
11 * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation
12 */
13@SuppressWarnings("all")
14public class SolverLanguageValidator extends AbstractSolverLanguageValidator {
15}
diff --git a/Application/org.eclipse.viatra.solver.language/.gitignore b/Application/org.eclipse.viatra.solver.language/.gitignore
index ae3c1726..b33f6aff 100644
--- a/Application/org.eclipse.viatra.solver.language/.gitignore
+++ b/Application/org.eclipse.viatra.solver.language/.gitignore
@@ -1 +1,2 @@
1/bin/ 1/bin/
2/xtend-gen/
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/.gitignore b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/.gitignore
deleted file mode 100644
index 82298938..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
1/.SolverLanguageRuntimeModule.java._trace
2/.SolverLanguageRuntimeModule.xtendbin
3/.SolverLanguageStandaloneSetup.java._trace
4/.SolverLanguageStandaloneSetup.xtendbin
5/SolverLanguageRuntimeModule.java
6/SolverLanguageStandaloneSetup.java
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/generator/.gitignore b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/generator/.gitignore
deleted file mode 100644
index a9345b80..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/generator/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.SolverLanguageGenerator.java._trace
2/.SolverLanguageGenerator.xtendbin
3/SolverLanguageGenerator.java
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.SolverLanguageTokenDefInjectingParser.xtendbin b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.SolverLanguageTokenDefInjectingParser.xtendbin
deleted file mode 100644
index d2fd056e..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.SolverLanguageTokenDefInjectingParser.xtendbin
+++ /dev/null
Binary files differ
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.gitignore b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.gitignore
deleted file mode 100644
index 5fbb81c3..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
1/.SolverLangaugeSyntheticTokenParser.java._trace
2/.SolverLanguageSyntheticTokenTokenSource.java._trace
3/.LastTokenState.java._trace
4/.SolverLangusgeSyntheticTokenParser.java._trace
5/.SolverLanguageSyntheticTokenParser.java._trace
6/.SolverLanguageTokenSource.java._trace
7/.SolverLanguageTokenDefInjectingParser.java._trace
8/.SolverLanguageTokenDefInjectingParser.xtendbin
9/SolverLanguageTokenDefInjectingParser.java
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/SolverLanguageTokenDefInjectingParser.java b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/SolverLanguageTokenDefInjectingParser.java
deleted file mode 100644
index 12c92733..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/SolverLanguageTokenDefInjectingParser.java
+++ /dev/null
@@ -1,26 +0,0 @@
1package org.eclipse.viatra.solver.language.parser.antlr;
2
3import com.google.inject.Inject;
4import org.antlr.runtime.CharStream;
5import org.antlr.runtime.TokenSource;
6import org.eclipse.viatra.solver.language.parser.antlr.SolverLanguageParser;
7import org.eclipse.viatra.solver.language.parser.antlr.SolverLanguageTokenSource;
8import org.eclipse.xtext.parser.antlr.ITokenDefProvider;
9
10@SuppressWarnings("all")
11public class SolverLanguageTokenDefInjectingParser extends SolverLanguageParser {
12 @Inject
13 private ITokenDefProvider tokenDefProvider;
14
15 @Override
16 protected TokenSource createLexer(final CharStream stream) {
17 SolverLanguageTokenSource _xblockexpression = null;
18 {
19 TokenSource _createLexer = super.createLexer(stream);
20 final SolverLanguageTokenSource tokenSource = ((SolverLanguageTokenSource) _createLexer);
21 tokenSource.initializeTokenDefsFrom(this.tokenDefProvider);
22 _xblockexpression = tokenSource;
23 }
24 return _xblockexpression;
25 }
26}
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/scoping/.gitignore b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/scoping/.gitignore
deleted file mode 100644
index 16497231..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/scoping/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.SolverLanguageScopeProvider.java._trace
2/.SolverLanguageScopeProvider.xtendbin
3/SolverLanguageScopeProvider.java
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.SolverLanguageSyntheticTokenSyntacticSequencer.xtendbin b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.SolverLanguageSyntheticTokenSyntacticSequencer.xtendbin
deleted file mode 100644
index 30cf1dbd..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.SolverLanguageSyntheticTokenSyntacticSequencer.xtendbin
+++ /dev/null
Binary files differ
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.gitignore b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.gitignore
deleted file mode 100644
index 1f04090d..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.SolverLanguageSyntheticTokenSyntacticSequencer.java._trace
2/.SolverLanguageSyntheticTokenSyntacticSequencer.xtendbin
3/SolverLanguageSyntheticTokenSyntacticSequencer.java
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntheticTokenSyntacticSequencer.java b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntheticTokenSyntacticSequencer.java
deleted file mode 100644
index af761a86..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntheticTokenSyntacticSequencer.java
+++ /dev/null
@@ -1,24 +0,0 @@
1package org.eclipse.viatra.solver.language.serializer;
2
3import org.eclipse.emf.ecore.EObject;
4import org.eclipse.viatra.solver.language.serializer.SolverLanguageSyntacticSequencer;
5import org.eclipse.xtext.RuleCall;
6import org.eclipse.xtext.nodemodel.INode;
7
8@SuppressWarnings("all")
9public class SolverLanguageSyntheticTokenSyntacticSequencer extends SolverLanguageSyntacticSequencer {
10 @Override
11 protected String getTRANSITIVE_CLOSUREToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
12 return "+";
13 }
14
15 @Override
16 protected String getREFLEXIVE_TRANSITIVE_CLOSUREToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
17 return "*";
18 }
19
20 @Override
21 protected String getFULL_STOPToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
22 return ".";
23 }
24}
diff --git a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore b/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore
deleted file mode 100644
index 565d4b27..00000000
--- a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.SolverLanguageValidator.java._trace
2/.SolverLanguageValidator.xtendbin
3/SolverLanguageValidator.java
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/.gitignore b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/.gitignore
new file mode 100644
index 00000000..ae3c1726
--- /dev/null
+++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.dse/.gitignore
@@ -0,0 +1 @@
/bin/
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.model/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.familyTree.model/.gitignore
new file mode 100644
index 00000000..65776c32
--- /dev/null
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.model/.gitignore
@@ -0,0 +1 @@
/bin/ \ No newline at end of file
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/.gitignore
new file mode 100644
index 00000000..5f222777
--- /dev/null
+++ b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/.gitignore
@@ -0,0 +1,3 @@
1/src-gen/
2/bin/
3/outputs/
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 7050a7e3..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1/queries/
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
deleted file mode 100644
index b000501e..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._trace
+++ /dev/null
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
deleted file mode 100644
index aaf4d0c2..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.MemberIsItsOwnParent.java._trace
+++ /dev/null
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
deleted file mode 100644
index 19bc3cc8..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
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
9/.NegativeAge.java._trace
10/MemberHasParent.java
11/NegativeAge.java
12/ParentTooYoung.java
13/TwoMembersHaveNoParent.java
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/familyTreeConstraints.vql b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/familyTreeConstraints.vql
deleted file mode 100644
index fdbac640..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/familyTreeConstraints.vql
+++ /dev/null
@@ -1,41 +0,0 @@
1package queries
2
3import "http://www.example.org/familytree"
4
5@Constraint(message="memberIsItsOwnParent", severity="error", key={m})
6pattern memberIsItsOwnParent(m: Member) = {
7 FamilyTree.members(_, m);
8 Member.parents(m, p);
9 m == p;
10}
11
12@Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2})
13pattern twoMembersHaveNoParent(m1:Member, m2:Member) = {
14 neg find memberHasParent(m1);
15 neg find memberHasParent(m2);
16 m1 != m2;
17}
18
19pattern memberHasParent(m: Member) = {
20 Member.parents(m, _);
21}
22
23@Constraint(message="negativeAge", severity="error",key={m})
24pattern negativeAge(m: Member) {
25 Member.age(m,mage);
26 check(mage<0);
27}
28
29@Constraint(message="parentTooYoung", severity="error", key={c, p})
30pattern parentTooYoung(c: Member, p: Member) = {
31 FamilyTree.members(_, c);
32 Member.parents(c, p);
33 Member.age(c, cAge);
34 Member.age(p, pAge);
35 check (pAge <= (cAge + 12));
36}
37
38
39
40
41
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
deleted file mode 100644
index 87a7ed57..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/errors.txt
+++ /dev/null
@@ -1,22 +0,0 @@
1Error occured (IllegalArgumentException): TypeConstraint applicable for enumerable input keys only; received instead org.eclipse.viatra.query.patternlanguage.emf.types.BottomTypeKey@3ba3f40d
2 org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint.<init>(TypeConstraint.java:42)
3 org.eclipse.viatra.query.patternlanguage.emf.specification.internal.EPMToPBody.acceptTypeConstraint(EPMToPBody.java:115)
4 org.eclipse.viatra.query.patternlanguage.emf.specification.internal.PatternBodyTransformer.preprocessParameters(PatternBodyTransformer.java:168)
5 org.eclipse.viatra.query.patternlanguage.emf.specification.internal.PatternBodyTransformer.transform(PatternBodyTransformer.java:123)
6 org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.getBodies(SpecificationBuilder.java:300)
7 org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.buildBodies(SpecificationBuilder.java:286)
8 org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.buildSpecification(SpecificationBuilder.java:197)
9 org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.lambda$4(SpecificationBuilder.java:157)
10 java.util.Optional.orElseGet(Optional.java:267)
11 org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.getOrCreateSpecification(SpecificationBuilder.java:157)
12 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.util.ParseUtil.createSpecification(ParseUtil.java:114)
13 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.util.ParseUtil.parse(ParseUtil.java:101)
14 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternProvider.generateQueries(PatternProvider.java:66)
15 hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethodProvider.createModelGenerationMethod(ModelGenerationMethodProvider.java:57)
16 hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner.solve(ViatraReasoner.java:97)
17 hu.bme.mit.inf.dslreasoner.application.execution.GenerationTaskExecutor.executeGenerationTask(GenerationTaskExecutor.java:316)
18 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor._execute(ScriptExecutor.java:129)
19 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.execute(ScriptExecutor.java:338)
20 hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.executeScript(ScriptExecutor.java:110)
21 hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor.executeScript(StandaloneScriptExecutor.java:149)
22 run.FamilyTreeGen.main(FamilyTreeGen.java:7)
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated
deleted file mode 100644
index 315a1e15..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated
+++ /dev/null
@@ -1,792 +0,0 @@
1import epackage "http://www.bme.hu/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage"
2import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/problem"
3import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/language"
4
5//////////
6// 0. Util
7//////////
8private pattern interpretation(problem:LogicProblem, interpretation:PartialInterpretation) {
9 PartialInterpretation.problem(interpretation,problem);
10}
11
12/////////////////////////
13// 0.1 Existence
14/////////////////////////
15/** [[exist(element)]]=1 */
16private pattern mustExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) {
17 find interpretation(problem,interpretation);
18 LogicProblem.elements(problem,element);
19} or {
20 find interpretation(problem,interpretation);
21 PartialInterpretation.newElements(interpretation,element);
22}
23
24/** [[exist(element)]]>=1/2 */
25private pattern mayExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) {
26 find mustExist(problem,interpretation,element);
27} or {
28 find interpretation(problem,interpretation);
29 neg find elementCloseWorld(element);
30 PartialInterpretation.openWorldElements(interpretation,element);
31}
32
33private pattern elementCloseWorld(element:DefinedElement) {
34 PartialInterpretation.openWorldElements(i,element);
35 PartialInterpretation.maxNewElements(i,0);
36} or {
37 Scope.targetTypeInterpretation(scope,interpretation);
38 PartialTypeInterpratation.elements(interpretation,element);
39 Scope.maxNewElements(scope,0);
40}
41
42////////////////////////
43// 0.2 Equivalence
44////////////////////////
45pattern mayEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement)
46// For non-primitive type. Boolean types always must equivalent or cannot equivalent
47{
48 find mayExist(problem,interpretation,a);
49 find mayExist(problem,interpretation,b);
50 a == b;
51} or {
52 find mayExist(problem,interpretation,a);
53 find mayExist(problem,interpretation,b);
54 IntegerElement(a);
55 IntegerElement(b);
56 PrimitiveElement.valueSet(a,false);
57} or {
58 find mayExist(problem,interpretation,a);
59 find mayExist(problem,interpretation,b);
60 IntegerElement(a);
61 IntegerElement(b);
62 PrimitiveElement.valueSet(b,false);
63} or {
64 find mayExist(problem,interpretation,a);
65 find mayExist(problem,interpretation,b);
66 RealElement(a);
67 RealElement(b);
68 PrimitiveElement.valueSet(a,false);
69} or {
70 find mayExist(problem,interpretation,a);
71 find mayExist(problem,interpretation,b);
72 RealElement(a);
73 RealElement(b);
74 PrimitiveElement.valueSet(b,false);
75} or {
76 find mayExist(problem,interpretation,a);
77 find mayExist(problem,interpretation,b);
78 RealElement(a);
79 IntegerElement(b);
80 PrimitiveElement.valueSet(a,false);
81} or {
82 find mayExist(problem,interpretation,a);
83 find mayExist(problem,interpretation,b);
84 RealElement(a);
85 IntegerElement(b);
86 PrimitiveElement.valueSet(b,false);
87} or {
88 find mayExist(problem,interpretation,a);
89 find mayExist(problem,interpretation,b);
90 IntegerElement(a);
91 RealElement(b);
92 PrimitiveElement.valueSet(a,false);
93} or {
94 find mayExist(problem,interpretation,a);
95 find mayExist(problem,interpretation,b);
96 IntegerElement(a);
97 RealElement(b);
98 PrimitiveElement.valueSet(b,false);
99} or {
100 find mayExist(problem,interpretation,a);
101 find mayExist(problem,interpretation,b);
102 StringElement(a);
103 StringElement(b);
104 PrimitiveElement.valueSet(a,false);
105} or {
106 find mayExist(problem,interpretation,a);
107 find mayExist(problem,interpretation,b);
108 StringElement(a);
109 StringElement(b);
110 PrimitiveElement.valueSet(b,false);
111}
112
113pattern mustEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) {
114// For non-primitive and Boolean primitive type
115 find mustExist(problem,interpretation,a);
116 find mustExist(problem,interpretation,b);
117 a == b;
118} or {
119 find mustExist(problem,interpretation,a);
120 find mustExist(problem,interpretation,b);
121 PrimitiveElement.valueSet(a,true);
122 PrimitiveElement.valueSet(b,true);
123 IntegerElement.value(a,value);
124 IntegerElement.value(b,value);
125} or {
126 find mustExist(problem,interpretation,a);
127 find mustExist(problem,interpretation,b);
128 PrimitiveElement.valueSet(a,true);
129 PrimitiveElement.valueSet(b,true);
130 RealElement.value(a,value);
131 RealElement.value(b,value);
132} or {
133 find mustExist(problem,interpretation,a);
134 find mustExist(problem,interpretation,b);
135 PrimitiveElement.valueSet(a,true);
136 PrimitiveElement.valueSet(b,true);
137 RealElement.value(a,value);
138 IntegerElement.value(b,value);
139} or {
140 find mustExist(problem,interpretation,a);
141 find mustExist(problem,interpretation,b);
142 PrimitiveElement.valueSet(a,true);
143 PrimitiveElement.valueSet(b,true);
144 IntegerElement.value(a,value);
145 RealElement.value(b,value);
146} or {
147 find mustExist(problem,interpretation,a);
148 find mustExist(problem,interpretation,b);
149 PrimitiveElement.valueSet(a,true);
150 PrimitiveElement.valueSet(b,true);
151 StringElement.value(a,value);
152 StringElement.value(b,value);
153}
154
155//////////
156// 1. Problem-Specific Base Indexers
157//////////
158// 1.1 Type Indexers
159//////////
160// 1.1.1 Required Patterns by TypeIndexer
161//////////
162private pattern typeInterpretation(problem:LogicProblem, interpretation:PartialInterpretation, type:TypeDeclaration, typeInterpretation:PartialComplexTypeInterpretation) {
163 find interpretation(problem,interpretation);
164 LogicProblem.types(problem,type);
165 PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation);
166 PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type);
167}
168
169private pattern directInstanceOf(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement, type:Type) {
170 find interpretation(problem,interpretation);
171 LogicProblem.types(problem,type);
172 TypeDefinition.elements(type,element);
173} or {
174 find interpretation(problem,interpretation);
175 find typeInterpretation(problem,interpretation,type,typeInterpretation);
176 PartialComplexTypeInterpretation.elements(typeInterpretation,element);
177}
178
179private pattern isPrimitive(element: PrimitiveElement) {
180 PrimitiveElement(element);
181}
182//////////
183// 1.1.2 primitive Type Indexers
184//////////
185// Currently unused. Refer primitive types as:
186// > PrimitiveElement(element)
187// specific types are referred as:
188// > BooleanElement(variableName)
189// > IntegerElement(variableName)
190// > RealElement(variableName)
191// > StringElement(variableName)
192// And their value as
193// > BooleanElement.value(variableName,value)
194// > IntegerElement.value(variableName,value)
195// > RealElement.value(variableName,value)
196// > StringElement.value(variableName,value)
197// Whether a value is set is defined by:
198// > PrimitiveElement.valueSet(variableName,isFilled);
199//////////
200// 1.1.3 domain-specific Type Indexers
201//////////
202/**
203 * An element must be an instance of type "FamilyTree class".
204 */
205private pattern mustInstanceOfFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) {
206 Type.name(type,"FamilyTree class");
207 find directInstanceOf(problem,interpretation,element,type);
208}
209private pattern scopeDisallowsNewFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation) {
210 find interpretation(problem,interpretation);
211 PartialInterpretation.scopes(interpretation,scope);
212 Scope.targetTypeInterpretation(scope,typeInterpretation);
213 Scope.maxNewElements(scope,0);
214 PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type);
215 Type.name(type,"FamilyTree class");
216}
217
218/**
219 * An element may be an instance of type "FamilyTree class".
220 */
221private pattern mayInstanceOfFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement)
222{
223 find interpretation(problem,interpretation);
224 PartialInterpretation.newElements(interpretation,element);
225 neg find mustInstanceOfMember_class(problem,interpretation,element);
226 neg find scopeDisallowsNewFamilyTree_class(problem, interpretation);
227 neg find isPrimitive(element);
228} or {
229 find interpretation(problem,interpretation);
230 PartialInterpretation.openWorldElements(interpretation,element);
231 neg find mustInstanceOfMember_class(problem,interpretation,element);
232 neg find scopeDisallowsNewFamilyTree_class(problem, interpretation);
233 neg find isPrimitive(element);
234} or
235{ find mustInstanceOfFamilyTree_class(problem,interpretation,element); }
236/**
237 * An element must be an instance of type "Member class".
238 */
239private pattern mustInstanceOfMember_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) {
240 Type.name(type,"Member class");
241 find directInstanceOf(problem,interpretation,element,type);
242}
243private pattern scopeDisallowsNewMember_class(problem:LogicProblem, interpretation:PartialInterpretation) {
244 find interpretation(problem,interpretation);
245 PartialInterpretation.scopes(interpretation,scope);
246 Scope.targetTypeInterpretation(scope,typeInterpretation);
247 Scope.maxNewElements(scope,0);
248 PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type);
249 Type.name(type,"Member class");
250}
251
252/**
253 * An element may be an instance of type "Member class".
254 */
255private pattern mayInstanceOfMember_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement)
256{
257 find interpretation(problem,interpretation);
258 PartialInterpretation.newElements(interpretation,element);
259 neg find mustInstanceOfFamilyTree_class(problem,interpretation,element);
260 neg find scopeDisallowsNewMember_class(problem, interpretation);
261 neg find isPrimitive(element);
262} or {
263 find interpretation(problem,interpretation);
264 PartialInterpretation.openWorldElements(interpretation,element);
265 neg find mustInstanceOfFamilyTree_class(problem,interpretation,element);
266 neg find scopeDisallowsNewMember_class(problem, interpretation);
267 neg find isPrimitive(element);
268} or
269{ find mustInstanceOfMember_class(problem,interpretation,element); }
270
271//////////
272// 1.2 Relation Declaration Indexers
273//////////
274/**
275 * Matcher for detecting tuples t where []members reference FamilyTree(source,target)
276 */
277private pattern mustInRelationmembers_reference_FamilyTree(
278 problem:LogicProblem, interpretation:PartialInterpretation,
279 source: DefinedElement, target:DefinedElement)
280{
281 find interpretation(problem,interpretation);
282 PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
283 PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"members reference FamilyTree");
284 PartialRelationInterpretation.relationlinks(relationIterpretation,link);
285 BinaryElementRelationLink.param1(link,source);
286 BinaryElementRelationLink.param2(link,target);
287}
288/**
289 * Matcher for detecting tuples t where <>members reference FamilyTree(source,target)
290 */
291private pattern mayInRelationmembers_reference_FamilyTree(
292 problem:LogicProblem, interpretation:PartialInterpretation,
293 source: DefinedElement, target:DefinedElement)
294{
295 find interpretation(problem,interpretation);
296 // The two endpoint of the link have to exist
297 find mayExist(problem, interpretation, source);
298 find mayExist(problem, interpretation, target);
299 // Type consistency
300 find mayInstanceOfFamilyTree_class(problem,interpretation,source);
301 find mayInstanceOfMember_class(problem,interpretation,target);
302 // The reference is containment, then a new reference cannot be create if:
303 // 1. Multiple parents
304 neg find mustContains4(problem,interpretation,_,target);
305 // 2. Circle in the containment hierarchy
306 neg find mustTransitiveContains(source,target);
307} or {
308 find mustInRelationmembers_reference_FamilyTree(problem,interpretation,source,target);
309}
310/**
311 * Matcher for detecting tuples t where []children reference Member(source,target)
312 */
313private pattern mustInRelationchildren_reference_Member(
314 problem:LogicProblem, interpretation:PartialInterpretation,
315 source: DefinedElement, target:DefinedElement)
316{
317 find interpretation(problem,interpretation);
318 PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
319 PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"children reference Member");
320 PartialRelationInterpretation.relationlinks(relationIterpretation,link);
321 BinaryElementRelationLink.param1(link,source);
322 BinaryElementRelationLink.param2(link,target);
323}
324/**
325 * Matcher for detecting tuples t where <>children reference Member(source,target)
326 */
327private pattern mayInRelationchildren_reference_Member(
328 problem:LogicProblem, interpretation:PartialInterpretation,
329 source: DefinedElement, target:DefinedElement)
330{
331 find interpretation(problem,interpretation);
332 // The two endpoint of the link have to exist
333 find mayExist(problem, interpretation, source);
334 find mayExist(problem, interpretation, target);
335 // Type consistency
336 find mayInstanceOfMember_class(problem,interpretation,source);
337 find mayInstanceOfMember_class(problem,interpretation,target);
338 // There are "numberOfExistingReferences" currently existing instances of the reference to the target,
339 // the upper bound of the opposite reference multiplicity should be considered.
340 numberOfExistingOppositeReferences == count find mustInRelationparents_reference_Member(problem,interpretation,target,_);
341 check(numberOfExistingOppositeReferences < 2);
342} or {
343 find mustInRelationchildren_reference_Member(problem,interpretation,source,target);
344}
345/**
346 * Matcher for detecting tuples t where []parents reference Member(source,target)
347 */
348private pattern mustInRelationparents_reference_Member(
349 problem:LogicProblem, interpretation:PartialInterpretation,
350 source: DefinedElement, target:DefinedElement)
351{
352 find interpretation(problem,interpretation);
353 PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
354 PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"parents reference Member");
355 PartialRelationInterpretation.relationlinks(relationIterpretation,link);
356 BinaryElementRelationLink.param1(link,source);
357 BinaryElementRelationLink.param2(link,target);
358}
359/**
360 * Matcher for detecting tuples t where <>parents reference Member(source,target)
361 */
362private pattern mayInRelationparents_reference_Member(
363 problem:LogicProblem, interpretation:PartialInterpretation,
364 source: DefinedElement, target:DefinedElement)
365{
366 find interpretation(problem,interpretation);
367 // The two endpoint of the link have to exist
368 find mayExist(problem, interpretation, source);
369 find mayExist(problem, interpretation, target);
370 // Type consistency
371 find mayInstanceOfMember_class(problem,interpretation,source);
372 find mayInstanceOfMember_class(problem,interpretation,target);
373 // There are "numberOfExistingReferences" currently existing instances of the reference from the source,
374 // the upper bound of the multiplicity should be considered.
375 numberOfExistingReferences == count find mustInRelationparents_reference_Member(problem,interpretation,source,_);
376 check(numberOfExistingReferences < 2);
377} or {
378 find mustInRelationparents_reference_Member(problem,interpretation,source,target);
379}
380/**
381 * Matcher for detecting tuples t where []name attribute Member(source,target)
382 */
383private pattern mustInRelationname_attribute_Member(
384 problem:LogicProblem, interpretation:PartialInterpretation,
385 source: DefinedElement, target:DefinedElement)
386{
387 find interpretation(problem,interpretation);
388 PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
389 PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"name attribute Member");
390 PartialRelationInterpretation.relationlinks(relationIterpretation,link);
391 BinaryElementRelationLink.param1(link,source);
392 BinaryElementRelationLink.param2(link,target);
393}
394/**
395 * Matcher for detecting tuples t where <>name attribute Member(source,target)
396 */
397private pattern mayInRelationname_attribute_Member(
398 problem:LogicProblem, interpretation:PartialInterpretation,
399 source: DefinedElement, target:DefinedElement)
400{
401 find interpretation(problem,interpretation);
402 // The two endpoint of the link have to exist
403 find mayExist(problem, interpretation, source);
404 find mayExist(problem, interpretation, target);
405 // Type consistency
406 find mayInstanceOfMember_class(problem,interpretation,source);
407 StringElement(target);
408 // There are "numberOfExistingReferences" currently existing instances of the reference from the source,
409 // the upper bound of the multiplicity should be considered.
410 numberOfExistingReferences == count find mustInRelationname_attribute_Member(problem,interpretation,source,_);
411 check(numberOfExistingReferences < 1);
412} or {
413 find mustInRelationname_attribute_Member(problem,interpretation,source,target);
414}
415/**
416 * Matcher for detecting tuples t where []age attribute Member(source,target)
417 */
418private pattern mustInRelationage_attribute_Member(
419 problem:LogicProblem, interpretation:PartialInterpretation,
420 source: DefinedElement, target:DefinedElement)
421{
422 find interpretation(problem,interpretation);
423 PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
424 PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"age attribute Member");
425 PartialRelationInterpretation.relationlinks(relationIterpretation,link);
426 BinaryElementRelationLink.param1(link,source);
427 BinaryElementRelationLink.param2(link,target);
428}
429/**
430 * Matcher for detecting tuples t where <>age attribute Member(source,target)
431 */
432private pattern mayInRelationage_attribute_Member(
433 problem:LogicProblem, interpretation:PartialInterpretation,
434 source: DefinedElement, target:DefinedElement)
435{
436 find interpretation(problem,interpretation);
437 // The two endpoint of the link have to exist
438 find mayExist(problem, interpretation, source);
439 find mayExist(problem, interpretation, target);
440 // Type consistency
441 find mayInstanceOfMember_class(problem,interpretation,source);
442 IntegerElement(target);
443 // There are "numberOfExistingReferences" currently existing instances of the reference from the source,
444 // the upper bound of the multiplicity should be considered.
445 numberOfExistingReferences == count find mustInRelationage_attribute_Member(problem,interpretation,source,_);
446 check(numberOfExistingReferences < 1);
447} or {
448 find mustInRelationage_attribute_Member(problem,interpretation,source,target);
449}
450
451//////////
452// 1.3 Relation Definition Indexers
453//////////
454// Must, May and Current queries for pattern queries memberIsItsOwnParent
455private pattern mustInRelation_pattern_queries_memberIsItsOwnParent(
456 problem:LogicProblem, interpretation:PartialInterpretation,
457 var_m)
458{
459 find interpretation(problem,interpretation);
460 var_m == var_p;
461 find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p);
462 find mustInRelationparents_reference_Member(problem,interpretation,var_p,var_p);
463}
464private pattern mayInRelation_pattern_queries_memberIsItsOwnParent(
465 problem:LogicProblem, interpretation:PartialInterpretation,
466 var_m)
467{
468 find interpretation(problem,interpretation);
469 var_m == var_p;
470 find mayInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p);
471 find mayInRelationparents_reference_Member(problem,interpretation,var_p,var_p);
472}
473private pattern currentInRelation_pattern_queries_memberIsItsOwnParent(
474 problem:LogicProblem, interpretation:PartialInterpretation,
475 var_m)
476{
477 find interpretation(problem,interpretation);
478 var_m == var_p;
479 find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p);
480 find mustInRelationparents_reference_Member(problem,interpretation,var_p,var_p);
481}
482// Must, May and Current queries for pattern queries twoMembersHaveNoParent
483private pattern mustInRelation_pattern_queries_twoMembersHaveNoParent(
484 problem:LogicProblem, interpretation:PartialInterpretation,
485 var_m1, var_m2)
486{
487 find interpretation(problem,interpretation);
488 // var_m1 exported
489 // var_m2 exported
490 find mustInstanceOfMember_class(problem,interpretation,var_m1);
491 find mustInstanceOfMember_class(problem,interpretation,var_m2);
492 neg find mayInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1);
493 neg find mayInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2);
494 neg find mayEquivalent(problem, interpretation, var_m1, var_m2);
495}
496private pattern mayInRelation_pattern_queries_twoMembersHaveNoParent(
497 problem:LogicProblem, interpretation:PartialInterpretation,
498 var_m1, var_m2)
499{
500 find interpretation(problem,interpretation);
501 // var_m1 exported
502 // var_m2 exported
503 find mayInstanceOfMember_class(problem,interpretation,var_m1);
504 find mayInstanceOfMember_class(problem,interpretation,var_m2);
505 neg find mustInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1);
506 neg find mustInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2);
507 neg find mustEquivalent(problem, interpretation, var_m1, var_m2);
508}
509private pattern currentInRelation_pattern_queries_twoMembersHaveNoParent(
510 problem:LogicProblem, interpretation:PartialInterpretation,
511 var_m1, var_m2)
512{
513 find interpretation(problem,interpretation);
514 // var_m1 exported
515 // var_m2 exported
516 find mustInstanceOfMember_class(problem,interpretation,var_m1);
517 find mustInstanceOfMember_class(problem,interpretation,var_m2);
518 neg find currentInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1);
519 neg find currentInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2);
520 neg find mustEquivalent(problem, interpretation, var_m1, var_m2);
521}
522// Must, May and Current queries for pattern queries memberHasParent
523private pattern mustInRelation_pattern_queries_memberHasParent(
524 problem:LogicProblem, interpretation:PartialInterpretation,
525 var_m)
526{
527 find interpretation(problem,interpretation);
528 // var_m exported
529 find mustInRelationparents_reference_Member(problem,interpretation,var_m,var__0);
530 find mustInstanceOfMember_class(problem,interpretation,var__0);
531}
532private pattern mayInRelation_pattern_queries_memberHasParent(
533 problem:LogicProblem, interpretation:PartialInterpretation,
534 var_m)
535{
536 find interpretation(problem,interpretation);
537 // var_m exported
538 find mayInRelationparents_reference_Member(problem,interpretation,var_m,var__0);
539 find mayInstanceOfMember_class(problem,interpretation,var__0);
540}
541private pattern currentInRelation_pattern_queries_memberHasParent(
542 problem:LogicProblem, interpretation:PartialInterpretation,
543 var_m)
544{
545 find interpretation(problem,interpretation);
546 // var_m exported
547 find mustInRelationparents_reference_Member(problem,interpretation,var_m,var__0);
548 find mustInstanceOfMember_class(problem,interpretation,var__0);
549}
550// Must, May and Current queries for pattern queries parentTooYoung
551private pattern mustInRelation_pattern_queries_parentTooYoung(
552 problem:LogicProblem, interpretation:PartialInterpretation,
553 var_m, var_p)
554{
555 find interpretation(problem,interpretation);
556 // var_m exported
557 // var_p exported
558 find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m);
559 find mustInRelationparents_reference_Member(problem,interpretation,var_m,var_p);
560 find mustInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge);
561 find mustInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge);
562 PrimitiveElement.valueSet(var_mAge,true); IntegerElement.value(var_mAge,value_var_mAge);
563 PrimitiveElement.valueSet(var_pAge,true); IntegerElement.value(var_pAge,value_var_pAge);
564 check((value_var_mAge<=(value_var_pAge+12)));
565}
566private pattern mayInRelation_pattern_queries_parentTooYoung(
567 problem:LogicProblem, interpretation:PartialInterpretation,
568 var_m, var_p)
569{
570 find interpretation(problem,interpretation);
571 // var_m exported
572 // var_p exported
573 find mayInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m);
574 find mayInRelationparents_reference_Member(problem,interpretation,var_m,var_p);
575 find mayInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge);
576 find mayInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge);
577 PrimitiveElement.valueSet(var_mAge,setted_var_mAge); IntegerElement.value(var_mAge,value_var_mAge);
578 PrimitiveElement.valueSet(var_pAge,setted_var_pAge); IntegerElement.value(var_pAge,value_var_pAge);
579 check(
580 !setted_var_mAge || !setted_var_pAge
581 ||
582 ((value_var_mAge<=(value_var_pAge+12)))
583 );
584}
585private pattern currentInRelation_pattern_queries_parentTooYoung(
586 problem:LogicProblem, interpretation:PartialInterpretation,
587 var_m, var_p)
588{
589 find interpretation(problem,interpretation);
590 // var_m exported
591 // var_p exported
592 find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m);
593 find mustInRelationparents_reference_Member(problem,interpretation,var_m,var_p);
594 find mustInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge);
595 find mustInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge);
596 PrimitiveElement.valueSet(var_mAge,true); IntegerElement.value(var_mAge,value_var_mAge);
597 PrimitiveElement.valueSet(var_pAge,true); IntegerElement.value(var_pAge,value_var_pAge);
598 check((value_var_mAge<=(value_var_pAge+12)));
599}
600
601//////////
602// 1.4 Containment Indexer
603//////////
604private pattern mustContains2(source: DefinedElement, target: DefinedElement) {
605 find mustContains4(_,_,source,target);
606}
607
608private pattern mustContains4(problem:LogicProblem, interpretation:PartialInterpretation,
609 source: DefinedElement, target: DefinedElement)
610 { find mustInRelationmembers_reference_FamilyTree(problem,interpretation,source,target); }
611
612private pattern mustTransitiveContains(source,target) {
613 find mustContains2+(source,target);
614}
615
616//////////
617// 2. Invalidation Indexers
618//////////
619// 2.1 Invalidated by WF Queries
620//////////
621pattern invalidatedBy_pattern_queries_memberIsItsOwnParent(problem:LogicProblem, interpretation:PartialInterpretation,
622 var_m)
623{
624 find mustInRelation_pattern_queries_memberIsItsOwnParent(problem,interpretation,var_m);
625}
626pattern invalidatedBy_pattern_queries_twoMembersHaveNoParent(problem:LogicProblem, interpretation:PartialInterpretation,
627 var_m1, var_m2)
628{
629 find mustInRelation_pattern_queries_twoMembersHaveNoParent(problem,interpretation,var_m1,var_m2);
630}
631pattern invalidatedBy_pattern_queries_parentTooYoung(problem:LogicProblem, interpretation:PartialInterpretation,
632 var_m, var_p)
633{
634 find mustInRelation_pattern_queries_parentTooYoung(problem,interpretation,var_m,var_p);
635}
636
637//////////
638// 3. Unfinishedness Indexers
639//////////
640// 3.1 Unfinishedness Measured by Multiplicity
641//////////
642
643//////////
644// 3.2 Unfinishedness Measured by WF Queries
645//////////
646pattern unfinishedBy_pattern_queries_memberIsItsOwnParent(problem:LogicProblem, interpretation:PartialInterpretation,
647 var_m)
648{
649 find currentInRelation_pattern_queries_memberIsItsOwnParent(problem,interpretation,var_m);
650}
651pattern unfinishedBy_pattern_queries_twoMembersHaveNoParent(problem:LogicProblem, interpretation:PartialInterpretation,
652 var_m1, var_m2)
653{
654 find currentInRelation_pattern_queries_twoMembersHaveNoParent(problem,interpretation,var_m1,var_m2);
655}
656pattern unfinishedBy_pattern_queries_parentTooYoung(problem:LogicProblem, interpretation:PartialInterpretation,
657 var_m, var_p)
658{
659 find currentInRelation_pattern_queries_parentTooYoung(problem,interpretation,var_m,var_p);
660}
661
662//////////
663// 4. Refinement Indexers
664//////////
665// 4.1 Object constructors
666//////////
667private pattern hasElementInContainment(problem:LogicProblem, interpretation:PartialInterpretation)
668{
669 find interpretation(problem,interpretation);
670 find mustInstanceOfFamilyTree_class(problem,interpretation,root);
671 find mustExist(problem, interpretation, root);
672}or{
673 find interpretation(problem,interpretation);
674 find mustInstanceOfMember_class(problem,interpretation,root);
675 find mustExist(problem, interpretation, root);
676}
677pattern createObject_Member_class_by_members_reference_FamilyTree(
678 problem:LogicProblem, interpretation:PartialInterpretation,
679 relationInterpretation:PartialRelationInterpretation, typeInterpretation:PartialComplexTypeInterpretation,
680 container:DefinedElement)
681{
682 find interpretation(problem,interpretation);
683 PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation);
684 PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"Member class");
685 PartialInterpretation.partialrelationinterpretation(interpretation,relationInterpretation);
686 PartialRelationInterpretation.interpretationOf.name(relationInterpretation,"members reference FamilyTree");
687 find mustInstanceOfFamilyTree_class(problem,interpretation,container);
688 find mayInstanceOfMember_class(problem,interpretation,newObject);
689 find mayInRelationmembers_reference_FamilyTree(problem,interpretation,container,newObject);
690 find mustExist(problem, interpretation, container);
691 neg find mustExist(problem, interpretation, newObject);
692}
693pattern createObject_Member_class(
694 problem:LogicProblem, interpretation:PartialInterpretation,
695 typeInterpretation:PartialComplexTypeInterpretation)
696{
697 find interpretation(problem,interpretation);
698 neg find hasElementInContainment(problem,interpretation);
699 PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation);
700 PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"Member class");
701 find mayInstanceOfMember_class(problem,interpretation,newObject);
702 find mayExist(problem, interpretation, newObject);
703 neg find mustExist(problem, interpretation, newObject);
704}
705pattern createObject_FamilyTree_class(
706 problem:LogicProblem, interpretation:PartialInterpretation,
707 typeInterpretation:PartialComplexTypeInterpretation)
708{
709 find interpretation(problem,interpretation);
710 neg find hasElementInContainment(problem,interpretation);
711 PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation);
712 PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"FamilyTree class");
713 find mayInstanceOfFamilyTree_class(problem,interpretation,newObject);
714 find mayExist(problem, interpretation, newObject);
715 neg find mustExist(problem, interpretation, newObject);
716}
717
718//////////
719// 4.2 Type refinement
720//////////
721pattern refineTypeTo_Member_class(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) {
722 find interpretation(problem,interpretation);
723 PartialInterpretation.newElements(interpretation,element);
724 find mayInstanceOfMember_class(problem,interpretation,element);
725 neg find mustInstanceOfMember_class(problem,interpretation,element);
726 neg find mustInstanceOfFamilyTree_class(problem,interpretation,element);
727}
728pattern refineTypeTo_FamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) {
729 find interpretation(problem,interpretation);
730 PartialInterpretation.newElements(interpretation,element);
731 find mayInstanceOfFamilyTree_class(problem,interpretation,element);
732 neg find mustInstanceOfMember_class(problem,interpretation,element);
733 neg find mustInstanceOfFamilyTree_class(problem,interpretation,element);
734}
735
736//////////
737// 4.3 Relation refinement
738//////////
739pattern refineRelation_children_reference_Member_and_parents_reference_Member(
740 problem:LogicProblem, interpretation:PartialInterpretation,
741 relationIterpretation:PartialRelationInterpretation, oppositeInterpretation:PartialRelationInterpretation,
742 from: DefinedElement, to: DefinedElement)
743{
744 find interpretation(problem,interpretation);
745 PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
746 PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"children reference Member");
747 PartialInterpretation.partialrelationinterpretation(interpretation,oppositeInterpretation);
748 PartialRelationInterpretation.interpretationOf.name(oppositeInterpretation,"parents reference Member");
749 find mustExist(problem, interpretation, from);
750 find mustExist(problem, interpretation, to);
751 find mustInstanceOfMember_class(problem,interpretation,from);
752 find mustInstanceOfMember_class(problem,interpretation,to);
753 find mayInRelationchildren_reference_Member(problem,interpretation,from,to);
754 neg find mustInRelationchildren_reference_Member(problem,interpretation,from,to);
755}
756pattern refineRelation_name_attribute_Member(
757 problem:LogicProblem, interpretation:PartialInterpretation,
758 relationIterpretation:PartialRelationInterpretation,
759 from: DefinedElement, to: DefinedElement)
760{
761 find interpretation(problem,interpretation);
762 PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
763 PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"name attribute Member");
764 find mustExist(problem, interpretation, from);
765 find mustExist(problem, interpretation, to);
766 find mustInstanceOfMember_class(problem,interpretation,from);
767 StringElement(to);
768 find mayInRelationname_attribute_Member(problem,interpretation,from,to);
769 neg find mustInRelationname_attribute_Member(problem,interpretation,from,to);
770}
771pattern refineRelation_age_attribute_Member(
772 problem:LogicProblem, interpretation:PartialInterpretation,
773 relationIterpretation:PartialRelationInterpretation,
774 from: DefinedElement, to: DefinedElement)
775{
776 find interpretation(problem,interpretation);
777 PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
778 PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"age attribute Member");
779 find mustExist(problem, interpretation, from);
780 find mustExist(problem, interpretation, to);
781 find mustInstanceOfMember_class(problem,interpretation,from);
782 IntegerElement(to);
783 find mayInRelationage_attribute_Member(problem,interpretation,from,to);
784 neg find mustInRelationage_attribute_Member(problem,interpretation,from,to);
785}
786
787//////////
788// 5 Unit Propagations
789//////////
790
791// Main propagations:
792
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
deleted file mode 100644
index d15360ce..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generation.logicproblem
+++ /dev/null
@@ -1,340 +0,0 @@
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">
3 <types xsi:type="language_1:TypeDeclaration" name="FamilyTree class"/>
4 <types xsi:type="language_1:TypeDeclaration" name="Member class"/>
5 <assertions name="upperMultiplicity parents Member" annotations="//@annotations.0">
6 <value xsi:type="language_1:Forall">
7 <quantifiedVariables name="src">
8 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
9 </quantifiedVariables>
10 <quantifiedVariables name="trg 1">
11 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
12 </quantifiedVariables>
13 <quantifiedVariables name="trg 2">
14 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
15 </quantifiedVariables>
16 <quantifiedVariables name="trg 3">
17 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
18 </quantifiedVariables>
19 <expression xsi:type="language_1:Impl">
20 <leftOperand xsi:type="language_1:And">
21 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
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"/>
24 </operands>
25 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
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"/>
28 </operands>
29 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
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"/>
32 </operands>
33 </leftOperand>
34 <rightOperand xsi:type="language_1:Not">
35 <operand xsi:type="language_1:Distinct">
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"/>
38 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.0/@value/@quantifiedVariables.3"/>
39 </operand>
40 </rightOperand>
41 </expression>
42 </value>
43 </assertions>
44 <assertions name="oppositeReference children Member" annotations="//@annotations.1">
45 <value xsi:type="language_1:Forall">
46 <quantifiedVariables name="src">
47 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
48 </quantifiedVariables>
49 <quantifiedVariables name="trg">
50 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
51 </quantifiedVariables>
52 <expression xsi:type="language_1:Iff">
53 <leftOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.1">
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"/>
56 </leftOperand>
57 <rightOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
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"/>
60 </rightOperand>
61 </expression>
62 </value>
63 </assertions>
64 <assertions name="upperMultiplicity name Member" annotations="//@annotations.2">
65 <value xsi:type="language_1:Forall">
66 <quantifiedVariables name="src">
67 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
68 </quantifiedVariables>
69 <quantifiedVariables name="trg 1">
70 <range xsi:type="language_1:StringTypeReference"/>
71 </quantifiedVariables>
72 <quantifiedVariables name="trg 2">
73 <range xsi:type="language_1:StringTypeReference"/>
74 </quantifiedVariables>
75 <expression xsi:type="language_1:Impl">
76 <leftOperand xsi:type="language_1:And">
77 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.3">
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"/>
80 </operands>
81 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.3">
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"/>
84 </operands>
85 </leftOperand>
86 <rightOperand xsi:type="language_1:Not">
87 <operand xsi:type="language_1:Distinct">
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"/>
90 </operand>
91 </rightOperand>
92 </expression>
93 </value>
94 </assertions>
95 <assertions name="upperMultiplicity age Member" annotations="//@annotations.3">
96 <value xsi:type="language_1:Forall">
97 <quantifiedVariables name="src">
98 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
99 </quantifiedVariables>
100 <quantifiedVariables name="trg 1">
101 <range xsi:type="language_1:IntTypeReference"/>
102 </quantifiedVariables>
103 <quantifiedVariables name="trg 2">
104 <range xsi:type="language_1:IntTypeReference"/>
105 </quantifiedVariables>
106 <expression xsi:type="language_1:Impl">
107 <leftOperand xsi:type="language_1:And">
108 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4">
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"/>
111 </operands>
112 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4">
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"/>
115 </operands>
116 </leftOperand>
117 <rightOperand xsi:type="language_1:Not">
118 <operand xsi:type="language_1:Distinct">
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"/>
121 </operand>
122 </rightOperand>
123 </expression>
124 </value>
125 </assertions>
126 <assertions name="errorpattern queries memberIsItsOwnParent" annotations="//@annotations.8">
127 <value xsi:type="language_1:Forall">
128 <quantifiedVariables name="p0">
129 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
130 </quantifiedVariables>
131 <expression xsi:type="language_1:Not">
132 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5">
133 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@assertions.4/@value/@quantifiedVariables.0"/>
134 </operand>
135 </expression>
136 </value>
137 </assertions>
138 <assertions name="errorpattern queries twoMembersHaveNoParent" annotations="//@annotations.9">
139 <value xsi:type="language_1:Forall">
140 <quantifiedVariables name="p0">
141 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
142 </quantifiedVariables>
143 <quantifiedVariables name="p1">
144 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
145 </quantifiedVariables>
146 <expression xsi:type="language_1:Not">
147 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6">
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"/>
150 </operand>
151 </expression>
152 </value>
153 </assertions>
154 <assertions name="errorpattern queries parentTooYoung" annotations="//@annotations.10">
155 <value xsi:type="language_1:Forall">
156 <quantifiedVariables name="p0">
157 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
158 </quantifiedVariables>
159 <quantifiedVariables name="p1">
160 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
161 </quantifiedVariables>
162 <expression xsi:type="language_1:Not">
163 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8">
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"/>
166 </operand>
167 </expression>
168 </value>
169 </assertions>
170 <relations xsi:type="language_1:RelationDeclaration" name="members reference FamilyTree">
171 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.0"/>
172 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
173 </relations>
174 <relations xsi:type="language_1:RelationDeclaration" name="children reference Member">
175 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
176 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
177 </relations>
178 <relations xsi:type="language_1:RelationDeclaration" name="parents reference Member">
179 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
180 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
181 </relations>
182 <relations xsi:type="language_1:RelationDeclaration" name="name attribute Member">
183 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
184 <parameters xsi:type="language_1:StringTypeReference"/>
185 </relations>
186 <relations xsi:type="language_1:RelationDeclaration" name="age attribute Member">
187 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
188 <parameters xsi:type="language_1:IntTypeReference"/>
189 </relations>
190 <relations xsi:type="language_1:RelationDefinition" name="pattern queries memberIsItsOwnParent" annotations="//@annotations.4">
191 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
192 <variables name="parameter m">
193 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
194 </variables>
195 <value xsi:type="language_1:Or">
196 <operands xsi:type="language_1:Exists">
197 <quantifiedVariables name="variable 0">
198 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.0"/>
199 </quantifiedVariables>
200 <expression xsi:type="language_1:And">
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"/>
203 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.5/@variables.0"/>
204 </operands>
205 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
206 <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>
209 </expression>
210 </operands>
211 </value>
212 </relations>
213 <relations xsi:type="language_1:RelationDefinition" name="pattern queries twoMembersHaveNoParent" annotations="//@annotations.5">
214 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
215 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
216 <variables name="parameter m1">
217 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
218 </variables>
219 <variables name="parameter m2">
220 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
221 </variables>
222 <value xsi:type="language_1:Or">
223 <operands xsi:type="language_1:And">
224 <operands xsi:type="language_1:InstanceOf">
225 <value xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.0"/>
226 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
227 </operands>
228 <operands xsi:type="language_1:InstanceOf">
229 <value xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.1"/>
230 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
231 </operands>
232 <operands xsi:type="language_1:Not">
233 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7">
234 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.0"/>
235 </operand>
236 </operands>
237 <operands xsi:type="language_1:Not">
238 <operand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.7">
239 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.1"/>
240 </operand>
241 </operands>
242 <operands xsi:type="language_1:Distinct">
243 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.0"/>
244 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.6/@variables.1"/>
245 </operands>
246 </operands>
247 </value>
248 </relations>
249 <relations xsi:type="language_1:RelationDefinition" name="pattern queries memberHasParent" annotations="//@annotations.6">
250 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
251 <variables name="parameter m">
252 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
253 </variables>
254 <value xsi:type="language_1:Or">
255 <operands xsi:type="language_1:Exists">
256 <quantifiedVariables name="variable 0">
257 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
258 </quantifiedVariables>
259 <expression xsi:type="language_1:And">
260 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
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"/>
263 </operands>
264 <operands xsi:type="language_1:InstanceOf">
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"/>
267 </operands>
268 </expression>
269 </operands>
270 </value>
271 </relations>
272 <relations xsi:type="language_1:RelationDefinition" name="pattern queries parentTooYoung" annotations="//@annotations.7">
273 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
274 <parameters xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
275 <variables name="parameter m">
276 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
277 </variables>
278 <variables name="parameter p">
279 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.1"/>
280 </variables>
281 <value xsi:type="language_1:Or">
282 <operands xsi:type="language_1:Exists">
283 <quantifiedVariables name="variable 0">
284 <range xsi:type="language_1:ComplexTypeReference" referred="//@types.0"/>
285 </quantifiedVariables>
286 <quantifiedVariables name="variable mAge">
287 <range xsi:type="language_1:IntTypeReference"/>
288 </quantifiedVariables>
289 <quantifiedVariables name="variable pAge">
290 <range xsi:type="language_1:IntTypeReference"/>
291 </quantifiedVariables>
292 <expression xsi:type="language_1:And">
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"/>
295 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.0"/>
296 </operands>
297 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.2">
298 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.0"/>
299 <parameterSubstitutions xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@variables.1"/>
300 </operands>
301 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4">
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"/>
304 </operands>
305 <operands xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.4">
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"/>
308 </operands>
309 <operands xsi:type="language_1:LessOrEqualThan">
310 <leftOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.1"/>
311 <rightOperand xsi:type="language_1:Plus">
312 <leftOperand xsi:type="language_1:SymbolicValue" symbolicReference="//@relations.8/@value/@operands.0/@quantifiedVariables.2"/>
313 <rightOperand xsi:type="language_1:IntLiteral" value="12"/>
314 </rightOperand>
315 </operands>
316 </expression>
317 </operands>
318 </value>
319 </relations>
320 <containmentHierarchies typesOrderedInHierarchy="//@types.0 //@types.1" containmentRelations="//@relations.0"/>
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"/>
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"/>
325 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.5" patternFullyQualifiedName="queries.memberIsItsOwnParent">
326 <variableTrace targetLogicVariable="//@relations.5/@value/@operands.0/@quantifiedVariables.0"/>
327 </annotations>
328 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.6" patternFullyQualifiedName="queries.twoMembersHaveNoParent"/>
329 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.7" patternFullyQualifiedName="queries.memberHasParent">
330 <variableTrace targetLogicVariable="//@relations.7/@value/@operands.0/@quantifiedVariables.0"/>
331 </annotations>
332 <annotations xsi:type="viatra2logicannotations:TransfomedViatraQuery" target="//@relations.8" patternFullyQualifiedName="queries.parentTooYoung">
333 <variableTrace targetLogicVariable="//@relations.8/@value/@operands.0/@quantifiedVariables.0"/>
334 <variableTrace targetLogicVariable="//@relations.8/@value/@operands.0/@quantifiedVariables.1"/>
335 <variableTrace targetLogicVariable="//@relations.8/@value/@operands.0/@quantifiedVariables.2"/>
336 </annotations>
337 <annotations xsi:type="viatra2logicannotations:TransformedViatraWellformednessConstraint" target="//@assertions.4" query="//@annotations.4"/>
338 <annotations xsi:type="viatra2logicannotations:TransformedViatraWellformednessConstraint" target="//@assertions.5" query="//@annotations.5"/>
339 <annotations xsi:type="viatra2logicannotations:TransformedViatraWellformednessConstraint" target="//@assertions.6" query="//@annotations.7"/>
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
deleted file mode 100644
index df908518..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/init.partialmodel
+++ /dev/null
@@ -1,51 +0,0 @@
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">
3 <problem href="outputs/debug/generation.logicproblem#/"/>
4 <partialrelationinterpretation>
5 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.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"/>
8 </partialrelationinterpretation>
9 <partialrelationinterpretation>
10 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.1"/>
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"/>
13 </partialrelationinterpretation>
14 <partialrelationinterpretation>
15 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.2"/>
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"/>
18 </partialrelationinterpretation>
19 <partialrelationinterpretation>
20 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.3"/>
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"/>
23 </partialrelationinterpretation>
24 <partialrelationinterpretation>
25 <interpretationOf href="outputs/debug/generation.logicproblem#//@relations.4"/>
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"/>
28 </partialrelationinterpretation>
29 <newElements xsi:type="partialinterpretation:BooleanElement" name="true" valueSet="true" value="true"/>
30 <newElements xsi:type="partialinterpretation:BooleanElement" name="false" valueSet="true"/>
31 <newElements xsi:type="partialinterpretation:IntegerElement" name="1" valueSet="true" value="1"/>
32 <newElements xsi:type="partialinterpretation:IntegerElement" name="2" valueSet="true" value="2"/>
33 <newElements xsi:type="partialinterpretation:IntegerElement" name="3" valueSet="true" value="3"/>
34 <newElements xsi:type="partialinterpretation:IntegerElement" name="4" valueSet="true" value="4"/>
35 <newElements xsi:type="partialinterpretation:IntegerElement" name="5" valueSet="true" value="5"/>
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"/>
38 <partialtypeinterpratation xsi:type="partialinterpretation:PartialRealInterpretation" elements="//@openWorldElements.0"/>
39 <partialtypeinterpratation xsi:type="partialinterpretation:PartialStringInterpretation" elements="//@openWorldElements.1"/>
40 <partialtypeinterpratation xsi:type="partialinterpretation:PartialComplexTypeInterpretation" scopes="//@scopes.0">
41 <interpretationOf href="outputs/debug/generation.logicproblem#//@types.0"/>
42 </partialtypeinterpratation>
43 <partialtypeinterpratation xsi:type="partialinterpretation:PartialComplexTypeInterpretation" scopes="//@scopes.1">
44 <interpretationOf href="outputs/debug/generation.logicproblem#//@types.1"/>
45 </partialtypeinterpratation>
46 <openWorldElements xsi:type="partialinterpretation:RealElement" name="New Reals"/>
47 <openWorldElements xsi:type="partialinterpretation:StringElement" name="New Strings"/>
48 <openWorldElements name="New Objects"/>
49 <scopes targetTypeInterpretation="//@partialtypeinterpratation.4"/>
50 <scopes targetTypeInterpretation="//@partialtypeinterpratation.5"/>
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
deleted file mode 100644
index 67589bd9..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/log.txt
+++ /dev/null
@@ -1 +0,0 @@
1Model generation finished
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.gml b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.gml
deleted file mode 100644
index a187635b..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.gml
+++ /dev/null
@@ -1,916 +0,0 @@
1graph
2[
3 node
4 [
5 id 0
6 graphics
7 [
8 w 41.800000000000004
9 h 26
10 type "rectangle"
11 fill "#FFFFFF"
12 fill2 "#FFFFFF"
13 outline "#000000"
14 ]
15 LabelGraphics
16 [
17 text "true"
18 outline "#000000"
19 fill "#FFFFFF"
20 fontSize 16
21 fontName "Monospace"
22 autoSizePolicy "node_width"
23 anchor "t"
24 borderDistance 0.0
25 ]
26 LabelGraphics
27 [
28 text "
29 "
30 fontSize 14
31 fontName "Consolas"
32 alignment "left"
33 anchor "tl"
34 borderDistance 6
35 ]
36 ]
37
38 node
39 [
40 id 1
41 graphics
42 [
43 w 50.6
44 h 26
45 type "rectangle"
46 fill "#FFFFFF"
47 fill2 "#FFFFFF"
48 outline "#000000"
49 ]
50 LabelGraphics
51 [
52 text "false"
53 outline "#000000"
54 fill "#FFFFFF"
55 fontSize 16
56 fontName "Monospace"
57 autoSizePolicy "node_width"
58 anchor "t"
59 borderDistance 0.0
60 ]
61 LabelGraphics
62 [
63 text "
64 "
65 fontSize 14
66 fontName "Consolas"
67 alignment "left"
68 anchor "tl"
69 borderDistance 6
70 ]
71 ]
72
73 node
74 [
75 id 2
76 graphics
77 [
78 w 15.400000000000002
79 h 26
80 type "rectangle"
81 fill "#FFFFFF"
82 fill2 "#FFFFFF"
83 outline "#000000"
84 ]
85 LabelGraphics
86 [
87 text "1"
88 outline "#000000"
89 fill "#FFFFFF"
90 fontSize 16
91 fontName "Monospace"
92 autoSizePolicy "node_width"
93 anchor "t"
94 borderDistance 0.0
95 ]
96 LabelGraphics
97 [
98 text "
99 "
100 fontSize 14
101 fontName "Consolas"
102 alignment "left"
103 anchor "tl"
104 borderDistance 6
105 ]
106 ]
107
108 node
109 [
110 id 3
111 graphics
112 [
113 w 15.400000000000002
114 h 26
115 type "rectangle"
116 fill "#FFFFFF"
117 fill2 "#FFFFFF"
118 outline "#000000"
119 ]
120 LabelGraphics
121 [
122 text "2"
123 outline "#000000"
124 fill "#FFFFFF"
125 fontSize 16
126 fontName "Monospace"
127 autoSizePolicy "node_width"
128 anchor "t"
129 borderDistance 0.0
130 ]
131 LabelGraphics
132 [
133 text "
134 "
135 fontSize 14
136 fontName "Consolas"
137 alignment "left"
138 anchor "tl"
139 borderDistance 6
140 ]
141 ]
142
143 node
144 [
145 id 4
146 graphics
147 [
148 w 15.400000000000002
149 h 26
150 type "rectangle"
151 fill "#FFFFFF"
152 fill2 "#FFFFFF"
153 outline "#000000"
154 ]
155 LabelGraphics
156 [
157 text "3"
158 outline "#000000"
159 fill "#FFFFFF"
160 fontSize 16
161 fontName "Monospace"
162 autoSizePolicy "node_width"
163 anchor "t"
164 borderDistance 0.0
165 ]
166 LabelGraphics
167 [
168 text "
169 "
170 fontSize 14
171 fontName "Consolas"
172 alignment "left"
173 anchor "tl"
174 borderDistance 6
175 ]
176 ]
177
178 node
179 [
180 id 5
181 graphics
182 [
183 w 15.400000000000002
184 h 26
185 type "rectangle"
186 fill "#FFFFFF"
187 fill2 "#FFFFFF"
188 outline "#000000"
189 ]
190 LabelGraphics
191 [
192 text "4"
193 outline "#000000"
194 fill "#FFFFFF"
195 fontSize 16
196 fontName "Monospace"
197 autoSizePolicy "node_width"
198 anchor "t"
199 borderDistance 0.0
200 ]
201 LabelGraphics
202 [
203 text "
204 "
205 fontSize 14
206 fontName "Consolas"
207 alignment "left"
208 anchor "tl"
209 borderDistance 6
210 ]
211 ]
212
213 node
214 [
215 id 6
216 graphics
217 [
218 w 15.400000000000002
219 h 26
220 type "rectangle"
221 fill "#FFFFFF"
222 fill2 "#FFFFFF"
223 outline "#000000"
224 ]
225 LabelGraphics
226 [
227 text "5"
228 outline "#000000"
229 fill "#FFFFFF"
230 fontSize 16
231 fontName "Monospace"
232 autoSizePolicy "node_width"
233 anchor "t"
234 borderDistance 0.0
235 ]
236 LabelGraphics
237 [
238 text "
239 "
240 fontSize 14
241 fontName "Consolas"
242 alignment "left"
243 anchor "tl"
244 borderDistance 6
245 ]
246 ]
247
248 node
249 [
250 id 7
251 graphics
252 [
253 w 138.60000000000002
254 h 40
255 type "rectangle"
256 fill "#FFFFFF"
257 fill2 "#FFFFFF"
258 outline "#000000"
259 ]
260 LabelGraphics
261 [
262 text "null"
263 outline "#000000"
264 fill "#FFFFFF"
265 fontSize 16
266 fontName "Monospace"
267 autoSizePolicy "node_width"
268 anchor "t"
269 borderDistance 0.0
270 ]
271 LabelGraphics
272 [
273 text "
274 FamilyTree class
275 "
276 fontSize 14
277 fontName "Consolas"
278 alignment "left"
279 anchor "tl"
280 borderDistance 6
281 ]
282 ]
283
284 node
285 [
286 id 8
287 graphics
288 [
289 w 107.80000000000001
290 h 40
291 type "rectangle"
292 fill "#FFFFFF"
293 fill2 "#FFFFFF"
294 outline "#000000"
295 ]
296 LabelGraphics
297 [
298 text "null"
299 outline "#000000"
300 fill "#FFFFFF"
301 fontSize 16
302 fontName "Monospace"
303 autoSizePolicy "node_width"
304 anchor "t"
305 borderDistance 0.0
306 ]
307 LabelGraphics
308 [
309 text "
310 Member class
311 "
312 fontSize 14
313 fontName "Consolas"
314 alignment "left"
315 anchor "tl"
316 borderDistance 6
317 ]
318 ]
319
320 node
321 [
322 id 9
323 graphics
324 [
325 w 107.80000000000001
326 h 40
327 type "rectangle"
328 fill "#FFFFFF"
329 fill2 "#FFFFFF"
330 outline "#000000"
331 ]
332 LabelGraphics
333 [
334 text "null"
335 outline "#000000"
336 fill "#FFFFFF"
337 fontSize 16
338 fontName "Monospace"
339 autoSizePolicy "node_width"
340 anchor "t"
341 borderDistance 0.0
342 ]
343 LabelGraphics
344 [
345 text "
346 Member class
347 "
348 fontSize 14
349 fontName "Consolas"
350 alignment "left"
351 anchor "tl"
352 borderDistance 6
353 ]
354 ]
355
356 node
357 [
358 id 10
359 graphics
360 [
361 w 107.80000000000001
362 h 40
363 type "rectangle"
364 fill "#FFFFFF"
365 fill2 "#FFFFFF"
366 outline "#000000"
367 ]
368 LabelGraphics
369 [
370 text "null"
371 outline "#000000"
372 fill "#FFFFFF"
373 fontSize 16
374 fontName "Monospace"
375 autoSizePolicy "node_width"
376 anchor "t"
377 borderDistance 0.0
378 ]
379 LabelGraphics
380 [
381 text "
382 Member class
383 "
384 fontSize 14
385 fontName "Consolas"
386 alignment "left"
387 anchor "tl"
388 borderDistance 6
389 ]
390 ]
391
392 node
393 [
394 id 11
395 graphics
396 [
397 w 107.80000000000001
398 h 40
399 type "rectangle"
400 fill "#FFFFFF"
401 fill2 "#FFFFFF"
402 outline "#000000"
403 ]
404 LabelGraphics
405 [
406 text "null"
407 outline "#000000"
408 fill "#FFFFFF"
409 fontSize 16
410 fontName "Monospace"
411 autoSizePolicy "node_width"
412 anchor "t"
413 borderDistance 0.0
414 ]
415 LabelGraphics
416 [
417 text "
418 Member class
419 "
420 fontSize 14
421 fontName "Consolas"
422 alignment "left"
423 anchor "tl"
424 borderDistance 6
425 ]
426 ]
427
428 node
429 [
430 id 12
431 graphics
432 [
433 w 107.80000000000001
434 h 40
435 type "rectangle"
436 fill "#FFFFFF"
437 fill2 "#FFFFFF"
438 outline "#000000"
439 ]
440 LabelGraphics
441 [
442 text "null"
443 outline "#000000"
444 fill "#FFFFFF"
445 fontSize 16
446 fontName "Monospace"
447 autoSizePolicy "node_width"
448 anchor "t"
449 borderDistance 0.0
450 ]
451 LabelGraphics
452 [
453 text "
454 Member class
455 "
456 fontSize 14
457 fontName "Consolas"
458 alignment "left"
459 anchor "tl"
460 borderDistance 6
461 ]
462 ]
463
464 node
465 [
466 id 13
467 graphics
468 [
469 w 85.80000000000001
470 h 26
471 type "rectangle"
472 fill "#FFFFFF"
473 fill2 "#FFFFFF"
474 outline "#000000"
475 ]
476 LabelGraphics
477 [
478 text "New Reals"
479 outline "#000000"
480 fill "#FFFFFF"
481 fontSize 16
482 fontName "Monospace"
483 autoSizePolicy "node_width"
484 anchor "t"
485 borderDistance 0.0
486 ]
487 LabelGraphics
488 [
489 text "
490 "
491 fontSize 14
492 fontName "Consolas"
493 alignment "left"
494 anchor "tl"
495 borderDistance 6
496 ]
497 ]
498
499 node
500 [
501 id 14
502 graphics
503 [
504 w 103.4
505 h 26
506 type "rectangle"
507 fill "#FFFFFF"
508 fill2 "#FFFFFF"
509 outline "#000000"
510 ]
511 LabelGraphics
512 [
513 text "New Strings"
514 outline "#000000"
515 fill "#FFFFFF"
516 fontSize 16
517 fontName "Monospace"
518 autoSizePolicy "node_width"
519 anchor "t"
520 borderDistance 0.0
521 ]
522 LabelGraphics
523 [
524 text "
525 "
526 fontSize 14
527 fontName "Consolas"
528 alignment "left"
529 anchor "tl"
530 borderDistance 6
531 ]
532 ]
533
534 node
535 [
536 id 15
537 graphics
538 [
539 w 103.4
540 h 26
541 type "rectangle"
542 fill "#FFFFFF"
543 fill2 "#FFFFFF"
544 outline "#000000"
545 ]
546 LabelGraphics
547 [
548 text "New Objects"
549 outline "#000000"
550 fill "#FFFFFF"
551 fontSize 16
552 fontName "Monospace"
553 autoSizePolicy "node_width"
554 anchor "t"
555 borderDistance 0.0
556 ]
557 LabelGraphics
558 [
559 text "
560 "
561 fontSize 14
562 fontName "Consolas"
563 alignment "left"
564 anchor "tl"
565 borderDistance 6
566 ]
567 ]
568 edge
569 [
570 source 7
571 target 8
572 graphics
573 [
574 fill "#000000"
575 width 3
576 targetArrow "standard"
577 ]
578 LabelGraphics
579 [
580 text "members reference FamilyTree"
581 fontSize 14
582 fontName "Consolas"
583 configuration "AutoFlippingLabel"
584 model "six_pos"
585 position "thead"
586 ]
587 ]
588 edge
589 [
590 source 7
591 target 9
592 graphics
593 [
594 fill "#000000"
595 width 3
596 targetArrow "standard"
597 ]
598 LabelGraphics
599 [
600 text "members reference FamilyTree"
601 fontSize 14
602 fontName "Consolas"
603 configuration "AutoFlippingLabel"
604 model "six_pos"
605 position "thead"
606 ]
607 ]
608 edge
609 [
610 source 7
611 target 10
612 graphics
613 [
614 fill "#000000"
615 width 3
616 targetArrow "standard"
617 ]
618 LabelGraphics
619 [
620 text "members reference FamilyTree"
621 fontSize 14
622 fontName "Consolas"
623 configuration "AutoFlippingLabel"
624 model "six_pos"
625 position "thead"
626 ]
627 ]
628 edge
629 [
630 source 7
631 target 11
632 graphics
633 [
634 fill "#000000"
635 width 3
636 targetArrow "standard"
637 ]
638 LabelGraphics
639 [
640 text "members reference FamilyTree"
641 fontSize 14
642 fontName "Consolas"
643 configuration "AutoFlippingLabel"
644 model "six_pos"
645 position "thead"
646 ]
647 ]
648 edge
649 [
650 source 7
651 target 12
652 graphics
653 [
654 fill "#000000"
655 width 3
656 targetArrow "standard"
657 ]
658 LabelGraphics
659 [
660 text "members reference FamilyTree"
661 fontSize 14
662 fontName "Consolas"
663 configuration "AutoFlippingLabel"
664 model "six_pos"
665 position "thead"
666 ]
667 ]
668 edge
669 [
670 source 9
671 target 8
672 graphics
673 [
674 fill "#000000"
675 targetArrow "standard"
676 ]
677 LabelGraphics
678 [
679 text "children reference Member"
680 fontSize 14
681 fontName "Consolas"
682 configuration "AutoFlippingLabel"
683 model "six_pos"
684 position "thead"
685 ]
686 ]
687 edge
688 [
689 source 8
690 target 9
691 graphics
692 [
693 fill "#000000"
694 targetArrow "standard"
695 ]
696 LabelGraphics
697 [
698 text "children reference Member"
699 fontSize 14
700 fontName "Consolas"
701 configuration "AutoFlippingLabel"
702 model "six_pos"
703 position "thead"
704 ]
705 ]
706 edge
707 [
708 source 9
709 target 10
710 graphics
711 [
712 fill "#000000"
713 targetArrow "standard"
714 ]
715 LabelGraphics
716 [
717 text "children reference Member"
718 fontSize 14
719 fontName "Consolas"
720 configuration "AutoFlippingLabel"
721 model "six_pos"
722 position "thead"
723 ]
724 ]
725 edge
726 [
727 source 11
728 target 9
729 graphics
730 [
731 fill "#000000"
732 targetArrow "standard"
733 ]
734 LabelGraphics
735 [
736 text "children reference Member"
737 fontSize 14
738 fontName "Consolas"
739 configuration "AutoFlippingLabel"
740 model "six_pos"
741 position "thead"
742 ]
743 ]
744 edge
745 [
746 source 9
747 target 11
748 graphics
749 [
750 fill "#000000"
751 targetArrow "standard"
752 ]
753 LabelGraphics
754 [
755 text "children reference Member"
756 fontSize 14
757 fontName "Consolas"
758 configuration "AutoFlippingLabel"
759 model "six_pos"
760 position "thead"
761 ]
762 ]
763 edge
764 [
765 source 8
766 target 9
767 graphics
768 [
769 fill "#000000"
770 targetArrow "standard"
771 ]
772 LabelGraphics
773 [
774 text "parents reference Member"
775 fontSize 14
776 fontName "Consolas"
777 configuration "AutoFlippingLabel"
778 model "six_pos"
779 position "thead"
780 ]
781 ]
782 edge
783 [
784 source 9
785 target 8
786 graphics
787 [
788 fill "#000000"
789 targetArrow "standard"
790 ]
791 LabelGraphics
792 [
793 text "parents reference Member"
794 fontSize 14
795 fontName "Consolas"
796 configuration "AutoFlippingLabel"
797 model "six_pos"
798 position "thead"
799 ]
800 ]
801 edge
802 [
803 source 10
804 target 9
805 graphics
806 [
807 fill "#000000"
808 targetArrow "standard"
809 ]
810 LabelGraphics
811 [
812 text "parents reference Member"
813 fontSize 14
814 fontName "Consolas"
815 configuration "AutoFlippingLabel"
816 model "six_pos"
817 position "thead"
818 ]
819 ]
820 edge
821 [
822 source 9
823 target 11
824 graphics
825 [
826 fill "#000000"
827 targetArrow "standard"
828 ]
829 LabelGraphics
830 [
831 text "parents reference Member"
832 fontSize 14
833 fontName "Consolas"
834 configuration "AutoFlippingLabel"
835 model "six_pos"
836 position "thead"
837 ]
838 ]
839 edge
840 [
841 source 11
842 target 9
843 graphics
844 [
845 fill "#000000"
846 targetArrow "standard"
847 ]
848 LabelGraphics
849 [
850 text "parents reference Member"
851 fontSize 14
852 fontName "Consolas"
853 configuration "AutoFlippingLabel"
854 model "six_pos"
855 position "thead"
856 ]
857 ]
858 edge
859 [
860 source 8
861 target 6
862 graphics
863 [
864 fill "#000000"
865 targetArrow "standard"
866 ]
867 LabelGraphics
868 [
869 text "age attribute Member"
870 fontSize 14
871 fontName "Consolas"
872 configuration "AutoFlippingLabel"
873 model "six_pos"
874 position "thead"
875 ]
876 ]
877 edge
878 [
879 source 10
880 target 3
881 graphics
882 [
883 fill "#000000"
884 targetArrow "standard"
885 ]
886 LabelGraphics
887 [
888 text "age attribute Member"
889 fontSize 14
890 fontName "Consolas"
891 configuration "AutoFlippingLabel"
892 model "six_pos"
893 position "thead"
894 ]
895 ]
896 edge
897 [
898 source 11
899 target 3
900 graphics
901 [
902 fill "#000000"
903 targetArrow "standard"
904 ]
905 LabelGraphics
906 [
907 text "age attribute Member"
908 fontSize 14
909 fontName "Consolas"
910 configuration "AutoFlippingLabel"
911 model "six_pos"
912 position "thead"
913 ]
914 ]
915]
916
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.png b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.png
deleted file mode 100644
index e99dc418..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.png
+++ /dev/null
Binary files differ
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.xmi b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.xmi
deleted file mode 100644
index c3ca6161..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.xmi
+++ /dev/null
@@ -1,8 +0,0 @@
1<?xml version="1.0" encoding="ASCII"?>
2<familytree:FamilyTree xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:familytree="http://www.example.org/familytree" xsi:schemaLocation="http://www.example.org/familytree inputs/familytree.ecore">
3 <members age="2" children="//@members.4" parents="//@members.4"/>
4 <members age="5" children="//@members.4" parents="//@members.4"/>
5 <members age="2" parents="//@members.4"/>
6 <members/>
7 <members children="//@members.0 //@members.1 //@members.2" parents="//@members.0 //@members.1"/>
8</familytree:FamilyTree>
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
deleted file mode 100644
index b000501e..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.FamilyTreeConstraints.java._trace
+++ /dev/null
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
deleted file mode 100644
index aaf4d0c2..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.MemberIsItsOwnParent.java._trace
+++ /dev/null
Binary files differ
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.gitignore
deleted file mode 100644
index 19bc3cc8..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
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
9/.NegativeAge.java._trace
10/MemberHasParent.java
11/NegativeAge.java
12/ParentTooYoung.java
13/TwoMembersHaveNoParent.java
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
deleted file mode 100644
index 1d991140..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/FamilyTreeConstraints.java
+++ /dev/null
@@ -1,97 +0,0 @@
1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */
4package queries;
5
6import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
7import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
8import queries.MemberHasParent;
9import queries.MemberIsItsOwnParent;
10import queries.NegativeAge;
11import queries.ParentTooYoung;
12import queries.TwoMembersHaveNoParent;
13
14/**
15 * A pattern group formed of all public patterns defined in familyTreeConstraints.vql.
16 *
17 * <p>Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare
18 * a VIATRA Query engine for matching all patterns originally defined in file familyTreeConstraints.vql,
19 * in order to achieve better performance than one-by-one on-demand matcher initialization.
20 *
21 * <p> From package queries, the group contains the definition of the following patterns: <ul>
22 * <li>memberIsItsOwnParent</li>
23 * <li>twoMembersHaveNoParent</li>
24 * <li>memberHasParent</li>
25 * <li>negativeAge</li>
26 * <li>parentTooYoung</li>
27 * </ul>
28 *
29 * @see IQueryGroup
30 *
31 */
32@SuppressWarnings("all")
33public final class FamilyTreeConstraints extends BaseGeneratedPatternGroup {
34 /**
35 * Access the pattern group.
36 *
37 * @return the singleton instance of the group
38 * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications
39 *
40 */
41 public static FamilyTreeConstraints instance() {
42 if (INSTANCE == null) {
43 INSTANCE = new FamilyTreeConstraints();
44 }
45 return INSTANCE;
46 }
47
48 private static FamilyTreeConstraints INSTANCE;
49
50 private FamilyTreeConstraints() {
51 querySpecifications.add(MemberIsItsOwnParent.instance());
52 querySpecifications.add(TwoMembersHaveNoParent.instance());
53 querySpecifications.add(MemberHasParent.instance());
54 querySpecifications.add(NegativeAge.instance());
55 querySpecifications.add(ParentTooYoung.instance());
56 }
57
58 public MemberIsItsOwnParent getMemberIsItsOwnParent() {
59 return MemberIsItsOwnParent.instance();
60 }
61
62 public MemberIsItsOwnParent.Matcher getMemberIsItsOwnParent(final ViatraQueryEngine engine) {
63 return MemberIsItsOwnParent.Matcher.on(engine);
64 }
65
66 public TwoMembersHaveNoParent getTwoMembersHaveNoParent() {
67 return TwoMembersHaveNoParent.instance();
68 }
69
70 public TwoMembersHaveNoParent.Matcher getTwoMembersHaveNoParent(final ViatraQueryEngine engine) {
71 return TwoMembersHaveNoParent.Matcher.on(engine);
72 }
73
74 public MemberHasParent getMemberHasParent() {
75 return MemberHasParent.instance();
76 }
77
78 public MemberHasParent.Matcher getMemberHasParent(final ViatraQueryEngine engine) {
79 return MemberHasParent.Matcher.on(engine);
80 }
81
82 public NegativeAge getNegativeAge() {
83 return NegativeAge.instance();
84 }
85
86 public NegativeAge.Matcher getNegativeAge(final ViatraQueryEngine engine) {
87 return NegativeAge.Matcher.on(engine);
88 }
89
90 public ParentTooYoung getParentTooYoung() {
91 return ParentTooYoung.instance();
92 }
93
94 public ParentTooYoung.Matcher getParentTooYoung(final ViatraQueryEngine engine) {
95 return ParentTooYoung.Matcher.on(engine);
96 }
97}
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
deleted file mode 100644
index 83bb4aac..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberHasParent.java
+++ /dev/null
@@ -1,551 +0,0 @@
1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */
4package queries;
5
6import familytree.Member;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
34import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
37import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
39import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
40
41/**
42 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
43 *
44 * <p>Original source:
45 * <code><pre>
46 * pattern memberHasParent(m: Member) = {
47 * Member.parents(m, _);
48 * }
49 * </pre></code>
50 *
51 * @see Matcher
52 * @see Match
53 *
54 */
55@SuppressWarnings("all")
56public final class MemberHasParent extends BaseGeneratedEMFQuerySpecification<MemberHasParent.Matcher> {
57 /**
58 * Pattern-specific match representation of the queries.memberHasParent pattern,
59 * to be used in conjunction with {@link Matcher}.
60 *
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,
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.
65 *
66 * @see Matcher
67 *
68 */
69 public static abstract class Match extends BasePatternMatch {
70 private Member fM;
71
72 private static List<String> parameterNames = makeImmutableList("m");
73
74 private Match(final Member pM) {
75 this.fM = pM;
76 }
77
78 @Override
79 public Object get(final String parameterName) {
80 switch(parameterName) {
81 case "m": return this.fM;
82 default: return null;
83 }
84 }
85
86 @Override
87 public Object get(final int index) {
88 switch(index) {
89 case 0: return this.fM;
90 default: return null;
91 }
92 }
93
94 public Member getM() {
95 return this.fM;
96 }
97
98 @Override
99 public boolean set(final String parameterName, final Object newValue) {
100 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
101 if ("m".equals(parameterName) ) {
102 this.fM = (Member) newValue;
103 return true;
104 }
105 return false;
106 }
107
108 public void setM(final Member pM) {
109 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
110 this.fM = pM;
111 }
112
113 @Override
114 public String patternName() {
115 return "queries.memberHasParent";
116 }
117
118 @Override
119 public List<String> parameterNames() {
120 return MemberHasParent.Match.parameterNames;
121 }
122
123 @Override
124 public Object[] toArray() {
125 return new Object[]{fM};
126 }
127
128 @Override
129 public MemberHasParent.Match toImmutable() {
130 return isMutable() ? newMatch(fM) : this;
131 }
132
133 @Override
134 public String prettyPrint() {
135 StringBuilder result = new StringBuilder();
136 result.append("\"m\"=" + prettyPrintValue(fM));
137 return result.toString();
138 }
139
140 @Override
141 public int hashCode() {
142 return Objects.hash(fM);
143 }
144
145 @Override
146 public boolean equals(final Object obj) {
147 if (this == obj)
148 return true;
149 if (obj == null) {
150 return false;
151 }
152 if ((obj instanceof MemberHasParent.Match)) {
153 MemberHasParent.Match other = (MemberHasParent.Match) obj;
154 return Objects.equals(fM, other.fM);
155 } else {
156 // this should be infrequent
157 if (!(obj instanceof IPatternMatch)) {
158 return false;
159 }
160 IPatternMatch otherSig = (IPatternMatch) obj;
161 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
162 }
163 }
164
165 @Override
166 public MemberHasParent specification() {
167 return MemberHasParent.instance();
168 }
169
170 /**
171 * Returns an empty, mutable match.
172 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
173 *
174 * @return the empty match.
175 *
176 */
177 public static MemberHasParent.Match newEmptyMatch() {
178 return new Mutable(null);
179 }
180
181 /**
182 * Returns a mutable (partial) match.
183 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
184 *
185 * @param pM the fixed value of pattern parameter m, or null if not bound.
186 * @return the new, mutable (partial) match object.
187 *
188 */
189 public static MemberHasParent.Match newMutableMatch(final Member pM) {
190 return new Mutable(pM);
191 }
192
193 /**
194 * Returns a new (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.
197 * @param pM the fixed value of pattern parameter m, or null if not bound.
198 * @return the (partial) match object.
199 *
200 */
201 public static MemberHasParent.Match newMatch(final Member pM) {
202 return new Immutable(pM);
203 }
204
205 private static final class Mutable extends MemberHasParent.Match {
206 Mutable(final Member pM) {
207 super(pM);
208 }
209
210 @Override
211 public boolean isMutable() {
212 return true;
213 }
214 }
215
216 private static final class Immutable extends MemberHasParent.Match {
217 Immutable(final Member pM) {
218 super(pM);
219 }
220
221 @Override
222 public boolean isMutable() {
223 return false;
224 }
225 }
226 }
227
228 /**
229 * Generated pattern matcher API of the queries.memberHasParent pattern,
230 * providing pattern-specific query methods.
231 *
232 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
233 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
234 *
235 * <p>Matches of the pattern will be represented as {@link Match}.
236 *
237 * <p>Original source:
238 * <code><pre>
239 * pattern memberHasParent(m: Member) = {
240 * Member.parents(m, _);
241 * }
242 * </pre></code>
243 *
244 * @see Match
245 * @see MemberHasParent
246 *
247 */
248 public static class Matcher extends BaseMatcher<MemberHasParent.Match> {
249 /**
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.
252 *
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
255 *
256 */
257 public static MemberHasParent.Matcher on(final ViatraQueryEngine engine) {
258 // check if matcher already exists
259 Matcher matcher = engine.getExistingMatcher(querySpecification());
260 if (matcher == null) {
261 matcher = (Matcher)engine.getMatcher(querySpecification());
262 }
263 return matcher;
264 }
265
266 /**
267 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
268 * @return an initialized matcher
269 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
270 *
271 */
272 public static MemberHasParent.Matcher create() {
273 return new Matcher();
274 }
275
276 private static final int POSITION_M = 0;
277
278 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MemberHasParent.Matcher.class);
279
280 /**
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.
283 *
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
286 *
287 */
288 private Matcher() {
289 super(querySpecification());
290 }
291
292 /**
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.
295 * @return matches represented as a Match object.
296 *
297 */
298 public Collection<MemberHasParent.Match> getAllMatches(final Member pM) {
299 return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet());
300 }
301
302 /**
303 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
304 * </p>
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>.
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.
309 * @return a stream of matches represented as a Match object.
310 *
311 */
312 public Stream<MemberHasParent.Match> streamAllMatches(final Member pM) {
313 return rawStreamAllMatches(new Object[]{pM});
314 }
315
316 /**
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.
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.
321 *
322 */
323 public Optional<MemberHasParent.Match> getOneArbitraryMatch(final Member pM) {
324 return rawGetOneArbitraryMatch(new Object[]{pM});
325 }
326
327 /**
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).
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.
332 *
333 */
334 public boolean hasMatch(final Member pM) {
335 return rawHasMatch(new Object[]{pM});
336 }
337
338 /**
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.
341 * @return the number of pattern matches found.
342 *
343 */
344 public int countMatches(final Member pM) {
345 return rawCountMatches(new Object[]{pM});
346 }
347
348 /**
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.
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.
353 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
354 *
355 */
356 public boolean forOneArbitraryMatch(final Member pM, final Consumer<? super MemberHasParent.Match> processor) {
357 return rawForOneArbitraryMatch(new Object[]{pM}, processor);
358 }
359
360 /**
361 * Returns a new (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.
364 * @param pM the fixed value of pattern parameter m, or null if not bound.
365 * @return the (partial) match object.
366 *
367 */
368 public MemberHasParent.Match newMatch(final Member pM) {
369 return MemberHasParent.Match.newMatch(pM);
370 }
371
372 /**
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
375 *
376 */
377 protected Stream<Member> rawStreamAllValuesOfm(final Object[] parameters) {
378 return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast);
379 }
380
381 /**
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
384 *
385 */
386 public Set<Member> getAllValuesOfm() {
387 return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet());
388 }
389
390 /**
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
393 *
394 */
395 public Stream<Member> streamAllValuesOfm() {
396 return rawStreamAllValuesOfm(emptyArray());
397 }
398
399 @Override
400 protected MemberHasParent.Match tupleToMatch(final Tuple t) {
401 try {
402 return MemberHasParent.Match.newMatch((Member) t.get(POSITION_M));
403 } catch(ClassCastException e) {
404 LOGGER.error("Element(s) in tuple not properly typed!",e);
405 return null;
406 }
407 }
408
409 @Override
410 protected MemberHasParent.Match arrayToMatch(final Object[] match) {
411 try {
412 return MemberHasParent.Match.newMatch((Member) match[POSITION_M]);
413 } catch(ClassCastException e) {
414 LOGGER.error("Element(s) in array not properly typed!",e);
415 return null;
416 }
417 }
418
419 @Override
420 protected MemberHasParent.Match arrayToMatchMutable(final Object[] match) {
421 try {
422 return MemberHasParent.Match.newMutableMatch((Member) match[POSITION_M]);
423 } catch(ClassCastException e) {
424 LOGGER.error("Element(s) in array not properly typed!",e);
425 return null;
426 }
427 }
428
429 /**
430 * @return the singleton instance of the query specification of this pattern
431 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
432 *
433 */
434 public static IQuerySpecification<MemberHasParent.Matcher> querySpecification() {
435 return MemberHasParent.instance();
436 }
437 }
438
439 private MemberHasParent() {
440 super(GeneratedPQuery.INSTANCE);
441 }
442
443 /**
444 * @return the singleton instance of the query specification
445 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
446 *
447 */
448 public static MemberHasParent instance() {
449 try{
450 return LazyHolder.INSTANCE;
451 } catch (ExceptionInInitializerError err) {
452 throw processInitializerError(err);
453 }
454 }
455
456 @Override
457 protected MemberHasParent.Matcher instantiate(final ViatraQueryEngine engine) {
458 return MemberHasParent.Matcher.on(engine);
459 }
460
461 @Override
462 public MemberHasParent.Matcher instantiate() {
463 return MemberHasParent.Matcher.create();
464 }
465
466 @Override
467 public MemberHasParent.Match newEmptyMatch() {
468 return MemberHasParent.Match.newEmptyMatch();
469 }
470
471 @Override
472 public MemberHasParent.Match newMatch(final Object... parameters) {
473 return MemberHasParent.Match.newMatch((familytree.Member) parameters[0]);
474 }
475
476 /**
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,
479 * but rather at the first call to {@link MemberHasParent#instance()}.
480 *
481 * <p> This workaround is required e.g. to support recursion.
482 *
483 */
484 private static class LazyHolder {
485 private static final MemberHasParent INSTANCE = new MemberHasParent();
486
487 /**
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.
490 *
491 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
492 *
493 */
494 private static final Object STATIC_INITIALIZER = ensureInitialized();
495
496 public static Object ensureInitialized() {
497 INSTANCE.ensureInitializedInternal();
498 return null;
499 }
500 }
501
502 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
503 private static final MemberHasParent.GeneratedPQuery INSTANCE = new GeneratedPQuery();
504
505 private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
506
507 private final List<PParameter> parameters = Arrays.asList(parameter_m);
508
509 private GeneratedPQuery() {
510 super(PVisibility.PUBLIC);
511 }
512
513 @Override
514 public String getFullyQualifiedName() {
515 return "queries.memberHasParent";
516 }
517
518 @Override
519 public List<String> getParameterNames() {
520 return Arrays.asList("m");
521 }
522
523 @Override
524 public List<PParameter> getParameters() {
525 return parameters;
526 }
527
528 @Override
529 public Set<PBody> doGetContainedBodies() {
530 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
531 Set<PBody> bodies = new LinkedHashSet<>();
532 {
533 PBody body = new PBody(this);
534 PVariable var_m = body.getOrCreateVariableByName("m");
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")));
537 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
538 new ExportedParameter(body, var_m, parameter_m)
539 ));
540 // Member.parents(m, _)
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}");
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")));
545 new Equality(body, var__virtual_0_, var___0_);
546 bodies.add(body);
547 }
548 return bodies;
549 }
550 }
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
deleted file mode 100644
index 63cb882d..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberIsItsOwnParent.java
+++ /dev/null
@@ -1,577 +0,0 @@
1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */
4package queries;
5
6import familytree.Member;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * {@literal @}Constraint(message="memberIsItsOwnParent", severity="error", key={m})
49 * pattern memberIsItsOwnParent(m: Member) = {
50 * FamilyTree.members(_, m);
51 * Member.parents(m, p);
52 * m == p;
53 * }
54 * </pre></code>
55 *
56 * @see Matcher
57 * @see Match
58 *
59 */
60@SuppressWarnings("all")
61public final class MemberIsItsOwnParent extends BaseGeneratedEMFQuerySpecification<MemberIsItsOwnParent.Matcher> {
62 /**
63 * Pattern-specific match representation of the queries.memberIsItsOwnParent pattern,
64 * to be used in conjunction with {@link Matcher}.
65 *
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,
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.
70 *
71 * @see Matcher
72 *
73 */
74 public static abstract class Match extends BasePatternMatch {
75 private Member fM;
76
77 private static List<String> parameterNames = makeImmutableList("m");
78
79 private Match(final Member pM) {
80 this.fM = pM;
81 }
82
83 @Override
84 public Object get(final String parameterName) {
85 switch(parameterName) {
86 case "m": return this.fM;
87 default: return null;
88 }
89 }
90
91 @Override
92 public Object get(final int index) {
93 switch(index) {
94 case 0: return this.fM;
95 default: return null;
96 }
97 }
98
99 public Member getM() {
100 return this.fM;
101 }
102
103 @Override
104 public boolean set(final String parameterName, final Object newValue) {
105 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
106 if ("m".equals(parameterName) ) {
107 this.fM = (Member) newValue;
108 return true;
109 }
110 return false;
111 }
112
113 public void setM(final Member pM) {
114 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
115 this.fM = pM;
116 }
117
118 @Override
119 public String patternName() {
120 return "queries.memberIsItsOwnParent";
121 }
122
123 @Override
124 public List<String> parameterNames() {
125 return MemberIsItsOwnParent.Match.parameterNames;
126 }
127
128 @Override
129 public Object[] toArray() {
130 return new Object[]{fM};
131 }
132
133 @Override
134 public MemberIsItsOwnParent.Match toImmutable() {
135 return isMutable() ? newMatch(fM) : this;
136 }
137
138 @Override
139 public String prettyPrint() {
140 StringBuilder result = new StringBuilder();
141 result.append("\"m\"=" + prettyPrintValue(fM));
142 return result.toString();
143 }
144
145 @Override
146 public int hashCode() {
147 return Objects.hash(fM);
148 }
149
150 @Override
151 public boolean equals(final Object obj) {
152 if (this == obj)
153 return true;
154 if (obj == null) {
155 return false;
156 }
157 if ((obj instanceof MemberIsItsOwnParent.Match)) {
158 MemberIsItsOwnParent.Match other = (MemberIsItsOwnParent.Match) obj;
159 return Objects.equals(fM, other.fM);
160 } else {
161 // this should be infrequent
162 if (!(obj instanceof IPatternMatch)) {
163 return false;
164 }
165 IPatternMatch otherSig = (IPatternMatch) obj;
166 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
167 }
168 }
169
170 @Override
171 public MemberIsItsOwnParent specification() {
172 return MemberIsItsOwnParent.instance();
173 }
174
175 /**
176 * Returns an empty, mutable match.
177 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
178 *
179 * @return the empty match.
180 *
181 */
182 public static MemberIsItsOwnParent.Match newEmptyMatch() {
183 return new Mutable(null);
184 }
185
186 /**
187 * Returns a mutable (partial) match.
188 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
189 *
190 * @param pM the fixed value of pattern parameter m, or null if not bound.
191 * @return the new, mutable (partial) match object.
192 *
193 */
194 public static MemberIsItsOwnParent.Match newMutableMatch(final Member pM) {
195 return new Mutable(pM);
196 }
197
198 /**
199 * Returns a new (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.
202 * @param pM the fixed value of pattern parameter m, or null if not bound.
203 * @return the (partial) match object.
204 *
205 */
206 public static MemberIsItsOwnParent.Match newMatch(final Member pM) {
207 return new Immutable(pM);
208 }
209
210 private static final class Mutable extends MemberIsItsOwnParent.Match {
211 Mutable(final Member pM) {
212 super(pM);
213 }
214
215 @Override
216 public boolean isMutable() {
217 return true;
218 }
219 }
220
221 private static final class Immutable extends MemberIsItsOwnParent.Match {
222 Immutable(final Member pM) {
223 super(pM);
224 }
225
226 @Override
227 public boolean isMutable() {
228 return false;
229 }
230 }
231 }
232
233 /**
234 * Generated pattern matcher API of the queries.memberIsItsOwnParent pattern,
235 * providing pattern-specific query methods.
236 *
237 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
238 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
239 *
240 * <p>Matches of the pattern will be represented as {@link Match}.
241 *
242 * <p>Original source:
243 * <code><pre>
244 * {@literal @}Constraint(message="memberIsItsOwnParent", severity="error", key={m})
245 * pattern memberIsItsOwnParent(m: Member) = {
246 * FamilyTree.members(_, m);
247 * Member.parents(m, p);
248 * m == p;
249 * }
250 * </pre></code>
251 *
252 * @see Match
253 * @see MemberIsItsOwnParent
254 *
255 */
256 public static class Matcher extends BaseMatcher<MemberIsItsOwnParent.Match> {
257 /**
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.
260 *
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
263 *
264 */
265 public static MemberIsItsOwnParent.Matcher on(final ViatraQueryEngine engine) {
266 // check if matcher already exists
267 Matcher matcher = engine.getExistingMatcher(querySpecification());
268 if (matcher == null) {
269 matcher = (Matcher)engine.getMatcher(querySpecification());
270 }
271 return matcher;
272 }
273
274 /**
275 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
276 * @return an initialized matcher
277 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
278 *
279 */
280 public static MemberIsItsOwnParent.Matcher create() {
281 return new Matcher();
282 }
283
284 private static final int POSITION_M = 0;
285
286 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MemberIsItsOwnParent.Matcher.class);
287
288 /**
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.
291 *
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
294 *
295 */
296 private Matcher() {
297 super(querySpecification());
298 }
299
300 /**
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.
303 * @return matches represented as a Match object.
304 *
305 */
306 public Collection<MemberIsItsOwnParent.Match> getAllMatches(final Member pM) {
307 return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet());
308 }
309
310 /**
311 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
312 * </p>
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>.
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.
317 * @return a stream of matches represented as a Match object.
318 *
319 */
320 public Stream<MemberIsItsOwnParent.Match> streamAllMatches(final Member pM) {
321 return rawStreamAllMatches(new Object[]{pM});
322 }
323
324 /**
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.
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.
329 *
330 */
331 public Optional<MemberIsItsOwnParent.Match> getOneArbitraryMatch(final Member pM) {
332 return rawGetOneArbitraryMatch(new Object[]{pM});
333 }
334
335 /**
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).
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.
340 *
341 */
342 public boolean hasMatch(final Member pM) {
343 return rawHasMatch(new Object[]{pM});
344 }
345
346 /**
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.
349 * @return the number of pattern matches found.
350 *
351 */
352 public int countMatches(final Member pM) {
353 return rawCountMatches(new Object[]{pM});
354 }
355
356 /**
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.
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.
361 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
362 *
363 */
364 public boolean forOneArbitraryMatch(final Member pM, final Consumer<? super MemberIsItsOwnParent.Match> processor) {
365 return rawForOneArbitraryMatch(new Object[]{pM}, processor);
366 }
367
368 /**
369 * Returns a new (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.
372 * @param pM the fixed value of pattern parameter m, or null if not bound.
373 * @return the (partial) match object.
374 *
375 */
376 public MemberIsItsOwnParent.Match newMatch(final Member pM) {
377 return MemberIsItsOwnParent.Match.newMatch(pM);
378 }
379
380 /**
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
383 *
384 */
385 protected Stream<Member> rawStreamAllValuesOfm(final Object[] parameters) {
386 return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast);
387 }
388
389 /**
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
392 *
393 */
394 public Set<Member> getAllValuesOfm() {
395 return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet());
396 }
397
398 /**
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
401 *
402 */
403 public Stream<Member> streamAllValuesOfm() {
404 return rawStreamAllValuesOfm(emptyArray());
405 }
406
407 @Override
408 protected MemberIsItsOwnParent.Match tupleToMatch(final Tuple t) {
409 try {
410 return MemberIsItsOwnParent.Match.newMatch((Member) t.get(POSITION_M));
411 } catch(ClassCastException e) {
412 LOGGER.error("Element(s) in tuple not properly typed!",e);
413 return null;
414 }
415 }
416
417 @Override
418 protected MemberIsItsOwnParent.Match arrayToMatch(final Object[] match) {
419 try {
420 return MemberIsItsOwnParent.Match.newMatch((Member) match[POSITION_M]);
421 } catch(ClassCastException e) {
422 LOGGER.error("Element(s) in array not properly typed!",e);
423 return null;
424 }
425 }
426
427 @Override
428 protected MemberIsItsOwnParent.Match arrayToMatchMutable(final Object[] match) {
429 try {
430 return MemberIsItsOwnParent.Match.newMutableMatch((Member) match[POSITION_M]);
431 } catch(ClassCastException e) {
432 LOGGER.error("Element(s) in array not properly typed!",e);
433 return null;
434 }
435 }
436
437 /**
438 * @return the singleton instance of the query specification of this pattern
439 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
440 *
441 */
442 public static IQuerySpecification<MemberIsItsOwnParent.Matcher> querySpecification() {
443 return MemberIsItsOwnParent.instance();
444 }
445 }
446
447 private MemberIsItsOwnParent() {
448 super(GeneratedPQuery.INSTANCE);
449 }
450
451 /**
452 * @return the singleton instance of the query specification
453 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
454 *
455 */
456 public static MemberIsItsOwnParent instance() {
457 try{
458 return LazyHolder.INSTANCE;
459 } catch (ExceptionInInitializerError err) {
460 throw processInitializerError(err);
461 }
462 }
463
464 @Override
465 protected MemberIsItsOwnParent.Matcher instantiate(final ViatraQueryEngine engine) {
466 return MemberIsItsOwnParent.Matcher.on(engine);
467 }
468
469 @Override
470 public MemberIsItsOwnParent.Matcher instantiate() {
471 return MemberIsItsOwnParent.Matcher.create();
472 }
473
474 @Override
475 public MemberIsItsOwnParent.Match newEmptyMatch() {
476 return MemberIsItsOwnParent.Match.newEmptyMatch();
477 }
478
479 @Override
480 public MemberIsItsOwnParent.Match newMatch(final Object... parameters) {
481 return MemberIsItsOwnParent.Match.newMatch((familytree.Member) parameters[0]);
482 }
483
484 /**
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,
487 * but rather at the first call to {@link MemberIsItsOwnParent#instance()}.
488 *
489 * <p> This workaround is required e.g. to support recursion.
490 *
491 */
492 private static class LazyHolder {
493 private static final MemberIsItsOwnParent INSTANCE = new MemberIsItsOwnParent();
494
495 /**
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.
498 *
499 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
500 *
501 */
502 private static final Object STATIC_INITIALIZER = ensureInitialized();
503
504 public static Object ensureInitialized() {
505 INSTANCE.ensureInitializedInternal();
506 return null;
507 }
508 }
509
510 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
511 private static final MemberIsItsOwnParent.GeneratedPQuery INSTANCE = new GeneratedPQuery();
512
513 private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
514
515 private final List<PParameter> parameters = Arrays.asList(parameter_m);
516
517 private GeneratedPQuery() {
518 super(PVisibility.PUBLIC);
519 }
520
521 @Override
522 public String getFullyQualifiedName() {
523 return "queries.memberIsItsOwnParent";
524 }
525
526 @Override
527 public List<String> getParameterNames() {
528 return Arrays.asList("m");
529 }
530
531 @Override
532 public List<PParameter> getParameters() {
533 return parameters;
534 }
535
536 @Override
537 public Set<PBody> doGetContainedBodies() {
538 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
539 Set<PBody> bodies = new LinkedHashSet<>();
540 {
541 PBody body = new PBody(this);
542 PVariable var_m = body.getOrCreateVariableByName("m");
543 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
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")));
546 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
547 new ExportedParameter(body, var_m, parameter_m)
548 ));
549 // FamilyTree.members(_, m)
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}");
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")));
554 new Equality(body, var__virtual_0_, var_m);
555 // Member.parents(m, p)
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}");
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")));
560 new Equality(body, var__virtual_1_, var_p);
561 // m == p
562 new Equality(body, var_m, var_p);
563 bodies.add(body);
564 }
565 {
566 PAnnotation annotation = new PAnnotation("Constraint");
567 annotation.addAttribute("message", "memberIsItsOwnParent");
568 annotation.addAttribute("severity", "error");
569 annotation.addAttribute("key", Arrays.asList(new Object[] {
570 new ParameterReference("m")
571 }));
572 addAnnotation(annotation);
573 }
574 return bodies;
575 }
576 }
577}
diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/NegativeAge.java b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/NegativeAge.java
deleted file mode 100644
index 44ae6496..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/NegativeAge.java
+++ /dev/null
@@ -1,593 +0,0 @@
1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */
4package queries;
5
6import familytree.Member;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.emf.ecore.EDataType;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
29import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
30import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
31import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator;
32import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider;
33import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
34import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
36import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation;
40import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
43import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
45import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
46import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
47
48/**
49 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
50 *
51 * <p>Original source:
52 * <code><pre>
53 * {@literal @}Constraint(message="negativeAge", severity="error",key={m})
54 * pattern negativeAge(m: Member) {
55 * Member.age(m,mage);
56 * check(mage{@literal <}0);
57 * }
58 * </pre></code>
59 *
60 * @see Matcher
61 * @see Match
62 *
63 */
64@SuppressWarnings("all")
65public final class NegativeAge extends BaseGeneratedEMFQuerySpecification<NegativeAge.Matcher> {
66 /**
67 * Pattern-specific match representation of the queries.negativeAge pattern,
68 * to be used in conjunction with {@link Matcher}.
69 *
70 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
71 * Each instance is a (possibly partial) substitution of pattern parameters,
72 * usable to represent a match of the pattern in the result of a query,
73 * or to specify the bound (fixed) input parameters when issuing a query.
74 *
75 * @see Matcher
76 *
77 */
78 public static abstract class Match extends BasePatternMatch {
79 private Member fM;
80
81 private static List<String> parameterNames = makeImmutableList("m");
82
83 private Match(final Member pM) {
84 this.fM = pM;
85 }
86
87 @Override
88 public Object get(final String parameterName) {
89 switch(parameterName) {
90 case "m": return this.fM;
91 default: return null;
92 }
93 }
94
95 @Override
96 public Object get(final int index) {
97 switch(index) {
98 case 0: return this.fM;
99 default: return null;
100 }
101 }
102
103 public Member getM() {
104 return this.fM;
105 }
106
107 @Override
108 public boolean set(final String parameterName, final Object newValue) {
109 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
110 if ("m".equals(parameterName) ) {
111 this.fM = (Member) newValue;
112 return true;
113 }
114 return false;
115 }
116
117 public void setM(final Member pM) {
118 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
119 this.fM = pM;
120 }
121
122 @Override
123 public String patternName() {
124 return "queries.negativeAge";
125 }
126
127 @Override
128 public List<String> parameterNames() {
129 return NegativeAge.Match.parameterNames;
130 }
131
132 @Override
133 public Object[] toArray() {
134 return new Object[]{fM};
135 }
136
137 @Override
138 public NegativeAge.Match toImmutable() {
139 return isMutable() ? newMatch(fM) : this;
140 }
141
142 @Override
143 public String prettyPrint() {
144 StringBuilder result = new StringBuilder();
145 result.append("\"m\"=" + prettyPrintValue(fM));
146 return result.toString();
147 }
148
149 @Override
150 public int hashCode() {
151 return Objects.hash(fM);
152 }
153
154 @Override
155 public boolean equals(final Object obj) {
156 if (this == obj)
157 return true;
158 if (obj == null) {
159 return false;
160 }
161 if ((obj instanceof NegativeAge.Match)) {
162 NegativeAge.Match other = (NegativeAge.Match) obj;
163 return Objects.equals(fM, other.fM);
164 } else {
165 // this should be infrequent
166 if (!(obj instanceof IPatternMatch)) {
167 return false;
168 }
169 IPatternMatch otherSig = (IPatternMatch) obj;
170 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
171 }
172 }
173
174 @Override
175 public NegativeAge specification() {
176 return NegativeAge.instance();
177 }
178
179 /**
180 * Returns an empty, mutable match.
181 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
182 *
183 * @return the empty match.
184 *
185 */
186 public static NegativeAge.Match newEmptyMatch() {
187 return new Mutable(null);
188 }
189
190 /**
191 * Returns a mutable (partial) match.
192 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
193 *
194 * @param pM the fixed value of pattern parameter m, or null if not bound.
195 * @return the new, mutable (partial) match object.
196 *
197 */
198 public static NegativeAge.Match newMutableMatch(final Member pM) {
199 return new Mutable(pM);
200 }
201
202 /**
203 * Returns a new (partial) match.
204 * This can be used e.g. to call the matcher with a partial match.
205 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
206 * @param pM the fixed value of pattern parameter m, or null if not bound.
207 * @return the (partial) match object.
208 *
209 */
210 public static NegativeAge.Match newMatch(final Member pM) {
211 return new Immutable(pM);
212 }
213
214 private static final class Mutable extends NegativeAge.Match {
215 Mutable(final Member pM) {
216 super(pM);
217 }
218
219 @Override
220 public boolean isMutable() {
221 return true;
222 }
223 }
224
225 private static final class Immutable extends NegativeAge.Match {
226 Immutable(final Member pM) {
227 super(pM);
228 }
229
230 @Override
231 public boolean isMutable() {
232 return false;
233 }
234 }
235 }
236
237 /**
238 * Generated pattern matcher API of the queries.negativeAge pattern,
239 * providing pattern-specific query methods.
240 *
241 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
242 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
243 *
244 * <p>Matches of the pattern will be represented as {@link Match}.
245 *
246 * <p>Original source:
247 * <code><pre>
248 * {@literal @}Constraint(message="negativeAge", severity="error",key={m})
249 * pattern negativeAge(m: Member) {
250 * Member.age(m,mage);
251 * check(mage{@literal <}0);
252 * }
253 * </pre></code>
254 *
255 * @see Match
256 * @see NegativeAge
257 *
258 */
259 public static class Matcher extends BaseMatcher<NegativeAge.Match> {
260 /**
261 * Initializes the pattern matcher within an existing VIATRA Query engine.
262 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
263 *
264 * @param engine the existing VIATRA Query engine in which this matcher will be created.
265 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
266 *
267 */
268 public static NegativeAge.Matcher on(final ViatraQueryEngine engine) {
269 // check if matcher already exists
270 Matcher matcher = engine.getExistingMatcher(querySpecification());
271 if (matcher == null) {
272 matcher = (Matcher)engine.getMatcher(querySpecification());
273 }
274 return matcher;
275 }
276
277 /**
278 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
279 * @return an initialized matcher
280 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
281 *
282 */
283 public static NegativeAge.Matcher create() {
284 return new Matcher();
285 }
286
287 private static final int POSITION_M = 0;
288
289 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NegativeAge.Matcher.class);
290
291 /**
292 * Initializes the pattern matcher within an existing VIATRA Query engine.
293 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
294 *
295 * @param engine the existing VIATRA Query engine in which this matcher will be created.
296 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
297 *
298 */
299 private Matcher() {
300 super(querySpecification());
301 }
302
303 /**
304 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
305 * @param pM the fixed value of pattern parameter m, or null if not bound.
306 * @return matches represented as a Match object.
307 *
308 */
309 public Collection<NegativeAge.Match> getAllMatches(final Member pM) {
310 return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet());
311 }
312
313 /**
314 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
315 * </p>
316 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
317 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
318 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
319 * @param pM the fixed value of pattern parameter m, or null if not bound.
320 * @return a stream of matches represented as a Match object.
321 *
322 */
323 public Stream<NegativeAge.Match> streamAllMatches(final Member pM) {
324 return rawStreamAllMatches(new Object[]{pM});
325 }
326
327 /**
328 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
329 * Neither determinism nor randomness of selection is guaranteed.
330 * @param pM the fixed value of pattern parameter m, or null if not bound.
331 * @return a match represented as a Match object, or null if no match is found.
332 *
333 */
334 public Optional<NegativeAge.Match> getOneArbitraryMatch(final Member pM) {
335 return rawGetOneArbitraryMatch(new Object[]{pM});
336 }
337
338 /**
339 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
340 * under any possible substitution of the unspecified parameters (if any).
341 * @param pM the fixed value of pattern parameter m, or null if not bound.
342 * @return true if the input is a valid (partial) match of the pattern.
343 *
344 */
345 public boolean hasMatch(final Member pM) {
346 return rawHasMatch(new Object[]{pM});
347 }
348
349 /**
350 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
351 * @param pM the fixed value of pattern parameter m, or null if not bound.
352 * @return the number of pattern matches found.
353 *
354 */
355 public int countMatches(final Member pM) {
356 return rawCountMatches(new Object[]{pM});
357 }
358
359 /**
360 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
361 * Neither determinism nor randomness of selection is guaranteed.
362 * @param pM the fixed value of pattern parameter m, or null if not bound.
363 * @param processor the action that will process the selected match.
364 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
365 *
366 */
367 public boolean forOneArbitraryMatch(final Member pM, final Consumer<? super NegativeAge.Match> processor) {
368 return rawForOneArbitraryMatch(new Object[]{pM}, processor);
369 }
370
371 /**
372 * Returns a new (partial) match.
373 * This can be used e.g. to call the matcher with a partial match.
374 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
375 * @param pM the fixed value of pattern parameter m, or null if not bound.
376 * @return the (partial) match object.
377 *
378 */
379 public NegativeAge.Match newMatch(final Member pM) {
380 return NegativeAge.Match.newMatch(pM);
381 }
382
383 /**
384 * Retrieve the set of values that occur in matches for m.
385 * @return the Set of all values or empty set if there are no matches
386 *
387 */
388 protected Stream<Member> rawStreamAllValuesOfm(final Object[] parameters) {
389 return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast);
390 }
391
392 /**
393 * Retrieve the set of values that occur in matches for m.
394 * @return the Set of all values or empty set if there are no matches
395 *
396 */
397 public Set<Member> getAllValuesOfm() {
398 return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet());
399 }
400
401 /**
402 * Retrieve the set of values that occur in matches for m.
403 * @return the Set of all values or empty set if there are no matches
404 *
405 */
406 public Stream<Member> streamAllValuesOfm() {
407 return rawStreamAllValuesOfm(emptyArray());
408 }
409
410 @Override
411 protected NegativeAge.Match tupleToMatch(final Tuple t) {
412 try {
413 return NegativeAge.Match.newMatch((Member) t.get(POSITION_M));
414 } catch(ClassCastException e) {
415 LOGGER.error("Element(s) in tuple not properly typed!",e);
416 return null;
417 }
418 }
419
420 @Override
421 protected NegativeAge.Match arrayToMatch(final Object[] match) {
422 try {
423 return NegativeAge.Match.newMatch((Member) match[POSITION_M]);
424 } catch(ClassCastException e) {
425 LOGGER.error("Element(s) in array not properly typed!",e);
426 return null;
427 }
428 }
429
430 @Override
431 protected NegativeAge.Match arrayToMatchMutable(final Object[] match) {
432 try {
433 return NegativeAge.Match.newMutableMatch((Member) match[POSITION_M]);
434 } catch(ClassCastException e) {
435 LOGGER.error("Element(s) in array not properly typed!",e);
436 return null;
437 }
438 }
439
440 /**
441 * @return the singleton instance of the query specification of this pattern
442 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
443 *
444 */
445 public static IQuerySpecification<NegativeAge.Matcher> querySpecification() {
446 return NegativeAge.instance();
447 }
448 }
449
450 private NegativeAge() {
451 super(GeneratedPQuery.INSTANCE);
452 }
453
454 /**
455 * @return the singleton instance of the query specification
456 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
457 *
458 */
459 public static NegativeAge instance() {
460 try{
461 return LazyHolder.INSTANCE;
462 } catch (ExceptionInInitializerError err) {
463 throw processInitializerError(err);
464 }
465 }
466
467 @Override
468 protected NegativeAge.Matcher instantiate(final ViatraQueryEngine engine) {
469 return NegativeAge.Matcher.on(engine);
470 }
471
472 @Override
473 public NegativeAge.Matcher instantiate() {
474 return NegativeAge.Matcher.create();
475 }
476
477 @Override
478 public NegativeAge.Match newEmptyMatch() {
479 return NegativeAge.Match.newEmptyMatch();
480 }
481
482 @Override
483 public NegativeAge.Match newMatch(final Object... parameters) {
484 return NegativeAge.Match.newMatch((familytree.Member) parameters[0]);
485 }
486
487 /**
488 * Inner class allowing the singleton instance of {@link NegativeAge} to be created
489 * <b>not</b> at the class load time of the outer class,
490 * but rather at the first call to {@link NegativeAge#instance()}.
491 *
492 * <p> This workaround is required e.g. to support recursion.
493 *
494 */
495 private static class LazyHolder {
496 private static final NegativeAge INSTANCE = new NegativeAge();
497
498 /**
499 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
500 * This initialization order is required to support indirect recursion.
501 *
502 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
503 *
504 */
505 private static final Object STATIC_INITIALIZER = ensureInitialized();
506
507 public static Object ensureInitialized() {
508 INSTANCE.ensureInitializedInternal();
509 return null;
510 }
511 }
512
513 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
514 private static final NegativeAge.GeneratedPQuery INSTANCE = new GeneratedPQuery();
515
516 private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
517
518 private final List<PParameter> parameters = Arrays.asList(parameter_m);
519
520 private GeneratedPQuery() {
521 super(PVisibility.PUBLIC);
522 }
523
524 @Override
525 public String getFullyQualifiedName() {
526 return "queries.negativeAge";
527 }
528
529 @Override
530 public List<String> getParameterNames() {
531 return Arrays.asList("m");
532 }
533
534 @Override
535 public List<PParameter> getParameters() {
536 return parameters;
537 }
538
539 @Override
540 public Set<PBody> doGetContainedBodies() {
541 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
542 Set<PBody> bodies = new LinkedHashSet<>();
543 {
544 PBody body = new PBody(this);
545 PVariable var_m = body.getOrCreateVariableByName("m");
546 PVariable var_mage = body.getOrCreateVariableByName("mage");
547 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
548 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
549 new ExportedParameter(body, var_m, parameter_m)
550 ));
551 // Member.age(m,mage)
552 new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
553 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
554 new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "age")));
555 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt")));
556 new Equality(body, var__virtual_0_, var_mage);
557 // check(mage<0)
558 new ExpressionEvaluation(body, new IExpressionEvaluator() {
559
560 @Override
561 public String getShortDescription() {
562 return "Expression evaluation from pattern negativeAge";
563 }
564
565 @Override
566 public Iterable<String> getInputParameterNames() {
567 return Arrays.asList("mage");}
568
569 @Override
570 public Object evaluateExpression(IValueProvider provider) throws Exception {
571 Integer mage = (Integer) provider.getValue("mage");
572 return evaluateExpression_1_1(mage);
573 }
574 }, null);
575 bodies.add(body);
576 }
577 {
578 PAnnotation annotation = new PAnnotation("Constraint");
579 annotation.addAttribute("message", "negativeAge");
580 annotation.addAttribute("severity", "error");
581 annotation.addAttribute("key", Arrays.asList(new Object[] {
582 new ParameterReference("m")
583 }));
584 addAnnotation(annotation);
585 }
586 return bodies;
587 }
588 }
589
590 private static boolean evaluateExpression_1_1(final Integer mage) {
591 return ((mage).intValue() < 0);
592 }
593}
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
deleted file mode 100644
index 5ed9df5e..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/ParentTooYoung.java
+++ /dev/null
@@ -1,775 +0,0 @@
1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */
4package queries;
5
6import familytree.Member;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.emf.ecore.EDataType;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
29import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
30import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
31import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator;
32import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider;
33import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
34import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
36import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation;
40import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
43import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
45import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
46import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
47
48/**
49 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
50 *
51 * <p>Original source:
52 * <code><pre>
53 * {@literal @}Constraint(message="parentTooYoung", severity="error", key={c, p})
54 * pattern parentTooYoung(c: Member, p: Member) = {
55 * FamilyTree.members(_, c);
56 * Member.parents(c, p);
57 * Member.age(c, cAge);
58 * Member.age(p, pAge);
59 * check (pAge {@literal <}= (cAge + 12));
60 * }
61 * </pre></code>
62 *
63 * @see Matcher
64 * @see Match
65 *
66 */
67@SuppressWarnings("all")
68public final class ParentTooYoung extends BaseGeneratedEMFQuerySpecification<ParentTooYoung.Matcher> {
69 /**
70 * Pattern-specific match representation of the queries.parentTooYoung pattern,
71 * to be used in conjunction with {@link Matcher}.
72 *
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,
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.
77 *
78 * @see Matcher
79 *
80 */
81 public static abstract class Match extends BasePatternMatch {
82 private Member fC;
83
84 private Member fP;
85
86 private static List<String> parameterNames = makeImmutableList("c", "p");
87
88 private Match(final Member pC, final Member pP) {
89 this.fC = pC;
90 this.fP = pP;
91 }
92
93 @Override
94 public Object get(final String parameterName) {
95 switch(parameterName) {
96 case "c": return this.fC;
97 case "p": return this.fP;
98 default: return null;
99 }
100 }
101
102 @Override
103 public Object get(final int index) {
104 switch(index) {
105 case 0: return this.fC;
106 case 1: return this.fP;
107 default: return null;
108 }
109 }
110
111 public Member getC() {
112 return this.fC;
113 }
114
115 public Member getP() {
116 return this.fP;
117 }
118
119 @Override
120 public boolean set(final String parameterName, final Object newValue) {
121 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
122 if ("c".equals(parameterName) ) {
123 this.fC = (Member) newValue;
124 return true;
125 }
126 if ("p".equals(parameterName) ) {
127 this.fP = (Member) newValue;
128 return true;
129 }
130 return false;
131 }
132
133 public void setC(final Member pC) {
134 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
135 this.fC = pC;
136 }
137
138 public void setP(final Member pP) {
139 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
140 this.fP = pP;
141 }
142
143 @Override
144 public String patternName() {
145 return "queries.parentTooYoung";
146 }
147
148 @Override
149 public List<String> parameterNames() {
150 return ParentTooYoung.Match.parameterNames;
151 }
152
153 @Override
154 public Object[] toArray() {
155 return new Object[]{fC, fP};
156 }
157
158 @Override
159 public ParentTooYoung.Match toImmutable() {
160 return isMutable() ? newMatch(fC, fP) : this;
161 }
162
163 @Override
164 public String prettyPrint() {
165 StringBuilder result = new StringBuilder();
166 result.append("\"c\"=" + prettyPrintValue(fC) + ", ");
167 result.append("\"p\"=" + prettyPrintValue(fP));
168 return result.toString();
169 }
170
171 @Override
172 public int hashCode() {
173 return Objects.hash(fC, fP);
174 }
175
176 @Override
177 public boolean equals(final Object obj) {
178 if (this == obj)
179 return true;
180 if (obj == null) {
181 return false;
182 }
183 if ((obj instanceof ParentTooYoung.Match)) {
184 ParentTooYoung.Match other = (ParentTooYoung.Match) obj;
185 return Objects.equals(fC, other.fC) && Objects.equals(fP, other.fP);
186 } else {
187 // this should be infrequent
188 if (!(obj instanceof IPatternMatch)) {
189 return false;
190 }
191 IPatternMatch otherSig = (IPatternMatch) obj;
192 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
193 }
194 }
195
196 @Override
197 public ParentTooYoung specification() {
198 return ParentTooYoung.instance();
199 }
200
201 /**
202 * Returns an empty, mutable match.
203 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
204 *
205 * @return the empty match.
206 *
207 */
208 public static ParentTooYoung.Match newEmptyMatch() {
209 return new Mutable(null, null);
210 }
211
212 /**
213 * Returns a mutable (partial) match.
214 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
215 *
216 * @param pC the fixed value of pattern parameter c, 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.
219 *
220 */
221 public static ParentTooYoung.Match newMutableMatch(final Member pC, final Member pP) {
222 return new Mutable(pC, pP);
223 }
224
225 /**
226 * Returns a new (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.
229 * @param pC the fixed value of pattern parameter c, 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.
232 *
233 */
234 public static ParentTooYoung.Match newMatch(final Member pC, final Member pP) {
235 return new Immutable(pC, pP);
236 }
237
238 private static final class Mutable extends ParentTooYoung.Match {
239 Mutable(final Member pC, final Member pP) {
240 super(pC, pP);
241 }
242
243 @Override
244 public boolean isMutable() {
245 return true;
246 }
247 }
248
249 private static final class Immutable extends ParentTooYoung.Match {
250 Immutable(final Member pC, final Member pP) {
251 super(pC, pP);
252 }
253
254 @Override
255 public boolean isMutable() {
256 return false;
257 }
258 }
259 }
260
261 /**
262 * Generated pattern matcher API of the queries.parentTooYoung pattern,
263 * providing pattern-specific query methods.
264 *
265 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
266 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
267 *
268 * <p>Matches of the pattern will be represented as {@link Match}.
269 *
270 * <p>Original source:
271 * <code><pre>
272 * {@literal @}Constraint(message="parentTooYoung", severity="error", key={c, p})
273 * pattern parentTooYoung(c: Member, p: Member) = {
274 * FamilyTree.members(_, c);
275 * Member.parents(c, p);
276 * Member.age(c, cAge);
277 * Member.age(p, pAge);
278 * check (pAge {@literal <}= (cAge + 12));
279 * }
280 * </pre></code>
281 *
282 * @see Match
283 * @see ParentTooYoung
284 *
285 */
286 public static class Matcher extends BaseMatcher<ParentTooYoung.Match> {
287 /**
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.
290 *
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
293 *
294 */
295 public static ParentTooYoung.Matcher on(final ViatraQueryEngine engine) {
296 // check if matcher already exists
297 Matcher matcher = engine.getExistingMatcher(querySpecification());
298 if (matcher == null) {
299 matcher = (Matcher)engine.getMatcher(querySpecification());
300 }
301 return matcher;
302 }
303
304 /**
305 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
306 * @return an initialized matcher
307 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
308 *
309 */
310 public static ParentTooYoung.Matcher create() {
311 return new Matcher();
312 }
313
314 private static final int POSITION_C = 0;
315
316 private static final int POSITION_P = 1;
317
318 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ParentTooYoung.Matcher.class);
319
320 /**
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.
323 *
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
326 *
327 */
328 private Matcher() {
329 super(querySpecification());
330 }
331
332 /**
333 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
334 * @param pC the fixed value of pattern parameter c, 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.
337 *
338 */
339 public Collection<ParentTooYoung.Match> getAllMatches(final Member pC, final Member pP) {
340 return rawStreamAllMatches(new Object[]{pC, pP}).collect(Collectors.toSet());
341 }
342
343 /**
344 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
345 * </p>
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>.
348 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
349 * @param pC the fixed value of pattern parameter c, 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.
352 *
353 */
354 public Stream<ParentTooYoung.Match> streamAllMatches(final Member pC, final Member pP) {
355 return rawStreamAllMatches(new Object[]{pC, pP});
356 }
357
358 /**
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.
361 * @param pC the fixed value of pattern parameter c, 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.
364 *
365 */
366 public Optional<ParentTooYoung.Match> getOneArbitraryMatch(final Member pC, final Member pP) {
367 return rawGetOneArbitraryMatch(new Object[]{pC, pP});
368 }
369
370 /**
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).
373 * @param pC the fixed value of pattern parameter c, 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.
376 *
377 */
378 public boolean hasMatch(final Member pC, final Member pP) {
379 return rawHasMatch(new Object[]{pC, pP});
380 }
381
382 /**
383 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
384 * @param pC the fixed value of pattern parameter c, 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.
387 *
388 */
389 public int countMatches(final Member pC, final Member pP) {
390 return rawCountMatches(new Object[]{pC, pP});
391 }
392
393 /**
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.
396 * @param pC the fixed value of pattern parameter c, 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.
399 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
400 *
401 */
402 public boolean forOneArbitraryMatch(final Member pC, final Member pP, final Consumer<? super ParentTooYoung.Match> processor) {
403 return rawForOneArbitraryMatch(new Object[]{pC, pP}, processor);
404 }
405
406 /**
407 * Returns a new (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.
410 * @param pC the fixed value of pattern parameter c, 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.
413 *
414 */
415 public ParentTooYoung.Match newMatch(final Member pC, final Member pP) {
416 return ParentTooYoung.Match.newMatch(pC, pP);
417 }
418
419 /**
420 * Retrieve the set of values that occur in matches for c.
421 * @return the Set of all values or empty set if there are no matches
422 *
423 */
424 protected Stream<Member> rawStreamAllValuesOfc(final Object[] parameters) {
425 return rawStreamAllValues(POSITION_C, parameters).map(Member.class::cast);
426 }
427
428 /**
429 * Retrieve the set of values that occur in matches for c.
430 * @return the Set of all values or empty set if there are no matches
431 *
432 */
433 public Set<Member> getAllValuesOfc() {
434 return rawStreamAllValuesOfc(emptyArray()).collect(Collectors.toSet());
435 }
436
437 /**
438 * Retrieve the set of values that occur in matches for c.
439 * @return the Set of all values or empty set if there are no matches
440 *
441 */
442 public Stream<Member> streamAllValuesOfc() {
443 return rawStreamAllValuesOfc(emptyArray());
444 }
445
446 /**
447 * Retrieve the set of values that occur in matches for c.
448 * </p>
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>.
451 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
452 *
453 * @return the Stream of all values or empty set if there are no matches
454 *
455 */
456 public Stream<Member> streamAllValuesOfc(final ParentTooYoung.Match partialMatch) {
457 return rawStreamAllValuesOfc(partialMatch.toArray());
458 }
459
460 /**
461 * Retrieve the set of values that occur in matches for c.
462 * </p>
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>.
465 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
466 *
467 * @return the Stream of all values or empty set if there are no matches
468 *
469 */
470 public Stream<Member> streamAllValuesOfc(final Member pP) {
471 return rawStreamAllValuesOfc(new Object[]{null, pP});
472 }
473
474 /**
475 * Retrieve the set of values that occur in matches for c.
476 * @return the Set of all values or empty set if there are no matches
477 *
478 */
479 public Set<Member> getAllValuesOfc(final ParentTooYoung.Match partialMatch) {
480 return rawStreamAllValuesOfc(partialMatch.toArray()).collect(Collectors.toSet());
481 }
482
483 /**
484 * Retrieve the set of values that occur in matches for c.
485 * @return the Set of all values or empty set if there are no matches
486 *
487 */
488 public Set<Member> getAllValuesOfc(final Member pP) {
489 return rawStreamAllValuesOfc(new Object[]{null, pP}).collect(Collectors.toSet());
490 }
491
492 /**
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
495 *
496 */
497 protected Stream<Member> rawStreamAllValuesOfp(final Object[] parameters) {
498 return rawStreamAllValues(POSITION_P, parameters).map(Member.class::cast);
499 }
500
501 /**
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
504 *
505 */
506 public Set<Member> getAllValuesOfp() {
507 return rawStreamAllValuesOfp(emptyArray()).collect(Collectors.toSet());
508 }
509
510 /**
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
513 *
514 */
515 public Stream<Member> streamAllValuesOfp() {
516 return rawStreamAllValuesOfp(emptyArray());
517 }
518
519 /**
520 * Retrieve the set of values that occur in matches for p.
521 * </p>
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>.
524 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
525 *
526 * @return the Stream of all values or empty set if there are no matches
527 *
528 */
529 public Stream<Member> streamAllValuesOfp(final ParentTooYoung.Match partialMatch) {
530 return rawStreamAllValuesOfp(partialMatch.toArray());
531 }
532
533 /**
534 * Retrieve the set of values that occur in matches for p.
535 * </p>
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>.
538 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
539 *
540 * @return the Stream of all values or empty set if there are no matches
541 *
542 */
543 public Stream<Member> streamAllValuesOfp(final Member pC) {
544 return rawStreamAllValuesOfp(new Object[]{pC, null});
545 }
546
547 /**
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
550 *
551 */
552 public Set<Member> getAllValuesOfp(final ParentTooYoung.Match partialMatch) {
553 return rawStreamAllValuesOfp(partialMatch.toArray()).collect(Collectors.toSet());
554 }
555
556 /**
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
559 *
560 */
561 public Set<Member> getAllValuesOfp(final Member pC) {
562 return rawStreamAllValuesOfp(new Object[]{pC, null}).collect(Collectors.toSet());
563 }
564
565 @Override
566 protected ParentTooYoung.Match tupleToMatch(final Tuple t) {
567 try {
568 return ParentTooYoung.Match.newMatch((Member) t.get(POSITION_C), (Member) t.get(POSITION_P));
569 } catch(ClassCastException e) {
570 LOGGER.error("Element(s) in tuple not properly typed!",e);
571 return null;
572 }
573 }
574
575 @Override
576 protected ParentTooYoung.Match arrayToMatch(final Object[] match) {
577 try {
578 return ParentTooYoung.Match.newMatch((Member) match[POSITION_C], (Member) match[POSITION_P]);
579 } catch(ClassCastException e) {
580 LOGGER.error("Element(s) in array not properly typed!",e);
581 return null;
582 }
583 }
584
585 @Override
586 protected ParentTooYoung.Match arrayToMatchMutable(final Object[] match) {
587 try {
588 return ParentTooYoung.Match.newMutableMatch((Member) match[POSITION_C], (Member) match[POSITION_P]);
589 } catch(ClassCastException e) {
590 LOGGER.error("Element(s) in array not properly typed!",e);
591 return null;
592 }
593 }
594
595 /**
596 * @return the singleton instance of the query specification of this pattern
597 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
598 *
599 */
600 public static IQuerySpecification<ParentTooYoung.Matcher> querySpecification() {
601 return ParentTooYoung.instance();
602 }
603 }
604
605 private ParentTooYoung() {
606 super(GeneratedPQuery.INSTANCE);
607 }
608
609 /**
610 * @return the singleton instance of the query specification
611 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
612 *
613 */
614 public static ParentTooYoung instance() {
615 try{
616 return LazyHolder.INSTANCE;
617 } catch (ExceptionInInitializerError err) {
618 throw processInitializerError(err);
619 }
620 }
621
622 @Override
623 protected ParentTooYoung.Matcher instantiate(final ViatraQueryEngine engine) {
624 return ParentTooYoung.Matcher.on(engine);
625 }
626
627 @Override
628 public ParentTooYoung.Matcher instantiate() {
629 return ParentTooYoung.Matcher.create();
630 }
631
632 @Override
633 public ParentTooYoung.Match newEmptyMatch() {
634 return ParentTooYoung.Match.newEmptyMatch();
635 }
636
637 @Override
638 public ParentTooYoung.Match newMatch(final Object... parameters) {
639 return ParentTooYoung.Match.newMatch((familytree.Member) parameters[0], (familytree.Member) parameters[1]);
640 }
641
642 /**
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,
645 * but rather at the first call to {@link ParentTooYoung#instance()}.
646 *
647 * <p> This workaround is required e.g. to support recursion.
648 *
649 */
650 private static class LazyHolder {
651 private static final ParentTooYoung INSTANCE = new ParentTooYoung();
652
653 /**
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.
656 *
657 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
658 *
659 */
660 private static final Object STATIC_INITIALIZER = ensureInitialized();
661
662 public static Object ensureInitialized() {
663 INSTANCE.ensureInitializedInternal();
664 return null;
665 }
666 }
667
668 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
669 private static final ParentTooYoung.GeneratedPQuery INSTANCE = new GeneratedPQuery();
670
671 private final PParameter parameter_c = new PParameter("c", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
672
673 private final PParameter parameter_p = new PParameter("p", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
674
675 private final List<PParameter> parameters = Arrays.asList(parameter_c, parameter_p);
676
677 private GeneratedPQuery() {
678 super(PVisibility.PUBLIC);
679 }
680
681 @Override
682 public String getFullyQualifiedName() {
683 return "queries.parentTooYoung";
684 }
685
686 @Override
687 public List<String> getParameterNames() {
688 return Arrays.asList("c","p");
689 }
690
691 @Override
692 public List<PParameter> getParameters() {
693 return parameters;
694 }
695
696 @Override
697 public Set<PBody> doGetContainedBodies() {
698 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
699 Set<PBody> bodies = new LinkedHashSet<>();
700 {
701 PBody body = new PBody(this);
702 PVariable var_c = body.getOrCreateVariableByName("c");
703 PVariable var_p = body.getOrCreateVariableByName("p");
704 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
705 PVariable var_cAge = body.getOrCreateVariableByName("cAge");
706 PVariable var_pAge = body.getOrCreateVariableByName("pAge");
707 new TypeConstraint(body, Tuples.flatTupleOf(var_c), 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(
710 new ExportedParameter(body, var_c, parameter_c),
711 new ExportedParameter(body, var_p, parameter_p)
712 ));
713 // FamilyTree.members(_, c)
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}");
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")));
718 new Equality(body, var__virtual_0_, var_c);
719 // Member.parents(c, p)
720 new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
721 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
722 new TypeConstraint(body, Tuples.flatTupleOf(var_c, 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")));
724 new Equality(body, var__virtual_1_, var_p);
725 // Member.age(c, cAge)
726 new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
727 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
728 new TypeConstraint(body, Tuples.flatTupleOf(var_c, 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")));
730 new Equality(body, var__virtual_2_, var_cAge);
731 // Member.age(p, pAge)
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}");
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")));
736 new Equality(body, var__virtual_3_, var_pAge);
737 // check (pAge <= (cAge + 12))
738 new ExpressionEvaluation(body, new IExpressionEvaluator() {
739
740 @Override
741 public String getShortDescription() {
742 return "Expression evaluation from pattern parentTooYoung";
743 }
744
745 @Override
746 public Iterable<String> getInputParameterNames() {
747 return Arrays.asList("cAge", "pAge");}
748
749 @Override
750 public Object evaluateExpression(IValueProvider provider) throws Exception {
751 Integer cAge = (Integer) provider.getValue("cAge");
752 Integer pAge = (Integer) provider.getValue("pAge");
753 return evaluateExpression_1_1(cAge, pAge);
754 }
755 }, null);
756 bodies.add(body);
757 }
758 {
759 PAnnotation annotation = new PAnnotation("Constraint");
760 annotation.addAttribute("message", "parentTooYoung");
761 annotation.addAttribute("severity", "error");
762 annotation.addAttribute("key", Arrays.asList(new Object[] {
763 new ParameterReference("c"),
764 new ParameterReference("p")
765 }));
766 addAnnotation(annotation);
767 }
768 return bodies;
769 }
770 }
771
772 private static boolean evaluateExpression_1_1(final Integer cAge, final Integer pAge) {
773 return ((pAge).intValue() <= ((cAge).intValue() + 12));
774 }
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
deleted file mode 100644
index 365939dd..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/TwoMembersHaveNoParent.java
+++ /dev/null
@@ -1,723 +0,0 @@
1/**
2 * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql
3 */
4package queries;
5
6import familytree.Member;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
28import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
30import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42import queries.MemberHasParent;
43
44/**
45 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
46 *
47 * <p>Original source:
48 * <code><pre>
49 * {@literal @}Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2})
50 * pattern twoMembersHaveNoParent(m1:Member, m2:Member) = {
51 * neg find memberHasParent(m1);
52 * neg find memberHasParent(m2);
53 * m1 != m2;
54 * }
55 * </pre></code>
56 *
57 * @see Matcher
58 * @see Match
59 *
60 */
61@SuppressWarnings("all")
62public final class TwoMembersHaveNoParent extends BaseGeneratedEMFQuerySpecification<TwoMembersHaveNoParent.Matcher> {
63 /**
64 * Pattern-specific match representation of the queries.twoMembersHaveNoParent pattern,
65 * to be used in conjunction with {@link Matcher}.
66 *
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,
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.
71 *
72 * @see Matcher
73 *
74 */
75 public static abstract class Match extends BasePatternMatch {
76 private Member fM1;
77
78 private Member fM2;
79
80 private static List<String> parameterNames = makeImmutableList("m1", "m2");
81
82 private Match(final Member pM1, final Member pM2) {
83 this.fM1 = pM1;
84 this.fM2 = pM2;
85 }
86
87 @Override
88 public Object get(final String parameterName) {
89 switch(parameterName) {
90 case "m1": return this.fM1;
91 case "m2": return this.fM2;
92 default: return null;
93 }
94 }
95
96 @Override
97 public Object get(final int index) {
98 switch(index) {
99 case 0: return this.fM1;
100 case 1: return this.fM2;
101 default: return null;
102 }
103 }
104
105 public Member getM1() {
106 return this.fM1;
107 }
108
109 public Member getM2() {
110 return this.fM2;
111 }
112
113 @Override
114 public boolean set(final String parameterName, final Object newValue) {
115 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
116 if ("m1".equals(parameterName) ) {
117 this.fM1 = (Member) newValue;
118 return true;
119 }
120 if ("m2".equals(parameterName) ) {
121 this.fM2 = (Member) newValue;
122 return true;
123 }
124 return false;
125 }
126
127 public void setM1(final Member pM1) {
128 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
129 this.fM1 = pM1;
130 }
131
132 public void setM2(final Member pM2) {
133 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
134 this.fM2 = pM2;
135 }
136
137 @Override
138 public String patternName() {
139 return "queries.twoMembersHaveNoParent";
140 }
141
142 @Override
143 public List<String> parameterNames() {
144 return TwoMembersHaveNoParent.Match.parameterNames;
145 }
146
147 @Override
148 public Object[] toArray() {
149 return new Object[]{fM1, fM2};
150 }
151
152 @Override
153 public TwoMembersHaveNoParent.Match toImmutable() {
154 return isMutable() ? newMatch(fM1, fM2) : this;
155 }
156
157 @Override
158 public String prettyPrint() {
159 StringBuilder result = new StringBuilder();
160 result.append("\"m1\"=" + prettyPrintValue(fM1) + ", ");
161 result.append("\"m2\"=" + prettyPrintValue(fM2));
162 return result.toString();
163 }
164
165 @Override
166 public int hashCode() {
167 return Objects.hash(fM1, fM2);
168 }
169
170 @Override
171 public boolean equals(final Object obj) {
172 if (this == obj)
173 return true;
174 if (obj == null) {
175 return false;
176 }
177 if ((obj instanceof TwoMembersHaveNoParent.Match)) {
178 TwoMembersHaveNoParent.Match other = (TwoMembersHaveNoParent.Match) obj;
179 return Objects.equals(fM1, other.fM1) && Objects.equals(fM2, other.fM2);
180 } else {
181 // this should be infrequent
182 if (!(obj instanceof IPatternMatch)) {
183 return false;
184 }
185 IPatternMatch otherSig = (IPatternMatch) obj;
186 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
187 }
188 }
189
190 @Override
191 public TwoMembersHaveNoParent specification() {
192 return TwoMembersHaveNoParent.instance();
193 }
194
195 /**
196 * Returns an empty, mutable match.
197 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
198 *
199 * @return the empty match.
200 *
201 */
202 public static TwoMembersHaveNoParent.Match newEmptyMatch() {
203 return new Mutable(null, null);
204 }
205
206 /**
207 * Returns a mutable (partial) match.
208 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
209 *
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.
212 * @return the new, mutable (partial) match object.
213 *
214 */
215 public static TwoMembersHaveNoParent.Match newMutableMatch(final Member pM1, final Member pM2) {
216 return new Mutable(pM1, pM2);
217 }
218
219 /**
220 * Returns a new (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.
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.
225 * @return the (partial) match object.
226 *
227 */
228 public static TwoMembersHaveNoParent.Match newMatch(final Member pM1, final Member pM2) {
229 return new Immutable(pM1, pM2);
230 }
231
232 private static final class Mutable extends TwoMembersHaveNoParent.Match {
233 Mutable(final Member pM1, final Member pM2) {
234 super(pM1, pM2);
235 }
236
237 @Override
238 public boolean isMutable() {
239 return true;
240 }
241 }
242
243 private static final class Immutable extends TwoMembersHaveNoParent.Match {
244 Immutable(final Member pM1, final Member pM2) {
245 super(pM1, pM2);
246 }
247
248 @Override
249 public boolean isMutable() {
250 return false;
251 }
252 }
253 }
254
255 /**
256 * Generated pattern matcher API of the queries.twoMembersHaveNoParent pattern,
257 * providing pattern-specific query methods.
258 *
259 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
260 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
261 *
262 * <p>Matches of the pattern will be represented as {@link Match}.
263 *
264 * <p>Original source:
265 * <code><pre>
266 * {@literal @}Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2})
267 * pattern twoMembersHaveNoParent(m1:Member, m2:Member) = {
268 * neg find memberHasParent(m1);
269 * neg find memberHasParent(m2);
270 * m1 != m2;
271 * }
272 * </pre></code>
273 *
274 * @see Match
275 * @see TwoMembersHaveNoParent
276 *
277 */
278 public static class Matcher extends BaseMatcher<TwoMembersHaveNoParent.Match> {
279 /**
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.
282 *
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
285 *
286 */
287 public static TwoMembersHaveNoParent.Matcher on(final ViatraQueryEngine engine) {
288 // check if matcher already exists
289 Matcher matcher = engine.getExistingMatcher(querySpecification());
290 if (matcher == null) {
291 matcher = (Matcher)engine.getMatcher(querySpecification());
292 }
293 return matcher;
294 }
295
296 /**
297 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
298 * @return an initialized matcher
299 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
300 *
301 */
302 public static TwoMembersHaveNoParent.Matcher create() {
303 return new Matcher();
304 }
305
306 private static final int POSITION_M1 = 0;
307
308 private static final int POSITION_M2 = 1;
309
310 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TwoMembersHaveNoParent.Matcher.class);
311
312 /**
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.
315 *
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
318 *
319 */
320 private Matcher() {
321 super(querySpecification());
322 }
323
324 /**
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.
327 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
328 * @return matches represented as a Match object.
329 *
330 */
331 public Collection<TwoMembersHaveNoParent.Match> getAllMatches(final Member pM1, final Member pM2) {
332 return rawStreamAllMatches(new Object[]{pM1, pM2}).collect(Collectors.toSet());
333 }
334
335 /**
336 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
337 * </p>
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>.
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.
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.
344 *
345 */
346 public Stream<TwoMembersHaveNoParent.Match> streamAllMatches(final Member pM1, final Member pM2) {
347 return rawStreamAllMatches(new Object[]{pM1, pM2});
348 }
349
350 /**
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.
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.
355 * @return a match represented as a Match object, or null if no match is found.
356 *
357 */
358 public Optional<TwoMembersHaveNoParent.Match> getOneArbitraryMatch(final Member pM1, final Member pM2) {
359 return rawGetOneArbitraryMatch(new Object[]{pM1, pM2});
360 }
361
362 /**
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).
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.
367 * @return true if the input is a valid (partial) match of the pattern.
368 *
369 */
370 public boolean hasMatch(final Member pM1, final Member pM2) {
371 return rawHasMatch(new Object[]{pM1, pM2});
372 }
373
374 /**
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.
377 * @param pM2 the fixed value of pattern parameter m2, or null if not bound.
378 * @return the number of pattern matches found.
379 *
380 */
381 public int countMatches(final Member pM1, final Member pM2) {
382 return rawCountMatches(new Object[]{pM1, pM2});
383 }
384
385 /**
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.
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.
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
392 *
393 */
394 public boolean forOneArbitraryMatch(final Member pM1, final Member pM2, final Consumer<? super TwoMembersHaveNoParent.Match> processor) {
395 return rawForOneArbitraryMatch(new Object[]{pM1, pM2}, processor);
396 }
397
398 /**
399 * Returns a new (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.
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.
404 * @return the (partial) match object.
405 *
406 */
407 public TwoMembersHaveNoParent.Match newMatch(final Member pM1, final Member pM2) {
408 return TwoMembersHaveNoParent.Match.newMatch(pM1, pM2);
409 }
410
411 /**
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
414 *
415 */
416 protected Stream<Member> rawStreamAllValuesOfm1(final Object[] parameters) {
417 return rawStreamAllValues(POSITION_M1, parameters).map(Member.class::cast);
418 }
419
420 /**
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
423 *
424 */
425 public Set<Member> getAllValuesOfm1() {
426 return rawStreamAllValuesOfm1(emptyArray()).collect(Collectors.toSet());
427 }
428
429 /**
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
432 *
433 */
434 public Stream<Member> streamAllValuesOfm1() {
435 return rawStreamAllValuesOfm1(emptyArray());
436 }
437
438 /**
439 * Retrieve the set of values that occur in matches for m1.
440 * </p>
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>.
443 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
444 *
445 * @return the Stream of all values or empty set if there are no matches
446 *
447 */
448 public Stream<Member> streamAllValuesOfm1(final TwoMembersHaveNoParent.Match partialMatch) {
449 return rawStreamAllValuesOfm1(partialMatch.toArray());
450 }
451
452 /**
453 * Retrieve the set of values that occur in matches for m1.
454 * </p>
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>.
457 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
458 *
459 * @return the Stream of all values or empty set if there are no matches
460 *
461 */
462 public Stream<Member> streamAllValuesOfm1(final Member pM2) {
463 return rawStreamAllValuesOfm1(new Object[]{null, pM2});
464 }
465
466 /**
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
469 *
470 */
471 public Set<Member> getAllValuesOfm1(final TwoMembersHaveNoParent.Match partialMatch) {
472 return rawStreamAllValuesOfm1(partialMatch.toArray()).collect(Collectors.toSet());
473 }
474
475 /**
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
478 *
479 */
480 public Set<Member> getAllValuesOfm1(final Member pM2) {
481 return rawStreamAllValuesOfm1(new Object[]{null, pM2}).collect(Collectors.toSet());
482 }
483
484 /**
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
487 *
488 */
489 protected Stream<Member> rawStreamAllValuesOfm2(final Object[] parameters) {
490 return rawStreamAllValues(POSITION_M2, parameters).map(Member.class::cast);
491 }
492
493 /**
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
496 *
497 */
498 public Set<Member> getAllValuesOfm2() {
499 return rawStreamAllValuesOfm2(emptyArray()).collect(Collectors.toSet());
500 }
501
502 /**
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
505 *
506 */
507 public Stream<Member> streamAllValuesOfm2() {
508 return rawStreamAllValuesOfm2(emptyArray());
509 }
510
511 /**
512 * Retrieve the set of values that occur in matches for m2.
513 * </p>
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>.
516 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
517 *
518 * @return the Stream of all values or empty set if there are no matches
519 *
520 */
521 public Stream<Member> streamAllValuesOfm2(final TwoMembersHaveNoParent.Match partialMatch) {
522 return rawStreamAllValuesOfm2(partialMatch.toArray());
523 }
524
525 /**
526 * Retrieve the set of values that occur in matches for m2.
527 * </p>
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>.
530 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
531 *
532 * @return the Stream of all values or empty set if there are no matches
533 *
534 */
535 public Stream<Member> streamAllValuesOfm2(final Member pM1) {
536 return rawStreamAllValuesOfm2(new Object[]{pM1, null});
537 }
538
539 /**
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
542 *
543 */
544 public Set<Member> getAllValuesOfm2(final TwoMembersHaveNoParent.Match partialMatch) {
545 return rawStreamAllValuesOfm2(partialMatch.toArray()).collect(Collectors.toSet());
546 }
547
548 /**
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
551 *
552 */
553 public Set<Member> getAllValuesOfm2(final Member pM1) {
554 return rawStreamAllValuesOfm2(new Object[]{pM1, null}).collect(Collectors.toSet());
555 }
556
557 @Override
558 protected TwoMembersHaveNoParent.Match tupleToMatch(final Tuple t) {
559 try {
560 return TwoMembersHaveNoParent.Match.newMatch((Member) t.get(POSITION_M1), (Member) t.get(POSITION_M2));
561 } catch(ClassCastException e) {
562 LOGGER.error("Element(s) in tuple not properly typed!",e);
563 return null;
564 }
565 }
566
567 @Override
568 protected TwoMembersHaveNoParent.Match arrayToMatch(final Object[] match) {
569 try {
570 return TwoMembersHaveNoParent.Match.newMatch((Member) match[POSITION_M1], (Member) match[POSITION_M2]);
571 } catch(ClassCastException e) {
572 LOGGER.error("Element(s) in array not properly typed!",e);
573 return null;
574 }
575 }
576
577 @Override
578 protected TwoMembersHaveNoParent.Match arrayToMatchMutable(final Object[] match) {
579 try {
580 return TwoMembersHaveNoParent.Match.newMutableMatch((Member) match[POSITION_M1], (Member) match[POSITION_M2]);
581 } catch(ClassCastException e) {
582 LOGGER.error("Element(s) in array not properly typed!",e);
583 return null;
584 }
585 }
586
587 /**
588 * @return the singleton instance of the query specification of this pattern
589 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
590 *
591 */
592 public static IQuerySpecification<TwoMembersHaveNoParent.Matcher> querySpecification() {
593 return TwoMembersHaveNoParent.instance();
594 }
595 }
596
597 private TwoMembersHaveNoParent() {
598 super(GeneratedPQuery.INSTANCE);
599 }
600
601 /**
602 * @return the singleton instance of the query specification
603 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
604 *
605 */
606 public static TwoMembersHaveNoParent instance() {
607 try{
608 return LazyHolder.INSTANCE;
609 } catch (ExceptionInInitializerError err) {
610 throw processInitializerError(err);
611 }
612 }
613
614 @Override
615 protected TwoMembersHaveNoParent.Matcher instantiate(final ViatraQueryEngine engine) {
616 return TwoMembersHaveNoParent.Matcher.on(engine);
617 }
618
619 @Override
620 public TwoMembersHaveNoParent.Matcher instantiate() {
621 return TwoMembersHaveNoParent.Matcher.create();
622 }
623
624 @Override
625 public TwoMembersHaveNoParent.Match newEmptyMatch() {
626 return TwoMembersHaveNoParent.Match.newEmptyMatch();
627 }
628
629 @Override
630 public TwoMembersHaveNoParent.Match newMatch(final Object... parameters) {
631 return TwoMembersHaveNoParent.Match.newMatch((familytree.Member) parameters[0], (familytree.Member) parameters[1]);
632 }
633
634 /**
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,
637 * but rather at the first call to {@link TwoMembersHaveNoParent#instance()}.
638 *
639 * <p> This workaround is required e.g. to support recursion.
640 *
641 */
642 private static class LazyHolder {
643 private static final TwoMembersHaveNoParent INSTANCE = new TwoMembersHaveNoParent();
644
645 /**
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.
648 *
649 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
650 *
651 */
652 private static final Object STATIC_INITIALIZER = ensureInitialized();
653
654 public static Object ensureInitialized() {
655 INSTANCE.ensureInitializedInternal();
656 return null;
657 }
658 }
659
660 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
661 private static final TwoMembersHaveNoParent.GeneratedPQuery INSTANCE = new GeneratedPQuery();
662
663 private final PParameter parameter_m1 = new PParameter("m1", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
664
665 private final PParameter parameter_m2 = new PParameter("m2", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT);
666
667 private final List<PParameter> parameters = Arrays.asList(parameter_m1, parameter_m2);
668
669 private GeneratedPQuery() {
670 super(PVisibility.PUBLIC);
671 }
672
673 @Override
674 public String getFullyQualifiedName() {
675 return "queries.twoMembersHaveNoParent";
676 }
677
678 @Override
679 public List<String> getParameterNames() {
680 return Arrays.asList("m1","m2");
681 }
682
683 @Override
684 public List<PParameter> getParameters() {
685 return parameters;
686 }
687
688 @Override
689 public Set<PBody> doGetContainedBodies() {
690 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
691 Set<PBody> bodies = new LinkedHashSet<>();
692 {
693 PBody body = new PBody(this);
694 PVariable var_m1 = body.getOrCreateVariableByName("m1");
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")));
697 new TypeConstraint(body, Tuples.flatTupleOf(var_m2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member")));
698 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
699 new ExportedParameter(body, var_m1, parameter_m1),
700 new ExportedParameter(body, var_m2, parameter_m2)
701 ));
702 // neg find memberHasParent(m1)
703 new NegativePatternCall(body, Tuples.flatTupleOf(var_m1), MemberHasParent.instance().getInternalQueryRepresentation());
704 // neg find memberHasParent(m2)
705 new NegativePatternCall(body, Tuples.flatTupleOf(var_m2), MemberHasParent.instance().getInternalQueryRepresentation());
706 // m1 != m2
707 new Inequality(body, var_m1, var_m2);
708 bodies.add(body);
709 }
710 {
711 PAnnotation annotation = new PAnnotation("Constraint");
712 annotation.addAttribute("message", "twoMembersHaveNoParent");
713 annotation.addAttribute("severity", "error");
714 annotation.addAttribute("key", Arrays.asList(new Object[] {
715 new ParameterReference("m1"),
716 new ParameterReference("m2")
717 }));
718 addAnnotation(annotation);
719 }
720 return bodies;
721 }
722 }
723}
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/.gitignore
index 3197db31..b33f6aff 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/.gitignore
+++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/.gitignore
@@ -1,2 +1,2 @@
1/bin/ 1/bin/
2/xtend-gen/ \ No newline at end of file 2/xtend-gen/
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/.UML2TGF.xtendbin b/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/.UML2TGF.xtendbin
deleted file mode 100644
index 23513b51..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/.UML2TGF.xtendbin
+++ /dev/null
Binary files differ
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/.gitignore
deleted file mode 100644
index 7a39cb70..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1/.UML2TGF.java._trace
2/.UML2TGF.xtendbin
3/UML2TGF.java
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/UML2TGF.java b/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/UML2TGF.java
deleted file mode 100644
index 9081c3af..00000000
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/UML2TGF.java
+++ /dev/null
@@ -1,234 +0,0 @@
1package converter;
2
3import java.io.PrintWriter;
4import java.text.SimpleDateFormat;
5import java.util.ArrayList;
6import java.util.Collection;
7import java.util.Date;
8import java.util.HashMap;
9import java.util.HashSet;
10import org.eclipse.emf.common.util.EList;
11import org.eclipse.emf.common.util.URI;
12import org.eclipse.emf.ecore.EObject;
13import org.eclipse.emf.ecore.resource.Resource;
14import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
15import org.eclipse.uml2.uml.Element;
16import org.eclipse.uml2.uml.EnumerationLiteral;
17import org.eclipse.uml2.uml.InstanceSpecification;
18import org.eclipse.uml2.uml.InstanceValue;
19import org.eclipse.uml2.uml.Model;
20import org.eclipse.uml2.uml.Slot;
21import org.eclipse.uml2.uml.StructuralFeature;
22import org.eclipse.uml2.uml.UMLPackage;
23import org.eclipse.uml2.uml.ValueSpecification;
24import org.eclipse.uml2.uml.resource.UMLResource;
25import org.eclipse.xtend2.lib.StringConcatenation;
26import org.eclipse.xtext.xbase.lib.Conversions;
27import org.eclipse.xtext.xbase.lib.Exceptions;
28import org.eclipse.xtext.xbase.lib.Functions.Function1;
29import org.eclipse.xtext.xbase.lib.InputOutput;
30import org.eclipse.xtext.xbase.lib.IterableExtensions;
31
32@SuppressWarnings("all")
33public class UML2TGF {
34 public static void main(final String[] args) {
35 try {
36 final ResourceSetImpl resourceSet = new ResourceSetImpl();
37 resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
38 resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION,
39 UMLResource.Factory.INSTANCE);
40 final Resource res = resourceSet.getResource(URI.createFileURI("instance//Instance_model_A.uml"), true);
41 EObject _get = res.getContents().get(0);
42 final Model docRoot = ((Model) _get);
43 final Function1<Element, Boolean> _function = (Element it) -> {
44 return Boolean.valueOf((it instanceof InstanceSpecification));
45 };
46 final Iterable<Element> nodes = IterableExtensions.<Element>filter(docRoot.allOwnedElements(), _function);
47 final HashSet<Object> allTypes = new HashSet<Object>();
48 for (final Element e : nodes) {
49 allTypes.add(e.getClass());
50 }
51 long _currentTimeMillis = System.currentTimeMillis();
52 final Date date = new Date(_currentTimeMillis);
53 final SimpleDateFormat format = new SimpleDateFormat("dd-HHmm");
54 final String formattedDate = format.format(date);
55 final HashMap<InstanceSpecification, Integer> map = new HashMap<InstanceSpecification, Integer>();
56 final HashSet<String> set = new HashSet<String>();
57 final ArrayList<Object> unidentified = new ArrayList<Object>();
58 final ArrayList<Object> enums = new ArrayList<Object>();
59 final PrintWriter writer = new PrintWriter((("output//graph-" + formattedDate) + ".gml"));
60 InputOutput.<String>println("begin Writing");
61 writer.append("graph\n[\n");
62 int ind = 0;
63 int numNodes = ((Object[])Conversions.unwrapArray(nodes, Object.class)).length;
64 int numEdges = 0;
65 for (final Element node : nodes) {
66 {
67 final InstanceSpecification n = ((InstanceSpecification) node);
68 boolean _contains = map.keySet().contains(n);
69 if (_contains) {
70 System.err.println("contained");
71 }
72 map.put(n, Integer.valueOf(ind));
73 StringConcatenation _builder = new StringConcatenation();
74 _builder.append(" ");
75 _builder.append("node");
76 _builder.newLine();
77 _builder.append(" ");
78 _builder.append("[");
79 _builder.newLine();
80 _builder.append(" ");
81 _builder.append("id ");
82 _builder.append(ind, " ");
83 _builder.newLineIfNotEmpty();
84 _builder.append(" ");
85 _builder.append("label \"");
86 {
87 String _name = n.getName();
88 boolean _tripleNotEquals = (_name != null);
89 if (_tripleNotEquals) {
90 String _name_1 = n.getName();
91 _builder.append(_name_1, " ");
92 }
93 }
94 _builder.append("\"");
95 _builder.newLineIfNotEmpty();
96 {
97 if (((n.getName() != null) && (n.getName().contains("Household") || n.getName().contains("Household")))) {
98 _builder.append(" graphics");
99 _builder.newLineIfNotEmpty();
100 _builder.append(" ");
101 _builder.append("[");
102 _builder.newLine();
103 _builder.append(" ");
104 _builder.append("fill\t\"#00FF00\"");
105 _builder.newLine();
106 _builder.append(" ");
107 _builder.append("]");
108 _builder.newLine();
109 }
110 }
111 _builder.append(" ");
112 {
113 if ((node instanceof EnumerationLiteral)) {
114 _builder.append(" graphics");
115 _builder.newLineIfNotEmpty();
116 _builder.append(" ");
117 _builder.append(" ");
118 _builder.append("[");
119 _builder.newLine();
120 _builder.append(" ");
121 _builder.append(" ");
122 _builder.append("fill\t\"#FF0000\"");
123 _builder.newLine();
124 _builder.append(" ");
125 _builder.append(" ");
126 _builder.append("]");
127 _builder.newLine();
128 }
129 }
130 _builder.append(" ");
131 _builder.append("]");
132 _builder.newLine();
133 writer.append(_builder);
134 ind++;
135 }
136 }
137 Slot s = null;
138 try {
139 for (final Element node_1 : nodes) {
140 {
141 final InstanceSpecification n = ((InstanceSpecification) node_1);
142 final Integer nind = map.get(n);
143 EList<Slot> _slots = n.getSlots();
144 for (final Slot slot : _slots) {
145 {
146 s = slot;
147 String fname = "";
148 StructuralFeature _definingFeature = slot.getDefiningFeature();
149 boolean _tripleNotEquals = (_definingFeature != null);
150 if (_tripleNotEquals) {
151 fname = slot.getDefiningFeature().getName();
152 }
153 EList<ValueSpecification> _values = slot.getValues();
154 for (final ValueSpecification v : _values) {
155 if ((v instanceof InstanceValue)) {
156 final InstanceValue value = ((InstanceValue) v);
157 boolean _containsKey = map.containsKey(value.getInstance());
158 if (_containsKey) {
159 InstanceSpecification _instance = value.getInstance();
160 boolean _notEquals = ((_instance instanceof EnumerationLiteral) != true);
161 if (_notEquals) {
162 final Integer vind = map.get(value.getInstance());
163 StringConcatenation _builder = new StringConcatenation();
164 _builder.append(" ");
165 _builder.append("edge");
166 _builder.newLine();
167 _builder.append(" ");
168 _builder.append("[");
169 _builder.newLine();
170 _builder.append(" ");
171 _builder.append("source ");
172 _builder.append(nind, " ");
173 _builder.newLineIfNotEmpty();
174 _builder.append(" ");
175 _builder.append("target ");
176 _builder.append(vind, " ");
177 _builder.newLineIfNotEmpty();
178 _builder.append(" ");
179 _builder.append("label \"");
180 _builder.append(fname, " ");
181 _builder.append("\"");
182 _builder.newLineIfNotEmpty();
183 _builder.append(" ");
184 _builder.append("]");
185 _builder.newLine();
186 writer.append(_builder);
187 numEdges++;
188 } else {
189 String _plus = (value + " -> ");
190 InstanceSpecification _instance_1 = value.getInstance();
191 String _plus_1 = (_plus + _instance_1);
192 enums.add(_plus_1);
193 }
194 } else {
195 String _plus_2 = (value + " -> ");
196 InstanceSpecification _instance_2 = value.getInstance();
197 String _plus_3 = (_plus_2 + _instance_2);
198 unidentified.add(_plus_3);
199 }
200 } else {
201 set.add(v.getClass().toString());
202 }
203 }
204 }
205 }
206 }
207 }
208 } catch (final Throwable _t) {
209 if (_t instanceof Exception) {
210 InputOutput.<StructuralFeature>println(s.getDefiningFeature());
211 } else {
212 throw Exceptions.sneakyThrow(_t);
213 }
214 }
215 UML2TGF.printset("Unhandled Edges", set);
216 UML2TGF.printset("Unidentified trgs", unidentified);
217 UML2TGF.printset("Enums:", enums);
218 writer.append("]");
219 writer.close();
220 InputOutput.<String>println("End");
221 InputOutput.<String>println(((("#nodes:" + Integer.valueOf(numNodes)) + ", #edges:") + Integer.valueOf(numEdges)));
222 } catch (Throwable _e) {
223 throw Exceptions.sneakyThrow(_e);
224 }
225 }
226
227 public static void printset(final String name, final Collection s) {
228 InputOutput.<String>println((name + ":"));
229 for (final Object k : s) {
230 InputOutput.<String>println(("- " + k));
231 }
232 InputOutput.println();
233 }
234}
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/.gitignore
index ecef25ad..7d464a77 100644
--- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/.gitignore
+++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/.gitignore
@@ -4,3 +4,4 @@
4/xtend-gen/ 4/xtend-gen/
5/bin/ 5/bin/
6/x/ 6/x/
7/archives/ \ No newline at end of file