From 7dcbe0bc5a9cac09de030b5f328f2e4d575f4ab5 Mon Sep 17 00:00:00 2001 From: Aren Babikian Date: Wed, 6 Jan 2021 00:01:51 +0100 Subject: rebase dreal-integ on models20-measurements --- .../.gitignore | 1 + .../.ApplicationConfigurationIdeModule.xtendbin | Bin 1700 -> 0 bytes .../ide/.ApplicationConfigurationIdeSetup.xtendbin | Bin 2525 -> 0 bytes .../mit/inf/dslreasoner/application/ide/.gitignore | 6 - .../ide/ApplicationConfigurationIdeModule.java | 13 - .../ide/ApplicationConfigurationIdeSetup.java | 24 - .../.gitignore | 1 + .../eclipse/viatra/solver/language/ui/.gitignore | 3 - .../solver/language/ui/contentassist/.gitignore | 3 - .../viatra/solver/language/ui/highlight/.gitignore | 6 - .../viatra/solver/language/ui/labeling/.gitignore | 6 - .../viatra/solver/language/ui/outline/.gitignore | 3 - .../viatra/solver/language/ui/quickfix/.gitignore | 3 - .../.SolverSemanticHighlightCalculator.xtendbin | Bin 5333 -> 0 bytes .../.SolverSemanticTextAttributeProvider.xtendbin | Bin 4902 -> 0 bytes .../solver/language/ui/syntaxcoloring/.gitignore | 6 - .../SolverSemanticHighlightCalculator.java | 83 -- .../SolverSemanticTextAttributeProvider.java | 63 -- .../validation/.SolverLanguageValidator.xtendbin | Bin 1716 -> 0 bytes .../viatra/solver/language/validation/.gitignore | 3 - .../validation/SolverLanguageValidator.java | 15 - .../org.eclipse.viatra.solver.language/.gitignore | 1 + .../org/eclipse/viatra/solver/language/.gitignore | 6 - .../viatra/solver/language/generator/.gitignore | 3 - ....SolverLanguageTokenDefInjectingParser.xtendbin | Bin 2741 -> 0 bytes .../viatra/solver/language/parser/antlr/.gitignore | 9 - .../SolverLanguageTokenDefInjectingParser.java | 26 - .../viatra/solver/language/scoping/.gitignore | 3 - ...nguageSyntheticTokenSyntacticSequencer.xtendbin | Bin 2757 -> 0 bytes .../viatra/solver/language/serializer/.gitignore | 3 - ...erLanguageSyntheticTokenSyntacticSequencer.java | 24 - .../viatra/solver/language/validation/.gitignore | 3 - .../case.study.familyTree.run/.gitignore | 3 + .../case.study.familyTree.run/bin/.gitignore | 2 - .../bin/queries/.FamilyTreeConstraints.java._trace | Bin 773 -> 0 bytes .../bin/queries/.MemberIsItsOwnParent.java._trace | Bin 3540 -> 0 bytes .../bin/queries/.gitignore | 13 - .../bin/queries/familyTreeConstraints.vql | 41 - .../outputs/debug/errors.txt | 22 - .../outputs/debug/generated3valued.vql_deactivated | 792 ------------------ .../outputs/debug/generation.logicproblem | 340 -------- .../outputs/debug/init.partialmodel | 51 -- .../case.study.familyTree.run/outputs/log.txt | 1 - .../case.study.familyTree.run/outputs/models/1.gml | 916 --------------------- .../case.study.familyTree.run/outputs/models/1.png | Bin 90845 -> 0 bytes .../case.study.familyTree.run/outputs/models/1.xmi | 8 - .../queries/.FamilyTreeConstraints.java._trace | Bin 773 -> 0 bytes .../queries/.MemberIsItsOwnParent.java._trace | Bin 3540 -> 0 bytes .../src-gen/queries/.gitignore | 13 - .../src-gen/queries/FamilyTreeConstraints.java | 97 --- .../src-gen/queries/MemberHasParent.java | 551 ------------- .../src-gen/queries/MemberIsItsOwnParent.java | 577 ------------- .../src-gen/queries/NegativeAge.java | 593 ------------- .../src-gen/queries/ParentTooYoung.java | 775 ----------------- .../src-gen/queries/TwoMembersHaveNoParent.java | 723 ---------------- .../case.study.pledge.originalFiles/.gitignore | 2 +- .../xtend-gen/converter/.gitignore | 3 - .../xtend-gen/converter/UML2TGF.java | 234 ------ .../case.study.pledge.run/.gitignore | 1 + 59 files changed, 8 insertions(+), 6067 deletions(-) delete mode 100644 Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin delete mode 100644 Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin delete mode 100644 Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.gitignore delete mode 100644 Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeModule.java delete mode 100644 Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/ApplicationConfigurationIdeSetup.java delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/contentassist/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/highlight/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/labeling/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/outline/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/quickfix/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticHighlightCalculator.xtendbin delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticTextAttributeProvider.xtendbin delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticHighlightCalculator.java delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/SolverSemanticTextAttributeProvider.java delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.SolverLanguageValidator.xtendbin delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/SolverLanguageValidator.java delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/generator/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.SolverLanguageTokenDefInjectingParser.xtendbin delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/SolverLanguageTokenDefInjectingParser.java delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/scoping/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.SolverLanguageSyntheticTokenSyntacticSequencer.xtendbin delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.gitignore delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntheticTokenSyntacticSequencer.java delete mode 100644 Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/validation/.gitignore create mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/.gitignore delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/.gitignore delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._trace delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.MemberIsItsOwnParent.java._trace delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.gitignore delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/familyTreeConstraints.vql delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/errors.txt delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generation.logicproblem delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/init.partialmodel delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/log.txt delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.gml delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.png delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.xmi delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.FamilyTreeConstraints.java._trace delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.MemberIsItsOwnParent.java._trace delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.gitignore delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/FamilyTreeConstraints.java delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberHasParent.java delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/MemberIsItsOwnParent.java delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/NegativeAge.java delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/ParentTooYoung.java delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/TwoMembersHaveNoParent.java delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/.gitignore delete mode 100644 Tests/MODELS2020-CaseStudies/case.study.pledge.originalFiles/xtend-gen/converter/UML2TGF.java 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 @@ /bin/ +/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 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin and /dev/null 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 Binary files a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin and /dev/null 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 @@ -/.ApplicationConfigurationIdeModule.java._trace -/.ApplicationConfigurationIdeSetup.java._trace -/.ApplicationConfigurationIdeModule.xtendbin -/.ApplicationConfigurationIdeSetup.xtendbin -/ApplicationConfigurationIdeModule.java -/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 @@ -/** - * generated by Xtext 2.12.0 - */ -package hu.bme.mit.inf.dslreasoner.application.ide; - -import hu.bme.mit.inf.dslreasoner.application.ide.AbstractApplicationConfigurationIdeModule; - -/** - * Use this class to register ide components. - */ -@SuppressWarnings("all") -public class ApplicationConfigurationIdeModule extends AbstractApplicationConfigurationIdeModule { -} 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 @@ -/** - * generated by Xtext 2.12.0 - */ -package hu.bme.mit.inf.dslreasoner.application.ide; - -import com.google.inject.Guice; -import com.google.inject.Injector; -import hu.bme.mit.inf.dslreasoner.application.ApplicationConfigurationRuntimeModule; -import hu.bme.mit.inf.dslreasoner.application.ApplicationConfigurationStandaloneSetup; -import hu.bme.mit.inf.dslreasoner.application.ide.ApplicationConfigurationIdeModule; -import org.eclipse.xtext.util.Modules2; - -/** - * Initialization support for running Xtext languages as language servers. - */ -@SuppressWarnings("all") -public class ApplicationConfigurationIdeSetup extends ApplicationConfigurationStandaloneSetup { - @Override - public Injector createInjector() { - ApplicationConfigurationRuntimeModule _applicationConfigurationRuntimeModule = new ApplicationConfigurationRuntimeModule(); - ApplicationConfigurationIdeModule _applicationConfigurationIdeModule = new ApplicationConfigurationIdeModule(); - return Guice.createInjector(Modules2.mixin(_applicationConfigurationRuntimeModule, _applicationConfigurationIdeModule)); - } -} 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 @@ /bin/ +/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 @@ -/.SolverLanguageUiModule.java._trace -/.SolverLanguageUiModule.xtendbin -/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 @@ -/.SolverLanguageProposalProvider.java._trace -/.SolverLanguageProposalProvider.xtendbin -/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 @@ -/.SolverSemanticHighlightCalculator.java._trace -/.SolverSemanticHighlightCalculator.xtendbin -/.SolverSemanticTextAttributeProvider.java._trace -/.SolverSemanticTextAttributeProvider.xtendbin -/SolverSemanticHighlightCalculator.java -/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 @@ -/.SolverLanguageDescriptionLabelProvider.java._trace -/.SolverLanguageDescriptionLabelProvider.xtendbin -/.SolverLanguageLabelProvider.java._trace -/.SolverLanguageLabelProvider.xtendbin -/SolverLanguageDescriptionLabelProvider.java -/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 @@ -/.SolverLanguageOutlineTreeProvider.java._trace -/.SolverLanguageOutlineTreeProvider.xtendbin -/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 @@ -/.SolverLanguageQuickfixProvider.java._trace -/.SolverLanguageQuickfixProvider.xtendbin -/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 Binary files a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticHighlightCalculator.xtendbin and /dev/null 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 Binary files a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/ui/syntaxcoloring/.SolverSemanticTextAttributeProvider.xtendbin and /dev/null 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 @@ -/.SolverSemanticHighlightCalculator.java._trace -/.SolverSemanticTextAttributeProvider.java._trace -/.SolverSemanticHighlightCalculator.xtendbin -/.SolverSemanticTextAttributeProvider.xtendbin -/SolverSemanticHighlightCalculator.java -/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 @@ -package org.eclipse.viatra.solver.language.ui.syntaxcoloring; - -import com.google.common.collect.Iterators; -import java.util.Iterator; -import java.util.Random; -import java.util.WeakHashMap; -import org.eclipse.viatra.solver.language.solverLanguage.Reference; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.ide.editor.syntaxcoloring.DefaultSemanticHighlightingCalculator; -import org.eclipse.xtext.ide.editor.syntaxcoloring.IHighlightedPositionAcceptor; -import org.eclipse.xtext.nodemodel.ICompositeNode; -import org.eclipse.xtext.nodemodel.util.NodeModelUtils; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.util.CancelIndicator; - -@SuppressWarnings("all") -public class SolverSemanticHighlightCalculator extends DefaultSemanticHighlightingCalculator { - public static final String SYMBOL_CODE = "SymbolCode::"; - - private final WeakHashMap symbolName2ID = new WeakHashMap(); - - @Override - public void provideHighlightingFor(final XtextResource resource, final IHighlightedPositionAcceptor acceptor, final CancelIndicator cancelIndicator) { - if (((resource == null) || (resource.getParseResult() == null))) { - return; - } else { - final Iterator modelSymbols = Iterators.filter(resource.getAllContents(), Reference.class); - while (modelSymbols.hasNext()) { - { - final Reference symbolElement = modelSymbols.next(); - final ICompositeNode node = NodeModelUtils.getNode(symbolElement); - acceptor.addPosition( - node.getOffset(), - node.getLength(), - this.getSymbolCode(node.getText())); - } - } - } - } - - public String getSymbolCode(final String name) { - boolean _containsKey = this.symbolName2ID.containsKey(name); - if (_containsKey) { - return this.symbolName2ID.get(name); - } else { - final String id = this.calculateSymbolCode(name); - this.symbolName2ID.put(name, id); - return id; - } - } - - public String calculateSymbolCode(final String name) { - int _hashCode = name.hashCode(); - final Random random = new Random(_hashCode); - final float hue = this.huePick(random.nextFloat()); - float _nextFloat = random.nextFloat(); - double _multiply = (_nextFloat * 0.3); - final double saturation = (0.2 + _multiply); - float _nextFloat_1 = random.nextFloat(); - double _multiply_1 = (_nextFloat_1 * 0.2); - final double brightness = (_multiply_1 + 0.7f); - StringConcatenation _builder = new StringConcatenation(); - _builder.append(SolverSemanticHighlightCalculator.SYMBOL_CODE); - _builder.append(" "); - _builder.append(hue); - _builder.append(" "); - _builder.append(saturation); - _builder.append(" "); - _builder.append(brightness); - return _builder.toString(); - } - - private float huePick(final float random) { - final int pink = 300; - final int tolerance = 10; - final float degree = (random * (360 - (2 * tolerance))); - if ((degree < (pink - tolerance))) { - return degree; - } else { - return (degree + (2 * tolerance)); - } - } -} 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 @@ -package org.eclipse.viatra.solver.language.ui.syntaxcoloring; - -import com.google.inject.Inject; -import java.util.WeakHashMap; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.viatra.solver.language.ui.syntaxcoloring.SolverSemanticHighlightCalculator; -import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess; -import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfiguration; -import org.eclipse.xtext.ui.editor.syntaxcoloring.PreferenceStoreAccessor; -import org.eclipse.xtext.ui.editor.syntaxcoloring.TextAttributeProvider; -import org.eclipse.xtext.ui.editor.utils.EditorUtils; -import org.eclipse.xtext.ui.editor.utils.TextStyle; - -@SuppressWarnings("all") -public class SolverSemanticTextAttributeProvider extends TextAttributeProvider { - private final TextStyle defaultTextStyle = new TextStyle(); - - private final WeakHashMap colorID2TextAttribute = new WeakHashMap(); - - @Inject - public SolverSemanticTextAttributeProvider(final IHighlightingConfiguration highlightingConfig, final IPreferenceStoreAccess preferenceStoreAccess, final PreferenceStoreAccessor prefStoreAccessor) { - super(highlightingConfig, preferenceStoreAccess, prefStoreAccessor); - } - - @Override - public TextAttribute getAttribute(final String id) { - TextAttribute _xifexpression = null; - boolean _isMetamodelElementColorID = this.isMetamodelElementColorID(id); - if (_isMetamodelElementColorID) { - boolean _containsKey = this.colorID2TextAttribute.containsKey(id); - if (_containsKey) { - return this.colorID2TextAttribute.get(id); - } else { - final TextAttribute style = this.metamodelElementTextStyle(id); - this.colorID2TextAttribute.put(id, style); - return style; - } - } else { - _xifexpression = super.getAttribute(id); - } - return _xifexpression; - } - - private boolean isMetamodelElementColorID(final String id) { - return id.startsWith(SolverSemanticHighlightCalculator.SYMBOL_CODE); - } - - private TextAttribute metamodelElementTextStyle(final String id) { - final String[] texts = id.split(" "); - float _parseFloat = Float.parseFloat(texts[1]); - float _parseFloat_1 = Float.parseFloat(texts[2]); - float _parseFloat_2 = Float.parseFloat(texts[3]); - final RGB backgroundColor = new RGB(_parseFloat, _parseFloat_1, _parseFloat_2); - Color _colorFromRGB = EditorUtils.colorFromRGB(this.defaultTextStyle.getColor()); - Color _colorFromRGB_1 = EditorUtils.colorFromRGB(backgroundColor); - int _style = this.defaultTextStyle.getStyle(); - Font _fontFromFontData = EditorUtils.fontFromFontData(this.defaultTextStyle.getFontData()); - return new TextAttribute(_colorFromRGB, _colorFromRGB_1, _style, _fontFromFontData); - } -} 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 Binary files a/Application/org.eclipse.viatra.solver.language.ui/xtend-gen/org/eclipse/viatra/solver/language/validation/.SolverLanguageValidator.xtendbin and /dev/null 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 @@ -/.SolverLanguageValidator.java._trace -/.SolverLanguageValidator.xtendbin -/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 @@ -/** - * generated by Xtext 2.18.0.M3 - */ -package org.eclipse.viatra.solver.language.validation; - -import org.eclipse.viatra.solver.language.validation.AbstractSolverLanguageValidator; - -/** - * This class contains custom validation rules. - * - * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation - */ -@SuppressWarnings("all") -public class SolverLanguageValidator extends AbstractSolverLanguageValidator { -} 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 @@ /bin/ +/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 @@ -/.SolverLanguageRuntimeModule.java._trace -/.SolverLanguageRuntimeModule.xtendbin -/.SolverLanguageStandaloneSetup.java._trace -/.SolverLanguageStandaloneSetup.xtendbin -/SolverLanguageRuntimeModule.java -/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 @@ -/.SolverLanguageGenerator.java._trace -/.SolverLanguageGenerator.xtendbin -/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 Binary files a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/parser/antlr/.SolverLanguageTokenDefInjectingParser.xtendbin and /dev/null 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 @@ -/.SolverLangaugeSyntheticTokenParser.java._trace -/.SolverLanguageSyntheticTokenTokenSource.java._trace -/.LastTokenState.java._trace -/.SolverLangusgeSyntheticTokenParser.java._trace -/.SolverLanguageSyntheticTokenParser.java._trace -/.SolverLanguageTokenSource.java._trace -/.SolverLanguageTokenDefInjectingParser.java._trace -/.SolverLanguageTokenDefInjectingParser.xtendbin -/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 @@ -package org.eclipse.viatra.solver.language.parser.antlr; - -import com.google.inject.Inject; -import org.antlr.runtime.CharStream; -import org.antlr.runtime.TokenSource; -import org.eclipse.viatra.solver.language.parser.antlr.SolverLanguageParser; -import org.eclipse.viatra.solver.language.parser.antlr.SolverLanguageTokenSource; -import org.eclipse.xtext.parser.antlr.ITokenDefProvider; - -@SuppressWarnings("all") -public class SolverLanguageTokenDefInjectingParser extends SolverLanguageParser { - @Inject - private ITokenDefProvider tokenDefProvider; - - @Override - protected TokenSource createLexer(final CharStream stream) { - SolverLanguageTokenSource _xblockexpression = null; - { - TokenSource _createLexer = super.createLexer(stream); - final SolverLanguageTokenSource tokenSource = ((SolverLanguageTokenSource) _createLexer); - tokenSource.initializeTokenDefsFrom(this.tokenDefProvider); - _xblockexpression = tokenSource; - } - return _xblockexpression; - } -} 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 @@ -/.SolverLanguageScopeProvider.java._trace -/.SolverLanguageScopeProvider.xtendbin -/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 Binary files a/Application/org.eclipse.viatra.solver.language/xtend-gen/org/eclipse/viatra/solver/language/serializer/.SolverLanguageSyntheticTokenSyntacticSequencer.xtendbin and /dev/null 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 @@ -/.SolverLanguageSyntheticTokenSyntacticSequencer.java._trace -/.SolverLanguageSyntheticTokenSyntacticSequencer.xtendbin -/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 @@ -package org.eclipse.viatra.solver.language.serializer; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.viatra.solver.language.serializer.SolverLanguageSyntacticSequencer; -import org.eclipse.xtext.RuleCall; -import org.eclipse.xtext.nodemodel.INode; - -@SuppressWarnings("all") -public class SolverLanguageSyntheticTokenSyntacticSequencer extends SolverLanguageSyntacticSequencer { - @Override - protected String getTRANSITIVE_CLOSUREToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) { - return "+"; - } - - @Override - protected String getREFLEXIVE_TRANSITIVE_CLOSUREToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) { - return "*"; - } - - @Override - protected String getFULL_STOPToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) { - return "."; - } -} 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 @@ -/.SolverLanguageValidator.java._trace -/.SolverLanguageValidator.xtendbin -/SolverLanguageValidator.java 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 @@ +/src-gen/ +/bin/ +/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 3d70f0da..00000000 --- a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/queries/ -/run/ diff --git a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._trace b/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._trace deleted file mode 100644 index b000501e..00000000 Binary files a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.FamilyTreeConstraints.java._trace and /dev/null 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 Binary files a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/bin/queries/.MemberIsItsOwnParent.java._trace and /dev/null 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 @@ -/.FamilyTreeConstraints.java._trace -/.MemberIsItsOwnParent.java._trace -/FamilyTreeConstraints.java -/MemberIsItsOwnParent.java -/.ParentTooYoung.java._trace -/.MemberHasNoParent.java._trace -/.MemberHasParent.java._trace -/.TwoMembersHaveNoParent.java._trace -/.NegativeAge.java._trace -/MemberHasParent.java -/NegativeAge.java -/ParentTooYoung.java -/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 @@ -package queries - -import "http://www.example.org/familytree" - -@Constraint(message="memberIsItsOwnParent", severity="error", key={m}) -pattern memberIsItsOwnParent(m: Member) = { - FamilyTree.members(_, m); - Member.parents(m, p); - m == p; -} - -@Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2}) -pattern twoMembersHaveNoParent(m1:Member, m2:Member) = { - neg find memberHasParent(m1); - neg find memberHasParent(m2); - m1 != m2; -} - -pattern memberHasParent(m: Member) = { - Member.parents(m, _); -} - -@Constraint(message="negativeAge", severity="error",key={m}) -pattern negativeAge(m: Member) { - Member.age(m,mage); - check(mage<0); -} - -@Constraint(message="parentTooYoung", severity="error", key={c, p}) -pattern parentTooYoung(c: Member, p: Member) = { - FamilyTree.members(_, c); - Member.parents(c, p); - Member.age(c, cAge); - Member.age(p, pAge); - check (pAge <= (cAge + 12)); -} - - - - - 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 @@ -Error occured (IllegalArgumentException): TypeConstraint applicable for enumerable input keys only; received instead org.eclipse.viatra.query.patternlanguage.emf.types.BottomTypeKey@3ba3f40d - org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint.(TypeConstraint.java:42) - org.eclipse.viatra.query.patternlanguage.emf.specification.internal.EPMToPBody.acceptTypeConstraint(EPMToPBody.java:115) - org.eclipse.viatra.query.patternlanguage.emf.specification.internal.PatternBodyTransformer.preprocessParameters(PatternBodyTransformer.java:168) - org.eclipse.viatra.query.patternlanguage.emf.specification.internal.PatternBodyTransformer.transform(PatternBodyTransformer.java:123) - org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.getBodies(SpecificationBuilder.java:300) - org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.buildBodies(SpecificationBuilder.java:286) - org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.buildSpecification(SpecificationBuilder.java:197) - org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.lambda$4(SpecificationBuilder.java:157) - java.util.Optional.orElseGet(Optional.java:267) - org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.getOrCreateSpecification(SpecificationBuilder.java:157) - hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.util.ParseUtil.createSpecification(ParseUtil.java:114) - hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.util.ParseUtil.parse(ParseUtil.java:101) - hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternProvider.generateQueries(PatternProvider.java:66) - hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethodProvider.createModelGenerationMethod(ModelGenerationMethodProvider.java:57) - hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner.solve(ViatraReasoner.java:97) - hu.bme.mit.inf.dslreasoner.application.execution.GenerationTaskExecutor.executeGenerationTask(GenerationTaskExecutor.java:316) - hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor._execute(ScriptExecutor.java:129) - hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.execute(ScriptExecutor.java:338) - hu.bme.mit.inf.dslreasoner.application.execution.ScriptExecutor.executeScript(ScriptExecutor.java:110) - hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor.executeScript(StandaloneScriptExecutor.java:149) - 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 @@ -import epackage "http://www.bme.hu/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage" -import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/problem" -import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/language" - -////////// -// 0. Util -////////// -private pattern interpretation(problem:LogicProblem, interpretation:PartialInterpretation) { - PartialInterpretation.problem(interpretation,problem); -} - -///////////////////////// -// 0.1 Existence -///////////////////////// -/** [[exist(element)]]=1 */ -private pattern mustExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { - find interpretation(problem,interpretation); - LogicProblem.elements(problem,element); -} or { - find interpretation(problem,interpretation); - PartialInterpretation.newElements(interpretation,element); -} - -/** [[exist(element)]]>=1/2 */ -private pattern mayExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { - find mustExist(problem,interpretation,element); -} or { - find interpretation(problem,interpretation); - neg find elementCloseWorld(element); - PartialInterpretation.openWorldElements(interpretation,element); -} - -private pattern elementCloseWorld(element:DefinedElement) { - PartialInterpretation.openWorldElements(i,element); - PartialInterpretation.maxNewElements(i,0); -} or { - Scope.targetTypeInterpretation(scope,interpretation); - PartialTypeInterpratation.elements(interpretation,element); - Scope.maxNewElements(scope,0); -} - -//////////////////////// -// 0.2 Equivalence -//////////////////////// -pattern mayEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) -// For non-primitive type. Boolean types always must equivalent or cannot equivalent -{ - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - a == b; -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - IntegerElement(a); - IntegerElement(b); - PrimitiveElement.valueSet(a,false); -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - IntegerElement(a); - IntegerElement(b); - PrimitiveElement.valueSet(b,false); -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - RealElement(a); - RealElement(b); - PrimitiveElement.valueSet(a,false); -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - RealElement(a); - RealElement(b); - PrimitiveElement.valueSet(b,false); -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - RealElement(a); - IntegerElement(b); - PrimitiveElement.valueSet(a,false); -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - RealElement(a); - IntegerElement(b); - PrimitiveElement.valueSet(b,false); -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - IntegerElement(a); - RealElement(b); - PrimitiveElement.valueSet(a,false); -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - IntegerElement(a); - RealElement(b); - PrimitiveElement.valueSet(b,false); -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - StringElement(a); - StringElement(b); - PrimitiveElement.valueSet(a,false); -} or { - find mayExist(problem,interpretation,a); - find mayExist(problem,interpretation,b); - StringElement(a); - StringElement(b); - PrimitiveElement.valueSet(b,false); -} - -pattern mustEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) { -// For non-primitive and Boolean primitive type - find mustExist(problem,interpretation,a); - find mustExist(problem,interpretation,b); - a == b; -} or { - find mustExist(problem,interpretation,a); - find mustExist(problem,interpretation,b); - PrimitiveElement.valueSet(a,true); - PrimitiveElement.valueSet(b,true); - IntegerElement.value(a,value); - IntegerElement.value(b,value); -} or { - find mustExist(problem,interpretation,a); - find mustExist(problem,interpretation,b); - PrimitiveElement.valueSet(a,true); - PrimitiveElement.valueSet(b,true); - RealElement.value(a,value); - RealElement.value(b,value); -} or { - find mustExist(problem,interpretation,a); - find mustExist(problem,interpretation,b); - PrimitiveElement.valueSet(a,true); - PrimitiveElement.valueSet(b,true); - RealElement.value(a,value); - IntegerElement.value(b,value); -} or { - find mustExist(problem,interpretation,a); - find mustExist(problem,interpretation,b); - PrimitiveElement.valueSet(a,true); - PrimitiveElement.valueSet(b,true); - IntegerElement.value(a,value); - RealElement.value(b,value); -} or { - find mustExist(problem,interpretation,a); - find mustExist(problem,interpretation,b); - PrimitiveElement.valueSet(a,true); - PrimitiveElement.valueSet(b,true); - StringElement.value(a,value); - StringElement.value(b,value); -} - -////////// -// 1. Problem-Specific Base Indexers -////////// -// 1.1 Type Indexers -////////// -// 1.1.1 Required Patterns by TypeIndexer -////////// -private pattern typeInterpretation(problem:LogicProblem, interpretation:PartialInterpretation, type:TypeDeclaration, typeInterpretation:PartialComplexTypeInterpretation) { - find interpretation(problem,interpretation); - LogicProblem.types(problem,type); - PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); - PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type); -} - -private pattern directInstanceOf(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement, type:Type) { - find interpretation(problem,interpretation); - LogicProblem.types(problem,type); - TypeDefinition.elements(type,element); -} or { - find interpretation(problem,interpretation); - find typeInterpretation(problem,interpretation,type,typeInterpretation); - PartialComplexTypeInterpretation.elements(typeInterpretation,element); -} - -private pattern isPrimitive(element: PrimitiveElement) { - PrimitiveElement(element); -} -////////// -// 1.1.2 primitive Type Indexers -////////// -// Currently unused. Refer primitive types as: -// > PrimitiveElement(element) -// specific types are referred as: -// > BooleanElement(variableName) -// > IntegerElement(variableName) -// > RealElement(variableName) -// > StringElement(variableName) -// And their value as -// > BooleanElement.value(variableName,value) -// > IntegerElement.value(variableName,value) -// > RealElement.value(variableName,value) -// > StringElement.value(variableName,value) -// Whether a value is set is defined by: -// > PrimitiveElement.valueSet(variableName,isFilled); -////////// -// 1.1.3 domain-specific Type Indexers -////////// -/** - * An element must be an instance of type "FamilyTree class". - */ -private pattern mustInstanceOfFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { - Type.name(type,"FamilyTree class"); - find directInstanceOf(problem,interpretation,element,type); -} -private pattern scopeDisallowsNewFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation) { - find interpretation(problem,interpretation); - PartialInterpretation.scopes(interpretation,scope); - Scope.targetTypeInterpretation(scope,typeInterpretation); - Scope.maxNewElements(scope,0); - PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type); - Type.name(type,"FamilyTree class"); -} - -/** - * An element may be an instance of type "FamilyTree class". - */ -private pattern mayInstanceOfFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.newElements(interpretation,element); - neg find mustInstanceOfMember_class(problem,interpretation,element); - neg find scopeDisallowsNewFamilyTree_class(problem, interpretation); - neg find isPrimitive(element); -} or { - find interpretation(problem,interpretation); - PartialInterpretation.openWorldElements(interpretation,element); - neg find mustInstanceOfMember_class(problem,interpretation,element); - neg find scopeDisallowsNewFamilyTree_class(problem, interpretation); - neg find isPrimitive(element); -} or -{ find mustInstanceOfFamilyTree_class(problem,interpretation,element); } -/** - * An element must be an instance of type "Member class". - */ -private pattern mustInstanceOfMember_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) { - Type.name(type,"Member class"); - find directInstanceOf(problem,interpretation,element,type); -} -private pattern scopeDisallowsNewMember_class(problem:LogicProblem, interpretation:PartialInterpretation) { - find interpretation(problem,interpretation); - PartialInterpretation.scopes(interpretation,scope); - Scope.targetTypeInterpretation(scope,typeInterpretation); - Scope.maxNewElements(scope,0); - PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type); - Type.name(type,"Member class"); -} - -/** - * An element may be an instance of type "Member class". - */ -private pattern mayInstanceOfMember_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.newElements(interpretation,element); - neg find mustInstanceOfFamilyTree_class(problem,interpretation,element); - neg find scopeDisallowsNewMember_class(problem, interpretation); - neg find isPrimitive(element); -} or { - find interpretation(problem,interpretation); - PartialInterpretation.openWorldElements(interpretation,element); - neg find mustInstanceOfFamilyTree_class(problem,interpretation,element); - neg find scopeDisallowsNewMember_class(problem, interpretation); - neg find isPrimitive(element); -} or -{ find mustInstanceOfMember_class(problem,interpretation,element); } - -////////// -// 1.2 Relation Declaration Indexers -////////// -/** - * Matcher for detecting tuples t where []members reference FamilyTree(source,target) - */ -private pattern mustInRelationmembers_reference_FamilyTree( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); - PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"members reference FamilyTree"); - PartialRelationInterpretation.relationlinks(relationIterpretation,link); - BinaryElementRelationLink.param1(link,source); - BinaryElementRelationLink.param2(link,target); -} -/** - * Matcher for detecting tuples t where <>members reference FamilyTree(source,target) - */ -private pattern mayInRelationmembers_reference_FamilyTree( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - // The two endpoint of the link have to exist - find mayExist(problem, interpretation, source); - find mayExist(problem, interpretation, target); - // Type consistency - find mayInstanceOfFamilyTree_class(problem,interpretation,source); - find mayInstanceOfMember_class(problem,interpretation,target); - // The reference is containment, then a new reference cannot be create if: - // 1. Multiple parents - neg find mustContains4(problem,interpretation,_,target); - // 2. Circle in the containment hierarchy - neg find mustTransitiveContains(source,target); -} or { - find mustInRelationmembers_reference_FamilyTree(problem,interpretation,source,target); -} -/** - * Matcher for detecting tuples t where []children reference Member(source,target) - */ -private pattern mustInRelationchildren_reference_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); - PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"children reference Member"); - PartialRelationInterpretation.relationlinks(relationIterpretation,link); - BinaryElementRelationLink.param1(link,source); - BinaryElementRelationLink.param2(link,target); -} -/** - * Matcher for detecting tuples t where <>children reference Member(source,target) - */ -private pattern mayInRelationchildren_reference_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - // The two endpoint of the link have to exist - find mayExist(problem, interpretation, source); - find mayExist(problem, interpretation, target); - // Type consistency - find mayInstanceOfMember_class(problem,interpretation,source); - find mayInstanceOfMember_class(problem,interpretation,target); - // There are "numberOfExistingReferences" currently existing instances of the reference to the target, - // the upper bound of the opposite reference multiplicity should be considered. - numberOfExistingOppositeReferences == count find mustInRelationparents_reference_Member(problem,interpretation,target,_); - check(numberOfExistingOppositeReferences < 2); -} or { - find mustInRelationchildren_reference_Member(problem,interpretation,source,target); -} -/** - * Matcher for detecting tuples t where []parents reference Member(source,target) - */ -private pattern mustInRelationparents_reference_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); - PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"parents reference Member"); - PartialRelationInterpretation.relationlinks(relationIterpretation,link); - BinaryElementRelationLink.param1(link,source); - BinaryElementRelationLink.param2(link,target); -} -/** - * Matcher for detecting tuples t where <>parents reference Member(source,target) - */ -private pattern mayInRelationparents_reference_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - // The two endpoint of the link have to exist - find mayExist(problem, interpretation, source); - find mayExist(problem, interpretation, target); - // Type consistency - find mayInstanceOfMember_class(problem,interpretation,source); - find mayInstanceOfMember_class(problem,interpretation,target); - // There are "numberOfExistingReferences" currently existing instances of the reference from the source, - // the upper bound of the multiplicity should be considered. - numberOfExistingReferences == count find mustInRelationparents_reference_Member(problem,interpretation,source,_); - check(numberOfExistingReferences < 2); -} or { - find mustInRelationparents_reference_Member(problem,interpretation,source,target); -} -/** - * Matcher for detecting tuples t where []name attribute Member(source,target) - */ -private pattern mustInRelationname_attribute_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); - PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"name attribute Member"); - PartialRelationInterpretation.relationlinks(relationIterpretation,link); - BinaryElementRelationLink.param1(link,source); - BinaryElementRelationLink.param2(link,target); -} -/** - * Matcher for detecting tuples t where <>name attribute Member(source,target) - */ -private pattern mayInRelationname_attribute_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - // The two endpoint of the link have to exist - find mayExist(problem, interpretation, source); - find mayExist(problem, interpretation, target); - // Type consistency - find mayInstanceOfMember_class(problem,interpretation,source); - StringElement(target); - // There are "numberOfExistingReferences" currently existing instances of the reference from the source, - // the upper bound of the multiplicity should be considered. - numberOfExistingReferences == count find mustInRelationname_attribute_Member(problem,interpretation,source,_); - check(numberOfExistingReferences < 1); -} or { - find mustInRelationname_attribute_Member(problem,interpretation,source,target); -} -/** - * Matcher for detecting tuples t where []age attribute Member(source,target) - */ -private pattern mustInRelationage_attribute_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); - PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"age attribute Member"); - PartialRelationInterpretation.relationlinks(relationIterpretation,link); - BinaryElementRelationLink.param1(link,source); - BinaryElementRelationLink.param2(link,target); -} -/** - * Matcher for detecting tuples t where <>age attribute Member(source,target) - */ -private pattern mayInRelationage_attribute_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target:DefinedElement) -{ - find interpretation(problem,interpretation); - // The two endpoint of the link have to exist - find mayExist(problem, interpretation, source); - find mayExist(problem, interpretation, target); - // Type consistency - find mayInstanceOfMember_class(problem,interpretation,source); - IntegerElement(target); - // There are "numberOfExistingReferences" currently existing instances of the reference from the source, - // the upper bound of the multiplicity should be considered. - numberOfExistingReferences == count find mustInRelationage_attribute_Member(problem,interpretation,source,_); - check(numberOfExistingReferences < 1); -} or { - find mustInRelationage_attribute_Member(problem,interpretation,source,target); -} - -////////// -// 1.3 Relation Definition Indexers -////////// -// Must, May and Current queries for pattern queries memberIsItsOwnParent -private pattern mustInRelation_pattern_queries_memberIsItsOwnParent( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m) -{ - find interpretation(problem,interpretation); - var_m == var_p; - find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p); - find mustInRelationparents_reference_Member(problem,interpretation,var_p,var_p); -} -private pattern mayInRelation_pattern_queries_memberIsItsOwnParent( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m) -{ - find interpretation(problem,interpretation); - var_m == var_p; - find mayInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p); - find mayInRelationparents_reference_Member(problem,interpretation,var_p,var_p); -} -private pattern currentInRelation_pattern_queries_memberIsItsOwnParent( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m) -{ - find interpretation(problem,interpretation); - var_m == var_p; - find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p); - find mustInRelationparents_reference_Member(problem,interpretation,var_p,var_p); -} -// Must, May and Current queries for pattern queries twoMembersHaveNoParent -private pattern mustInRelation_pattern_queries_twoMembersHaveNoParent( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m1, var_m2) -{ - find interpretation(problem,interpretation); - // var_m1 exported - // var_m2 exported - find mustInstanceOfMember_class(problem,interpretation,var_m1); - find mustInstanceOfMember_class(problem,interpretation,var_m2); - neg find mayInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1); - neg find mayInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2); - neg find mayEquivalent(problem, interpretation, var_m1, var_m2); -} -private pattern mayInRelation_pattern_queries_twoMembersHaveNoParent( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m1, var_m2) -{ - find interpretation(problem,interpretation); - // var_m1 exported - // var_m2 exported - find mayInstanceOfMember_class(problem,interpretation,var_m1); - find mayInstanceOfMember_class(problem,interpretation,var_m2); - neg find mustInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1); - neg find mustInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2); - neg find mustEquivalent(problem, interpretation, var_m1, var_m2); -} -private pattern currentInRelation_pattern_queries_twoMembersHaveNoParent( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m1, var_m2) -{ - find interpretation(problem,interpretation); - // var_m1 exported - // var_m2 exported - find mustInstanceOfMember_class(problem,interpretation,var_m1); - find mustInstanceOfMember_class(problem,interpretation,var_m2); - neg find currentInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1); - neg find currentInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2); - neg find mustEquivalent(problem, interpretation, var_m1, var_m2); -} -// Must, May and Current queries for pattern queries memberHasParent -private pattern mustInRelation_pattern_queries_memberHasParent( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m) -{ - find interpretation(problem,interpretation); - // var_m exported - find mustInRelationparents_reference_Member(problem,interpretation,var_m,var__0); - find mustInstanceOfMember_class(problem,interpretation,var__0); -} -private pattern mayInRelation_pattern_queries_memberHasParent( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m) -{ - find interpretation(problem,interpretation); - // var_m exported - find mayInRelationparents_reference_Member(problem,interpretation,var_m,var__0); - find mayInstanceOfMember_class(problem,interpretation,var__0); -} -private pattern currentInRelation_pattern_queries_memberHasParent( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m) -{ - find interpretation(problem,interpretation); - // var_m exported - find mustInRelationparents_reference_Member(problem,interpretation,var_m,var__0); - find mustInstanceOfMember_class(problem,interpretation,var__0); -} -// Must, May and Current queries for pattern queries parentTooYoung -private pattern mustInRelation_pattern_queries_parentTooYoung( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m, var_p) -{ - find interpretation(problem,interpretation); - // var_m exported - // var_p exported - find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m); - find mustInRelationparents_reference_Member(problem,interpretation,var_m,var_p); - find mustInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge); - find mustInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge); - PrimitiveElement.valueSet(var_mAge,true); IntegerElement.value(var_mAge,value_var_mAge); - PrimitiveElement.valueSet(var_pAge,true); IntegerElement.value(var_pAge,value_var_pAge); - check((value_var_mAge<=(value_var_pAge+12))); -} -private pattern mayInRelation_pattern_queries_parentTooYoung( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m, var_p) -{ - find interpretation(problem,interpretation); - // var_m exported - // var_p exported - find mayInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m); - find mayInRelationparents_reference_Member(problem,interpretation,var_m,var_p); - find mayInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge); - find mayInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge); - PrimitiveElement.valueSet(var_mAge,setted_var_mAge); IntegerElement.value(var_mAge,value_var_mAge); - PrimitiveElement.valueSet(var_pAge,setted_var_pAge); IntegerElement.value(var_pAge,value_var_pAge); - check( - !setted_var_mAge || !setted_var_pAge - || - ((value_var_mAge<=(value_var_pAge+12))) - ); -} -private pattern currentInRelation_pattern_queries_parentTooYoung( - problem:LogicProblem, interpretation:PartialInterpretation, - var_m, var_p) -{ - find interpretation(problem,interpretation); - // var_m exported - // var_p exported - find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m); - find mustInRelationparents_reference_Member(problem,interpretation,var_m,var_p); - find mustInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge); - find mustInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge); - PrimitiveElement.valueSet(var_mAge,true); IntegerElement.value(var_mAge,value_var_mAge); - PrimitiveElement.valueSet(var_pAge,true); IntegerElement.value(var_pAge,value_var_pAge); - check((value_var_mAge<=(value_var_pAge+12))); -} - -////////// -// 1.4 Containment Indexer -////////// -private pattern mustContains2(source: DefinedElement, target: DefinedElement) { - find mustContains4(_,_,source,target); -} - -private pattern mustContains4(problem:LogicProblem, interpretation:PartialInterpretation, - source: DefinedElement, target: DefinedElement) - { find mustInRelationmembers_reference_FamilyTree(problem,interpretation,source,target); } - -private pattern mustTransitiveContains(source,target) { - find mustContains2+(source,target); -} - -////////// -// 2. Invalidation Indexers -////////// -// 2.1 Invalidated by WF Queries -////////// -pattern invalidatedBy_pattern_queries_memberIsItsOwnParent(problem:LogicProblem, interpretation:PartialInterpretation, - var_m) -{ - find mustInRelation_pattern_queries_memberIsItsOwnParent(problem,interpretation,var_m); -} -pattern invalidatedBy_pattern_queries_twoMembersHaveNoParent(problem:LogicProblem, interpretation:PartialInterpretation, - var_m1, var_m2) -{ - find mustInRelation_pattern_queries_twoMembersHaveNoParent(problem,interpretation,var_m1,var_m2); -} -pattern invalidatedBy_pattern_queries_parentTooYoung(problem:LogicProblem, interpretation:PartialInterpretation, - var_m, var_p) -{ - find mustInRelation_pattern_queries_parentTooYoung(problem,interpretation,var_m,var_p); -} - -////////// -// 3. Unfinishedness Indexers -////////// -// 3.1 Unfinishedness Measured by Multiplicity -////////// - -////////// -// 3.2 Unfinishedness Measured by WF Queries -////////// -pattern unfinishedBy_pattern_queries_memberIsItsOwnParent(problem:LogicProblem, interpretation:PartialInterpretation, - var_m) -{ - find currentInRelation_pattern_queries_memberIsItsOwnParent(problem,interpretation,var_m); -} -pattern unfinishedBy_pattern_queries_twoMembersHaveNoParent(problem:LogicProblem, interpretation:PartialInterpretation, - var_m1, var_m2) -{ - find currentInRelation_pattern_queries_twoMembersHaveNoParent(problem,interpretation,var_m1,var_m2); -} -pattern unfinishedBy_pattern_queries_parentTooYoung(problem:LogicProblem, interpretation:PartialInterpretation, - var_m, var_p) -{ - find currentInRelation_pattern_queries_parentTooYoung(problem,interpretation,var_m,var_p); -} - -////////// -// 4. Refinement Indexers -////////// -// 4.1 Object constructors -////////// -private pattern hasElementInContainment(problem:LogicProblem, interpretation:PartialInterpretation) -{ - find interpretation(problem,interpretation); - find mustInstanceOfFamilyTree_class(problem,interpretation,root); - find mustExist(problem, interpretation, root); -}or{ - find interpretation(problem,interpretation); - find mustInstanceOfMember_class(problem,interpretation,root); - find mustExist(problem, interpretation, root); -} -pattern createObject_Member_class_by_members_reference_FamilyTree( - problem:LogicProblem, interpretation:PartialInterpretation, - relationInterpretation:PartialRelationInterpretation, typeInterpretation:PartialComplexTypeInterpretation, - container:DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); - PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"Member class"); - PartialInterpretation.partialrelationinterpretation(interpretation,relationInterpretation); - PartialRelationInterpretation.interpretationOf.name(relationInterpretation,"members reference FamilyTree"); - find mustInstanceOfFamilyTree_class(problem,interpretation,container); - find mayInstanceOfMember_class(problem,interpretation,newObject); - find mayInRelationmembers_reference_FamilyTree(problem,interpretation,container,newObject); - find mustExist(problem, interpretation, container); - neg find mustExist(problem, interpretation, newObject); -} -pattern createObject_Member_class( - problem:LogicProblem, interpretation:PartialInterpretation, - typeInterpretation:PartialComplexTypeInterpretation) -{ - find interpretation(problem,interpretation); - neg find hasElementInContainment(problem,interpretation); - PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); - PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"Member class"); - find mayInstanceOfMember_class(problem,interpretation,newObject); - find mayExist(problem, interpretation, newObject); - neg find mustExist(problem, interpretation, newObject); -} -pattern createObject_FamilyTree_class( - problem:LogicProblem, interpretation:PartialInterpretation, - typeInterpretation:PartialComplexTypeInterpretation) -{ - find interpretation(problem,interpretation); - neg find hasElementInContainment(problem,interpretation); - PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation); - PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"FamilyTree class"); - find mayInstanceOfFamilyTree_class(problem,interpretation,newObject); - find mayExist(problem, interpretation, newObject); - neg find mustExist(problem, interpretation, newObject); -} - -////////// -// 4.2 Type refinement -////////// -pattern refineTypeTo_Member_class(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) { - find interpretation(problem,interpretation); - PartialInterpretation.newElements(interpretation,element); - find mayInstanceOfMember_class(problem,interpretation,element); - neg find mustInstanceOfMember_class(problem,interpretation,element); - neg find mustInstanceOfFamilyTree_class(problem,interpretation,element); -} -pattern refineTypeTo_FamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) { - find interpretation(problem,interpretation); - PartialInterpretation.newElements(interpretation,element); - find mayInstanceOfFamilyTree_class(problem,interpretation,element); - neg find mustInstanceOfMember_class(problem,interpretation,element); - neg find mustInstanceOfFamilyTree_class(problem,interpretation,element); -} - -////////// -// 4.3 Relation refinement -////////// -pattern refineRelation_children_reference_Member_and_parents_reference_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - relationIterpretation:PartialRelationInterpretation, oppositeInterpretation:PartialRelationInterpretation, - from: DefinedElement, to: DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); - PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"children reference Member"); - PartialInterpretation.partialrelationinterpretation(interpretation,oppositeInterpretation); - PartialRelationInterpretation.interpretationOf.name(oppositeInterpretation,"parents reference Member"); - find mustExist(problem, interpretation, from); - find mustExist(problem, interpretation, to); - find mustInstanceOfMember_class(problem,interpretation,from); - find mustInstanceOfMember_class(problem,interpretation,to); - find mayInRelationchildren_reference_Member(problem,interpretation,from,to); - neg find mustInRelationchildren_reference_Member(problem,interpretation,from,to); -} -pattern refineRelation_name_attribute_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - relationIterpretation:PartialRelationInterpretation, - from: DefinedElement, to: DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); - PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"name attribute Member"); - find mustExist(problem, interpretation, from); - find mustExist(problem, interpretation, to); - find mustInstanceOfMember_class(problem,interpretation,from); - StringElement(to); - find mayInRelationname_attribute_Member(problem,interpretation,from,to); - neg find mustInRelationname_attribute_Member(problem,interpretation,from,to); -} -pattern refineRelation_age_attribute_Member( - problem:LogicProblem, interpretation:PartialInterpretation, - relationIterpretation:PartialRelationInterpretation, - from: DefinedElement, to: DefinedElement) -{ - find interpretation(problem,interpretation); - PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation); - PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"age attribute Member"); - find mustExist(problem, interpretation, from); - find mustExist(problem, interpretation, to); - find mustInstanceOfMember_class(problem,interpretation,from); - IntegerElement(to); - find mayInRelationage_attribute_Member(problem,interpretation,from,to); - neg find mustInRelationage_attribute_Member(problem,interpretation,from,to); -} - -////////// -// 5 Unit Propagations -////////// - -// Main propagations: - 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 @@ -Model 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 @@ -graph -[ - node - [ - id 0 - graphics - [ - w 41.800000000000004 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "true" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 1 - graphics - [ - w 50.6 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "false" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 2 - graphics - [ - w 15.400000000000002 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "1" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 3 - graphics - [ - w 15.400000000000002 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "2" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 4 - graphics - [ - w 15.400000000000002 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "3" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 5 - graphics - [ - w 15.400000000000002 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "4" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 6 - graphics - [ - w 15.400000000000002 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "5" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 7 - graphics - [ - w 138.60000000000002 - h 40 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "null" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - FamilyTree class - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 8 - graphics - [ - w 107.80000000000001 - h 40 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "null" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - Member class - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 9 - graphics - [ - w 107.80000000000001 - h 40 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "null" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - Member class - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 10 - graphics - [ - w 107.80000000000001 - h 40 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "null" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - Member class - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 11 - graphics - [ - w 107.80000000000001 - h 40 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "null" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - Member class - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 12 - graphics - [ - w 107.80000000000001 - h 40 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "null" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - Member class - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 13 - graphics - [ - w 85.80000000000001 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "New Reals" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 14 - graphics - [ - w 103.4 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "New Strings" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - - node - [ - id 15 - graphics - [ - w 103.4 - h 26 - type "rectangle" - fill "#FFFFFF" - fill2 "#FFFFFF" - outline "#000000" - ] - LabelGraphics - [ - text "New Objects" - outline "#000000" - fill "#FFFFFF" - fontSize 16 - fontName "Monospace" - autoSizePolicy "node_width" - anchor "t" - borderDistance 0.0 - ] - LabelGraphics - [ - text " - " - fontSize 14 - fontName "Consolas" - alignment "left" - anchor "tl" - borderDistance 6 - ] - ] - edge - [ - source 7 - target 8 - graphics - [ - fill "#000000" - width 3 - targetArrow "standard" - ] - LabelGraphics - [ - text "members reference FamilyTree" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 7 - target 9 - graphics - [ - fill "#000000" - width 3 - targetArrow "standard" - ] - LabelGraphics - [ - text "members reference FamilyTree" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 7 - target 10 - graphics - [ - fill "#000000" - width 3 - targetArrow "standard" - ] - LabelGraphics - [ - text "members reference FamilyTree" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 7 - target 11 - graphics - [ - fill "#000000" - width 3 - targetArrow "standard" - ] - LabelGraphics - [ - text "members reference FamilyTree" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 7 - target 12 - graphics - [ - fill "#000000" - width 3 - targetArrow "standard" - ] - LabelGraphics - [ - text "members reference FamilyTree" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 9 - target 8 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "children reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 8 - target 9 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "children reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 9 - target 10 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "children reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 11 - target 9 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "children reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 9 - target 11 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "children reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 8 - target 9 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "parents reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 9 - target 8 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "parents reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 10 - target 9 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "parents reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 9 - target 11 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "parents reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 11 - target 9 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "parents reference Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 8 - target 6 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "age attribute Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 10 - target 3 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "age attribute Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] - edge - [ - source 11 - target 3 - graphics - [ - fill "#000000" - targetArrow "standard" - ] - LabelGraphics - [ - text "age attribute Member" - fontSize 14 - fontName "Consolas" - configuration "AutoFlippingLabel" - model "six_pos" - position "thead" - ] - ] -] - 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 Binary files a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/models/1.png and /dev/null 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 @@ - - - - - - - - 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 Binary files a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.FamilyTreeConstraints.java._trace and /dev/null 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 Binary files a/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/src-gen/queries/.MemberIsItsOwnParent.java._trace and /dev/null 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 @@ -/.FamilyTreeConstraints.java._trace -/.MemberIsItsOwnParent.java._trace -/FamilyTreeConstraints.java -/MemberIsItsOwnParent.java -/.ParentTooYoung.java._trace -/.MemberHasNoParent.java._trace -/.MemberHasParent.java._trace -/.TwoMembersHaveNoParent.java._trace -/.NegativeAge.java._trace -/MemberHasParent.java -/NegativeAge.java -/ParentTooYoung.java -/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 @@ -/** - * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql - */ -package queries; - -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; -import queries.MemberHasParent; -import queries.MemberIsItsOwnParent; -import queries.NegativeAge; -import queries.ParentTooYoung; -import queries.TwoMembersHaveNoParent; - -/** - * A pattern group formed of all public patterns defined in familyTreeConstraints.vql. - * - *

Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare - * a VIATRA Query engine for matching all patterns originally defined in file familyTreeConstraints.vql, - * in order to achieve better performance than one-by-one on-demand matcher initialization. - * - *

From package queries, the group contains the definition of the following patterns:

    - *
  • memberIsItsOwnParent
  • - *
  • twoMembersHaveNoParent
  • - *
  • memberHasParent
  • - *
  • negativeAge
  • - *
  • parentTooYoung
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class FamilyTreeConstraints extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static FamilyTreeConstraints instance() { - if (INSTANCE == null) { - INSTANCE = new FamilyTreeConstraints(); - } - return INSTANCE; - } - - private static FamilyTreeConstraints INSTANCE; - - private FamilyTreeConstraints() { - querySpecifications.add(MemberIsItsOwnParent.instance()); - querySpecifications.add(TwoMembersHaveNoParent.instance()); - querySpecifications.add(MemberHasParent.instance()); - querySpecifications.add(NegativeAge.instance()); - querySpecifications.add(ParentTooYoung.instance()); - } - - public MemberIsItsOwnParent getMemberIsItsOwnParent() { - return MemberIsItsOwnParent.instance(); - } - - public MemberIsItsOwnParent.Matcher getMemberIsItsOwnParent(final ViatraQueryEngine engine) { - return MemberIsItsOwnParent.Matcher.on(engine); - } - - public TwoMembersHaveNoParent getTwoMembersHaveNoParent() { - return TwoMembersHaveNoParent.instance(); - } - - public TwoMembersHaveNoParent.Matcher getTwoMembersHaveNoParent(final ViatraQueryEngine engine) { - return TwoMembersHaveNoParent.Matcher.on(engine); - } - - public MemberHasParent getMemberHasParent() { - return MemberHasParent.instance(); - } - - public MemberHasParent.Matcher getMemberHasParent(final ViatraQueryEngine engine) { - return MemberHasParent.Matcher.on(engine); - } - - public NegativeAge getNegativeAge() { - return NegativeAge.instance(); - } - - public NegativeAge.Matcher getNegativeAge(final ViatraQueryEngine engine) { - return NegativeAge.Matcher.on(engine); - } - - public ParentTooYoung getParentTooYoung() { - return ParentTooYoung.instance(); - } - - public ParentTooYoung.Matcher getParentTooYoung(final ViatraQueryEngine engine) { - return ParentTooYoung.Matcher.on(engine); - } -} 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 @@ -/** - * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql - */ -package queries; - -import familytree.Member; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern memberHasParent(m: Member) = {
- *         	Member.parents(m, _);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class MemberHasParent extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the queries.memberHasParent pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Member fM; - - private static List parameterNames = makeImmutableList("m"); - - private Match(final Member pM) { - this.fM = pM; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "m": return this.fM; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fM; - default: return null; - } - } - - public Member getM() { - return this.fM; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("m".equals(parameterName) ) { - this.fM = (Member) newValue; - return true; - } - return false; - } - - public void setM(final Member pM) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fM = pM; - } - - @Override - public String patternName() { - return "queries.memberHasParent"; - } - - @Override - public List parameterNames() { - return MemberHasParent.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fM}; - } - - @Override - public MemberHasParent.Match toImmutable() { - return isMutable() ? newMatch(fM) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"m\"=" + prettyPrintValue(fM)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fM); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof MemberHasParent.Match)) { - MemberHasParent.Match other = (MemberHasParent.Match) obj; - return Objects.equals(fM, other.fM); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public MemberHasParent specification() { - return MemberHasParent.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static MemberHasParent.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static MemberHasParent.Match newMutableMatch(final Member pM) { - return new Mutable(pM); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the (partial) match object. - * - */ - public static MemberHasParent.Match newMatch(final Member pM) { - return new Immutable(pM); - } - - private static final class Mutable extends MemberHasParent.Match { - Mutable(final Member pM) { - super(pM); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends MemberHasParent.Match { - Immutable(final Member pM) { - super(pM); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the queries.memberHasParent pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * pattern memberHasParent(m: Member) = {
-   * 	Member.parents(m, _);
-   * }
-   * 
- * - * @see Match - * @see MemberHasParent - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static MemberHasParent.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static MemberHasParent.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_M = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MemberHasParent.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Member pM) { - return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Member pM) { - return rawStreamAllMatches(new Object[]{pM}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Member pM) { - return rawGetOneArbitraryMatch(new Object[]{pM}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Member pM) { - return rawHasMatch(new Object[]{pM}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Member pM) { - return rawCountMatches(new Object[]{pM}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Member pM, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pM}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the (partial) match object. - * - */ - public MemberHasParent.Match newMatch(final Member pM) { - return MemberHasParent.Match.newMatch(pM); - } - - /** - * Retrieve the set of values that occur in matches for m. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfm(final Object[] parameters) { - return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for m. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfm() { - return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for m. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfm() { - return rawStreamAllValuesOfm(emptyArray()); - } - - @Override - protected MemberHasParent.Match tupleToMatch(final Tuple t) { - try { - return MemberHasParent.Match.newMatch((Member) t.get(POSITION_M)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected MemberHasParent.Match arrayToMatch(final Object[] match) { - try { - return MemberHasParent.Match.newMatch((Member) match[POSITION_M]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected MemberHasParent.Match arrayToMatchMutable(final Object[] match) { - try { - return MemberHasParent.Match.newMutableMatch((Member) match[POSITION_M]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return MemberHasParent.instance(); - } - } - - private MemberHasParent() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static MemberHasParent instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected MemberHasParent.Matcher instantiate(final ViatraQueryEngine engine) { - return MemberHasParent.Matcher.on(engine); - } - - @Override - public MemberHasParent.Matcher instantiate() { - return MemberHasParent.Matcher.create(); - } - - @Override - public MemberHasParent.Match newEmptyMatch() { - return MemberHasParent.Match.newEmptyMatch(); - } - - @Override - public MemberHasParent.Match newMatch(final Object... parameters) { - return MemberHasParent.Match.newMatch((familytree.Member) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link MemberHasParent} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link MemberHasParent#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final MemberHasParent INSTANCE = new MemberHasParent(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final MemberHasParent.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_m); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "queries.memberHasParent"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("m"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_m = body.getOrCreateVariableByName("m"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_m, parameter_m) - )); - // Member.parents(m, _) - new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "parents"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - new Equality(body, var__virtual_0_, var___0_); - bodies.add(body); - } - return bodies; - } - } -} 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 @@ -/** - * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql - */ -package queries; - -import familytree.Member; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; -import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         {@literal @}Constraint(message="memberIsItsOwnParent", severity="error", key={m})
- *         pattern memberIsItsOwnParent(m: Member) = {
- *         	FamilyTree.members(_, m);
- *         	Member.parents(m, p);
- *         	m == p;
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class MemberIsItsOwnParent extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the queries.memberIsItsOwnParent pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Member fM; - - private static List parameterNames = makeImmutableList("m"); - - private Match(final Member pM) { - this.fM = pM; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "m": return this.fM; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fM; - default: return null; - } - } - - public Member getM() { - return this.fM; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("m".equals(parameterName) ) { - this.fM = (Member) newValue; - return true; - } - return false; - } - - public void setM(final Member pM) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fM = pM; - } - - @Override - public String patternName() { - return "queries.memberIsItsOwnParent"; - } - - @Override - public List parameterNames() { - return MemberIsItsOwnParent.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fM}; - } - - @Override - public MemberIsItsOwnParent.Match toImmutable() { - return isMutable() ? newMatch(fM) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"m\"=" + prettyPrintValue(fM)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fM); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof MemberIsItsOwnParent.Match)) { - MemberIsItsOwnParent.Match other = (MemberIsItsOwnParent.Match) obj; - return Objects.equals(fM, other.fM); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public MemberIsItsOwnParent specification() { - return MemberIsItsOwnParent.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static MemberIsItsOwnParent.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static MemberIsItsOwnParent.Match newMutableMatch(final Member pM) { - return new Mutable(pM); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the (partial) match object. - * - */ - public static MemberIsItsOwnParent.Match newMatch(final Member pM) { - return new Immutable(pM); - } - - private static final class Mutable extends MemberIsItsOwnParent.Match { - Mutable(final Member pM) { - super(pM); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends MemberIsItsOwnParent.Match { - Immutable(final Member pM) { - super(pM); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the queries.memberIsItsOwnParent pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * {@literal @}Constraint(message="memberIsItsOwnParent", severity="error", key={m})
-   * pattern memberIsItsOwnParent(m: Member) = {
-   * 	FamilyTree.members(_, m);
-   * 	Member.parents(m, p);
-   * 	m == p;
-   * }
-   * 
- * - * @see Match - * @see MemberIsItsOwnParent - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static MemberIsItsOwnParent.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static MemberIsItsOwnParent.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_M = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MemberIsItsOwnParent.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Member pM) { - return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Member pM) { - return rawStreamAllMatches(new Object[]{pM}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Member pM) { - return rawGetOneArbitraryMatch(new Object[]{pM}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Member pM) { - return rawHasMatch(new Object[]{pM}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Member pM) { - return rawCountMatches(new Object[]{pM}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Member pM, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pM}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the (partial) match object. - * - */ - public MemberIsItsOwnParent.Match newMatch(final Member pM) { - return MemberIsItsOwnParent.Match.newMatch(pM); - } - - /** - * Retrieve the set of values that occur in matches for m. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfm(final Object[] parameters) { - return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for m. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfm() { - return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for m. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfm() { - return rawStreamAllValuesOfm(emptyArray()); - } - - @Override - protected MemberIsItsOwnParent.Match tupleToMatch(final Tuple t) { - try { - return MemberIsItsOwnParent.Match.newMatch((Member) t.get(POSITION_M)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected MemberIsItsOwnParent.Match arrayToMatch(final Object[] match) { - try { - return MemberIsItsOwnParent.Match.newMatch((Member) match[POSITION_M]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected MemberIsItsOwnParent.Match arrayToMatchMutable(final Object[] match) { - try { - return MemberIsItsOwnParent.Match.newMutableMatch((Member) match[POSITION_M]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return MemberIsItsOwnParent.instance(); - } - } - - private MemberIsItsOwnParent() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static MemberIsItsOwnParent instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected MemberIsItsOwnParent.Matcher instantiate(final ViatraQueryEngine engine) { - return MemberIsItsOwnParent.Matcher.on(engine); - } - - @Override - public MemberIsItsOwnParent.Matcher instantiate() { - return MemberIsItsOwnParent.Matcher.create(); - } - - @Override - public MemberIsItsOwnParent.Match newEmptyMatch() { - return MemberIsItsOwnParent.Match.newEmptyMatch(); - } - - @Override - public MemberIsItsOwnParent.Match newMatch(final Object... parameters) { - return MemberIsItsOwnParent.Match.newMatch((familytree.Member) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link MemberIsItsOwnParent} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link MemberIsItsOwnParent#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final MemberIsItsOwnParent INSTANCE = new MemberIsItsOwnParent(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final MemberIsItsOwnParent.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_m); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "queries.memberIsItsOwnParent"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("m"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_m = body.getOrCreateVariableByName("m"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var_p = body.getOrCreateVariableByName("p"); - new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_m, parameter_m) - )); - // FamilyTree.members(_, m) - new TypeConstraint(body, Tuples.flatTupleOf(var___0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "FamilyTree"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var___0_, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "FamilyTree", "members"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - new Equality(body, var__virtual_0_, var_m); - // Member.parents(m, p) - new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "parents"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - new Equality(body, var__virtual_1_, var_p); - // m == p - new Equality(body, var_m, var_p); - bodies.add(body); - } - { - PAnnotation annotation = new PAnnotation("Constraint"); - annotation.addAttribute("message", "memberIsItsOwnParent"); - annotation.addAttribute("severity", "error"); - annotation.addAttribute("key", Arrays.asList(new Object[] { - new ParameterReference("m") - })); - addAnnotation(annotation); - } - return bodies; - } - } -} 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 @@ -/** - * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql - */ -package queries; - -import familytree.Member; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; -import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         {@literal @}Constraint(message="negativeAge", severity="error",key={m})
- *         pattern negativeAge(m: Member) {
- *         	Member.age(m,mage);
- *         	check(mage{@literal <}0);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class NegativeAge extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the queries.negativeAge pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Member fM; - - private static List parameterNames = makeImmutableList("m"); - - private Match(final Member pM) { - this.fM = pM; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "m": return this.fM; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fM; - default: return null; - } - } - - public Member getM() { - return this.fM; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("m".equals(parameterName) ) { - this.fM = (Member) newValue; - return true; - } - return false; - } - - public void setM(final Member pM) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fM = pM; - } - - @Override - public String patternName() { - return "queries.negativeAge"; - } - - @Override - public List parameterNames() { - return NegativeAge.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fM}; - } - - @Override - public NegativeAge.Match toImmutable() { - return isMutable() ? newMatch(fM) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"m\"=" + prettyPrintValue(fM)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fM); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof NegativeAge.Match)) { - NegativeAge.Match other = (NegativeAge.Match) obj; - return Objects.equals(fM, other.fM); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public NegativeAge specification() { - return NegativeAge.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static NegativeAge.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static NegativeAge.Match newMutableMatch(final Member pM) { - return new Mutable(pM); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the (partial) match object. - * - */ - public static NegativeAge.Match newMatch(final Member pM) { - return new Immutable(pM); - } - - private static final class Mutable extends NegativeAge.Match { - Mutable(final Member pM) { - super(pM); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends NegativeAge.Match { - Immutable(final Member pM) { - super(pM); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the queries.negativeAge pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * {@literal @}Constraint(message="negativeAge", severity="error",key={m})
-   * pattern negativeAge(m: Member) {
-   * 	Member.age(m,mage);
-   * 	check(mage{@literal <}0);
-   * }
-   * 
- * - * @see Match - * @see NegativeAge - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static NegativeAge.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static NegativeAge.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_M = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NegativeAge.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Member pM) { - return rawStreamAllMatches(new Object[]{pM}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Member pM) { - return rawStreamAllMatches(new Object[]{pM}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Member pM) { - return rawGetOneArbitraryMatch(new Object[]{pM}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Member pM) { - return rawHasMatch(new Object[]{pM}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Member pM) { - return rawCountMatches(new Object[]{pM}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Member pM, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pM}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pM the fixed value of pattern parameter m, or null if not bound. - * @return the (partial) match object. - * - */ - public NegativeAge.Match newMatch(final Member pM) { - return NegativeAge.Match.newMatch(pM); - } - - /** - * Retrieve the set of values that occur in matches for m. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfm(final Object[] parameters) { - return rawStreamAllValues(POSITION_M, parameters).map(Member.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for m. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfm() { - return rawStreamAllValuesOfm(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for m. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfm() { - return rawStreamAllValuesOfm(emptyArray()); - } - - @Override - protected NegativeAge.Match tupleToMatch(final Tuple t) { - try { - return NegativeAge.Match.newMatch((Member) t.get(POSITION_M)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected NegativeAge.Match arrayToMatch(final Object[] match) { - try { - return NegativeAge.Match.newMatch((Member) match[POSITION_M]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected NegativeAge.Match arrayToMatchMutable(final Object[] match) { - try { - return NegativeAge.Match.newMutableMatch((Member) match[POSITION_M]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return NegativeAge.instance(); - } - } - - private NegativeAge() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static NegativeAge instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected NegativeAge.Matcher instantiate(final ViatraQueryEngine engine) { - return NegativeAge.Matcher.on(engine); - } - - @Override - public NegativeAge.Matcher instantiate() { - return NegativeAge.Matcher.create(); - } - - @Override - public NegativeAge.Match newEmptyMatch() { - return NegativeAge.Match.newEmptyMatch(); - } - - @Override - public NegativeAge.Match newMatch(final Object... parameters) { - return NegativeAge.Match.newMatch((familytree.Member) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link NegativeAge} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link NegativeAge#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final NegativeAge INSTANCE = new NegativeAge(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final NegativeAge.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_m = new PParameter("m", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_m); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "queries.negativeAge"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("m"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_m = body.getOrCreateVariableByName("m"); - PVariable var_mage = body.getOrCreateVariableByName("mage"); - new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_m, parameter_m) - )); - // Member.age(m,mage) - new TypeConstraint(body, Tuples.flatTupleOf(var_m), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_m, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "age"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); - new Equality(body, var__virtual_0_, var_mage); - // check(mage<0) - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern negativeAge"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("mage");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Integer mage = (Integer) provider.getValue("mage"); - return evaluateExpression_1_1(mage); - } - }, null); - bodies.add(body); - } - { - PAnnotation annotation = new PAnnotation("Constraint"); - annotation.addAttribute("message", "negativeAge"); - annotation.addAttribute("severity", "error"); - annotation.addAttribute("key", Arrays.asList(new Object[] { - new ParameterReference("m") - })); - addAnnotation(annotation); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1(final Integer mage) { - return ((mage).intValue() < 0); - } -} 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 @@ -/** - * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql - */ -package queries; - -import familytree.Member; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; -import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         {@literal @}Constraint(message="parentTooYoung", severity="error", key={c, p})
- *         pattern parentTooYoung(c: Member, p: Member) = {
- *         	FamilyTree.members(_, c);
- *         	Member.parents(c, p);
- *         	Member.age(c, cAge);
- *         	Member.age(p, pAge);
- *         	check (pAge {@literal <}= (cAge + 12));
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ParentTooYoung extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the queries.parentTooYoung pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Member fC; - - private Member fP; - - private static List parameterNames = makeImmutableList("c", "p"); - - private Match(final Member pC, final Member pP) { - this.fC = pC; - this.fP = pP; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "c": return this.fC; - case "p": return this.fP; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fC; - case 1: return this.fP; - default: return null; - } - } - - public Member getC() { - return this.fC; - } - - public Member getP() { - return this.fP; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("c".equals(parameterName) ) { - this.fC = (Member) newValue; - return true; - } - if ("p".equals(parameterName) ) { - this.fP = (Member) newValue; - return true; - } - return false; - } - - public void setC(final Member pC) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fC = pC; - } - - public void setP(final Member pP) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fP = pP; - } - - @Override - public String patternName() { - return "queries.parentTooYoung"; - } - - @Override - public List parameterNames() { - return ParentTooYoung.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fC, fP}; - } - - @Override - public ParentTooYoung.Match toImmutable() { - return isMutable() ? newMatch(fC, fP) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"c\"=" + prettyPrintValue(fC) + ", "); - result.append("\"p\"=" + prettyPrintValue(fP)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fC, fP); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof ParentTooYoung.Match)) { - ParentTooYoung.Match other = (ParentTooYoung.Match) obj; - return Objects.equals(fC, other.fC) && Objects.equals(fP, other.fP); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public ParentTooYoung specification() { - return ParentTooYoung.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static ParentTooYoung.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @param pP the fixed value of pattern parameter p, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static ParentTooYoung.Match newMutableMatch(final Member pC, final Member pP) { - return new Mutable(pC, pP); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @param pP the fixed value of pattern parameter p, or null if not bound. - * @return the (partial) match object. - * - */ - public static ParentTooYoung.Match newMatch(final Member pC, final Member pP) { - return new Immutable(pC, pP); - } - - private static final class Mutable extends ParentTooYoung.Match { - Mutable(final Member pC, final Member pP) { - super(pC, pP); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends ParentTooYoung.Match { - Immutable(final Member pC, final Member pP) { - super(pC, pP); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the queries.parentTooYoung pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * {@literal @}Constraint(message="parentTooYoung", severity="error", key={c, p})
-   * pattern parentTooYoung(c: Member, p: Member) = {
-   * 	FamilyTree.members(_, c);
-   * 	Member.parents(c, p);
-   * 	Member.age(c, cAge);
-   * 	Member.age(p, pAge);
-   * 	check (pAge {@literal <}= (cAge + 12));
-   * }
-   * 
- * - * @see Match - * @see ParentTooYoung - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static ParentTooYoung.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static ParentTooYoung.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_C = 0; - - private static final int POSITION_P = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ParentTooYoung.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @param pP the fixed value of pattern parameter p, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Member pC, final Member pP) { - return rawStreamAllMatches(new Object[]{pC, pP}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @param pP the fixed value of pattern parameter p, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Member pC, final Member pP) { - return rawStreamAllMatches(new Object[]{pC, pP}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @param pP the fixed value of pattern parameter p, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Member pC, final Member pP) { - return rawGetOneArbitraryMatch(new Object[]{pC, pP}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @param pP the fixed value of pattern parameter p, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Member pC, final Member pP) { - return rawHasMatch(new Object[]{pC, pP}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @param pP the fixed value of pattern parameter p, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Member pC, final Member pP) { - return rawCountMatches(new Object[]{pC, pP}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @param pP the fixed value of pattern parameter p, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Member pC, final Member pP, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pC, pP}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @param pP the fixed value of pattern parameter p, or null if not bound. - * @return the (partial) match object. - * - */ - public ParentTooYoung.Match newMatch(final Member pC, final Member pP) { - return ParentTooYoung.Match.newMatch(pC, pP); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfc(final Object[] parameters) { - return rawStreamAllValues(POSITION_C, parameters).map(Member.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfc() { - return rawStreamAllValuesOfc(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfc() { - return rawStreamAllValuesOfc(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for c. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfc(final ParentTooYoung.Match partialMatch) { - return rawStreamAllValuesOfc(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for c. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfc(final Member pP) { - return rawStreamAllValuesOfc(new Object[]{null, pP}); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfc(final ParentTooYoung.Match partialMatch) { - return rawStreamAllValuesOfc(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfc(final Member pP) { - return rawStreamAllValuesOfc(new Object[]{null, pP}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for p. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfp(final Object[] parameters) { - return rawStreamAllValues(POSITION_P, parameters).map(Member.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for p. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfp() { - return rawStreamAllValuesOfp(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for p. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfp() { - return rawStreamAllValuesOfp(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for p. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfp(final ParentTooYoung.Match partialMatch) { - return rawStreamAllValuesOfp(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for p. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfp(final Member pC) { - return rawStreamAllValuesOfp(new Object[]{pC, null}); - } - - /** - * Retrieve the set of values that occur in matches for p. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfp(final ParentTooYoung.Match partialMatch) { - return rawStreamAllValuesOfp(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for p. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfp(final Member pC) { - return rawStreamAllValuesOfp(new Object[]{pC, null}).collect(Collectors.toSet()); - } - - @Override - protected ParentTooYoung.Match tupleToMatch(final Tuple t) { - try { - return ParentTooYoung.Match.newMatch((Member) t.get(POSITION_C), (Member) t.get(POSITION_P)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected ParentTooYoung.Match arrayToMatch(final Object[] match) { - try { - return ParentTooYoung.Match.newMatch((Member) match[POSITION_C], (Member) match[POSITION_P]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected ParentTooYoung.Match arrayToMatchMutable(final Object[] match) { - try { - return ParentTooYoung.Match.newMutableMatch((Member) match[POSITION_C], (Member) match[POSITION_P]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return ParentTooYoung.instance(); - } - } - - private ParentTooYoung() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static ParentTooYoung instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected ParentTooYoung.Matcher instantiate(final ViatraQueryEngine engine) { - return ParentTooYoung.Matcher.on(engine); - } - - @Override - public ParentTooYoung.Matcher instantiate() { - return ParentTooYoung.Matcher.create(); - } - - @Override - public ParentTooYoung.Match newEmptyMatch() { - return ParentTooYoung.Match.newEmptyMatch(); - } - - @Override - public ParentTooYoung.Match newMatch(final Object... parameters) { - return ParentTooYoung.Match.newMatch((familytree.Member) parameters[0], (familytree.Member) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link ParentTooYoung} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link ParentTooYoung#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final ParentTooYoung INSTANCE = new ParentTooYoung(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final ParentTooYoung.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_c = new PParameter("c", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); - - private final PParameter parameter_p = new PParameter("p", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_c, parameter_p); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "queries.parentTooYoung"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("c","p"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_c = body.getOrCreateVariableByName("c"); - PVariable var_p = body.getOrCreateVariableByName("p"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var_cAge = body.getOrCreateVariableByName("cAge"); - PVariable var_pAge = body.getOrCreateVariableByName("pAge"); - new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_c, parameter_c), - new ExportedParameter(body, var_p, parameter_p) - )); - // FamilyTree.members(_, c) - new TypeConstraint(body, Tuples.flatTupleOf(var___0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "FamilyTree"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var___0_, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "FamilyTree", "members"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - new Equality(body, var__virtual_0_, var_c); - // Member.parents(c, p) - new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_c, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "parents"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - new Equality(body, var__virtual_1_, var_p); - // Member.age(c, cAge) - new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_c, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "age"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); - new Equality(body, var__virtual_2_, var_cAge); - // Member.age(p, pAge) - new TypeConstraint(body, Tuples.flatTupleOf(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_p, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/familytree", "Member", "age"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EInt"))); - new Equality(body, var__virtual_3_, var_pAge); - // check (pAge <= (cAge + 12)) - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern parentTooYoung"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("cAge", "pAge");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Integer cAge = (Integer) provider.getValue("cAge"); - Integer pAge = (Integer) provider.getValue("pAge"); - return evaluateExpression_1_1(cAge, pAge); - } - }, null); - bodies.add(body); - } - { - PAnnotation annotation = new PAnnotation("Constraint"); - annotation.addAttribute("message", "parentTooYoung"); - annotation.addAttribute("severity", "error"); - annotation.addAttribute("key", Arrays.asList(new Object[] { - new ParameterReference("c"), - new ParameterReference("p") - })); - addAnnotation(annotation); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1(final Integer cAge, final Integer pAge) { - return ((pAge).intValue() <= ((cAge).intValue() + 12)); - } -} 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 @@ -/** - * Generated from platform:/resource/case.study.familyTree.run/src/queries/familyTreeConstraints.vql - */ -package queries; - -import familytree.Member; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; -import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; -import queries.MemberHasParent; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         {@literal @}Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2})
- *         pattern twoMembersHaveNoParent(m1:Member, m2:Member) = {
- *         	neg find memberHasParent(m1);
- *         	neg find memberHasParent(m2);
- *         	m1 != m2;
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TwoMembersHaveNoParent extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the queries.twoMembersHaveNoParent pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Member fM1; - - private Member fM2; - - private static List parameterNames = makeImmutableList("m1", "m2"); - - private Match(final Member pM1, final Member pM2) { - this.fM1 = pM1; - this.fM2 = pM2; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "m1": return this.fM1; - case "m2": return this.fM2; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fM1; - case 1: return this.fM2; - default: return null; - } - } - - public Member getM1() { - return this.fM1; - } - - public Member getM2() { - return this.fM2; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("m1".equals(parameterName) ) { - this.fM1 = (Member) newValue; - return true; - } - if ("m2".equals(parameterName) ) { - this.fM2 = (Member) newValue; - return true; - } - return false; - } - - public void setM1(final Member pM1) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fM1 = pM1; - } - - public void setM2(final Member pM2) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fM2 = pM2; - } - - @Override - public String patternName() { - return "queries.twoMembersHaveNoParent"; - } - - @Override - public List parameterNames() { - return TwoMembersHaveNoParent.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fM1, fM2}; - } - - @Override - public TwoMembersHaveNoParent.Match toImmutable() { - return isMutable() ? newMatch(fM1, fM2) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"m1\"=" + prettyPrintValue(fM1) + ", "); - result.append("\"m2\"=" + prettyPrintValue(fM2)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fM1, fM2); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TwoMembersHaveNoParent.Match)) { - TwoMembersHaveNoParent.Match other = (TwoMembersHaveNoParent.Match) obj; - return Objects.equals(fM1, other.fM1) && Objects.equals(fM2, other.fM2); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TwoMembersHaveNoParent specification() { - return TwoMembersHaveNoParent.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TwoMembersHaveNoParent.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pM1 the fixed value of pattern parameter m1, or null if not bound. - * @param pM2 the fixed value of pattern parameter m2, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TwoMembersHaveNoParent.Match newMutableMatch(final Member pM1, final Member pM2) { - return new Mutable(pM1, pM2); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pM1 the fixed value of pattern parameter m1, or null if not bound. - * @param pM2 the fixed value of pattern parameter m2, or null if not bound. - * @return the (partial) match object. - * - */ - public static TwoMembersHaveNoParent.Match newMatch(final Member pM1, final Member pM2) { - return new Immutable(pM1, pM2); - } - - private static final class Mutable extends TwoMembersHaveNoParent.Match { - Mutable(final Member pM1, final Member pM2) { - super(pM1, pM2); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TwoMembersHaveNoParent.Match { - Immutable(final Member pM1, final Member pM2) { - super(pM1, pM2); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the queries.twoMembersHaveNoParent pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * {@literal @}Constraint(message="twoMembersHaveNoParent", severity="error", key={m1, m2})
-   * pattern twoMembersHaveNoParent(m1:Member, m2:Member) = {
-   * 	neg find memberHasParent(m1);
-   * 	neg find memberHasParent(m2);
-   * 	m1 != m2;
-   * }
-   * 
- * - * @see Match - * @see TwoMembersHaveNoParent - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TwoMembersHaveNoParent.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TwoMembersHaveNoParent.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_M1 = 0; - - private static final int POSITION_M2 = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TwoMembersHaveNoParent.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pM1 the fixed value of pattern parameter m1, or null if not bound. - * @param pM2 the fixed value of pattern parameter m2, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Member pM1, final Member pM2) { - return rawStreamAllMatches(new Object[]{pM1, pM2}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pM1 the fixed value of pattern parameter m1, or null if not bound. - * @param pM2 the fixed value of pattern parameter m2, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Member pM1, final Member pM2) { - return rawStreamAllMatches(new Object[]{pM1, pM2}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pM1 the fixed value of pattern parameter m1, or null if not bound. - * @param pM2 the fixed value of pattern parameter m2, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Member pM1, final Member pM2) { - return rawGetOneArbitraryMatch(new Object[]{pM1, pM2}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pM1 the fixed value of pattern parameter m1, or null if not bound. - * @param pM2 the fixed value of pattern parameter m2, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Member pM1, final Member pM2) { - return rawHasMatch(new Object[]{pM1, pM2}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pM1 the fixed value of pattern parameter m1, or null if not bound. - * @param pM2 the fixed value of pattern parameter m2, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Member pM1, final Member pM2) { - return rawCountMatches(new Object[]{pM1, pM2}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pM1 the fixed value of pattern parameter m1, or null if not bound. - * @param pM2 the fixed value of pattern parameter m2, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Member pM1, final Member pM2, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pM1, pM2}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pM1 the fixed value of pattern parameter m1, or null if not bound. - * @param pM2 the fixed value of pattern parameter m2, or null if not bound. - * @return the (partial) match object. - * - */ - public TwoMembersHaveNoParent.Match newMatch(final Member pM1, final Member pM2) { - return TwoMembersHaveNoParent.Match.newMatch(pM1, pM2); - } - - /** - * Retrieve the set of values that occur in matches for m1. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfm1(final Object[] parameters) { - return rawStreamAllValues(POSITION_M1, parameters).map(Member.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for m1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfm1() { - return rawStreamAllValuesOfm1(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for m1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfm1() { - return rawStreamAllValuesOfm1(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for m1. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfm1(final TwoMembersHaveNoParent.Match partialMatch) { - return rawStreamAllValuesOfm1(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for m1. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfm1(final Member pM2) { - return rawStreamAllValuesOfm1(new Object[]{null, pM2}); - } - - /** - * Retrieve the set of values that occur in matches for m1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfm1(final TwoMembersHaveNoParent.Match partialMatch) { - return rawStreamAllValuesOfm1(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for m1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfm1(final Member pM2) { - return rawStreamAllValuesOfm1(new Object[]{null, pM2}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for m2. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfm2(final Object[] parameters) { - return rawStreamAllValues(POSITION_M2, parameters).map(Member.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for m2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfm2() { - return rawStreamAllValuesOfm2(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for m2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfm2() { - return rawStreamAllValuesOfm2(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for m2. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfm2(final TwoMembersHaveNoParent.Match partialMatch) { - return rawStreamAllValuesOfm2(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for m2. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfm2(final Member pM1) { - return rawStreamAllValuesOfm2(new Object[]{pM1, null}); - } - - /** - * Retrieve the set of values that occur in matches for m2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfm2(final TwoMembersHaveNoParent.Match partialMatch) { - return rawStreamAllValuesOfm2(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for m2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfm2(final Member pM1) { - return rawStreamAllValuesOfm2(new Object[]{pM1, null}).collect(Collectors.toSet()); - } - - @Override - protected TwoMembersHaveNoParent.Match tupleToMatch(final Tuple t) { - try { - return TwoMembersHaveNoParent.Match.newMatch((Member) t.get(POSITION_M1), (Member) t.get(POSITION_M2)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TwoMembersHaveNoParent.Match arrayToMatch(final Object[] match) { - try { - return TwoMembersHaveNoParent.Match.newMatch((Member) match[POSITION_M1], (Member) match[POSITION_M2]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TwoMembersHaveNoParent.Match arrayToMatchMutable(final Object[] match) { - try { - return TwoMembersHaveNoParent.Match.newMutableMatch((Member) match[POSITION_M1], (Member) match[POSITION_M2]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TwoMembersHaveNoParent.instance(); - } - } - - private TwoMembersHaveNoParent() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TwoMembersHaveNoParent instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TwoMembersHaveNoParent.Matcher instantiate(final ViatraQueryEngine engine) { - return TwoMembersHaveNoParent.Matcher.on(engine); - } - - @Override - public TwoMembersHaveNoParent.Matcher instantiate() { - return TwoMembersHaveNoParent.Matcher.create(); - } - - @Override - public TwoMembersHaveNoParent.Match newEmptyMatch() { - return TwoMembersHaveNoParent.Match.newEmptyMatch(); - } - - @Override - public TwoMembersHaveNoParent.Match newMatch(final Object... parameters) { - return TwoMembersHaveNoParent.Match.newMatch((familytree.Member) parameters[0], (familytree.Member) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link TwoMembersHaveNoParent} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TwoMembersHaveNoParent#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TwoMembersHaveNoParent INSTANCE = new TwoMembersHaveNoParent(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TwoMembersHaveNoParent.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_m1 = new PParameter("m1", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); - - private final PParameter parameter_m2 = new PParameter("m2", "familytree.Member", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/familytree", "Member")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_m1, parameter_m2); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "queries.twoMembersHaveNoParent"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("m1","m2"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_m1 = body.getOrCreateVariableByName("m1"); - PVariable var_m2 = body.getOrCreateVariableByName("m2"); - new TypeConstraint(body, Tuples.flatTupleOf(var_m1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_m2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/familytree", "Member"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_m1, parameter_m1), - new ExportedParameter(body, var_m2, parameter_m2) - )); - // neg find memberHasParent(m1) - new NegativePatternCall(body, Tuples.flatTupleOf(var_m1), MemberHasParent.instance().getInternalQueryRepresentation()); - // neg find memberHasParent(m2) - new NegativePatternCall(body, Tuples.flatTupleOf(var_m2), MemberHasParent.instance().getInternalQueryRepresentation()); - // m1 != m2 - new Inequality(body, var_m1, var_m2); - bodies.add(body); - } - { - PAnnotation annotation = new PAnnotation("Constraint"); - annotation.addAttribute("message", "twoMembersHaveNoParent"); - annotation.addAttribute("severity", "error"); - annotation.addAttribute("key", Arrays.asList(new Object[] { - new ParameterReference("m1"), - new ParameterReference("m2") - })); - addAnnotation(annotation); - } - return bodies; - } - } -} 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 @@ /bin/ -/xtend-gen/ \ No newline at end of file +/xtend-gen/ 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 @@ -/.UML2TGF.java._trace -/.UML2TGF.xtendbin -/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 @@ -package converter; - -import java.io.PrintWriter; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.EnumerationLiteral; -import org.eclipse.uml2.uml.InstanceSpecification; -import org.eclipse.uml2.uml.InstanceValue; -import org.eclipse.uml2.uml.Model; -import org.eclipse.uml2.uml.Slot; -import org.eclipse.uml2.uml.StructuralFeature; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.ValueSpecification; -import org.eclipse.uml2.uml.resource.UMLResource; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.xbase.lib.Conversions; -import org.eclipse.xtext.xbase.lib.Exceptions; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.InputOutput; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@SuppressWarnings("all") -public class UML2TGF { - public static void main(final String[] args) { - try { - final ResourceSetImpl resourceSet = new ResourceSetImpl(); - resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE); - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, - UMLResource.Factory.INSTANCE); - final Resource res = resourceSet.getResource(URI.createFileURI("instance//Instance_model_A.uml"), true); - EObject _get = res.getContents().get(0); - final Model docRoot = ((Model) _get); - final Function1 _function = (Element it) -> { - return Boolean.valueOf((it instanceof InstanceSpecification)); - }; - final Iterable nodes = IterableExtensions.filter(docRoot.allOwnedElements(), _function); - final HashSet allTypes = new HashSet(); - for (final Element e : nodes) { - allTypes.add(e.getClass()); - } - long _currentTimeMillis = System.currentTimeMillis(); - final Date date = new Date(_currentTimeMillis); - final SimpleDateFormat format = new SimpleDateFormat("dd-HHmm"); - final String formattedDate = format.format(date); - final HashMap map = new HashMap(); - final HashSet set = new HashSet(); - final ArrayList unidentified = new ArrayList(); - final ArrayList enums = new ArrayList(); - final PrintWriter writer = new PrintWriter((("output//graph-" + formattedDate) + ".gml")); - InputOutput.println("begin Writing"); - writer.append("graph\n[\n"); - int ind = 0; - int numNodes = ((Object[])Conversions.unwrapArray(nodes, Object.class)).length; - int numEdges = 0; - for (final Element node : nodes) { - { - final InstanceSpecification n = ((InstanceSpecification) node); - boolean _contains = map.keySet().contains(n); - if (_contains) { - System.err.println("contained"); - } - map.put(n, Integer.valueOf(ind)); - StringConcatenation _builder = new StringConcatenation(); - _builder.append(" "); - _builder.append("node"); - _builder.newLine(); - _builder.append(" "); - _builder.append("["); - _builder.newLine(); - _builder.append(" "); - _builder.append("id "); - _builder.append(ind, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("label \""); - { - String _name = n.getName(); - boolean _tripleNotEquals = (_name != null); - if (_tripleNotEquals) { - String _name_1 = n.getName(); - _builder.append(_name_1, " "); - } - } - _builder.append("\""); - _builder.newLineIfNotEmpty(); - { - if (((n.getName() != null) && (n.getName().contains("Household") || n.getName().contains("Household")))) { - _builder.append(" graphics"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("["); - _builder.newLine(); - _builder.append(" "); - _builder.append("fill\t\"#00FF00\""); - _builder.newLine(); - _builder.append(" "); - _builder.append("]"); - _builder.newLine(); - } - } - _builder.append(" "); - { - if ((node instanceof EnumerationLiteral)) { - _builder.append(" graphics"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append(" "); - _builder.append("["); - _builder.newLine(); - _builder.append(" "); - _builder.append(" "); - _builder.append("fill\t\"#FF0000\""); - _builder.newLine(); - _builder.append(" "); - _builder.append(" "); - _builder.append("]"); - _builder.newLine(); - } - } - _builder.append(" "); - _builder.append("]"); - _builder.newLine(); - writer.append(_builder); - ind++; - } - } - Slot s = null; - try { - for (final Element node_1 : nodes) { - { - final InstanceSpecification n = ((InstanceSpecification) node_1); - final Integer nind = map.get(n); - EList _slots = n.getSlots(); - for (final Slot slot : _slots) { - { - s = slot; - String fname = ""; - StructuralFeature _definingFeature = slot.getDefiningFeature(); - boolean _tripleNotEquals = (_definingFeature != null); - if (_tripleNotEquals) { - fname = slot.getDefiningFeature().getName(); - } - EList _values = slot.getValues(); - for (final ValueSpecification v : _values) { - if ((v instanceof InstanceValue)) { - final InstanceValue value = ((InstanceValue) v); - boolean _containsKey = map.containsKey(value.getInstance()); - if (_containsKey) { - InstanceSpecification _instance = value.getInstance(); - boolean _notEquals = ((_instance instanceof EnumerationLiteral) != true); - if (_notEquals) { - final Integer vind = map.get(value.getInstance()); - StringConcatenation _builder = new StringConcatenation(); - _builder.append(" "); - _builder.append("edge"); - _builder.newLine(); - _builder.append(" "); - _builder.append("["); - _builder.newLine(); - _builder.append(" "); - _builder.append("source "); - _builder.append(nind, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("target "); - _builder.append(vind, " "); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("label \""); - _builder.append(fname, " "); - _builder.append("\""); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("]"); - _builder.newLine(); - writer.append(_builder); - numEdges++; - } else { - String _plus = (value + " -> "); - InstanceSpecification _instance_1 = value.getInstance(); - String _plus_1 = (_plus + _instance_1); - enums.add(_plus_1); - } - } else { - String _plus_2 = (value + " -> "); - InstanceSpecification _instance_2 = value.getInstance(); - String _plus_3 = (_plus_2 + _instance_2); - unidentified.add(_plus_3); - } - } else { - set.add(v.getClass().toString()); - } - } - } - } - } - } - } catch (final Throwable _t) { - if (_t instanceof Exception) { - InputOutput.println(s.getDefiningFeature()); - } else { - throw Exceptions.sneakyThrow(_t); - } - } - UML2TGF.printset("Unhandled Edges", set); - UML2TGF.printset("Unidentified trgs", unidentified); - UML2TGF.printset("Enums:", enums); - writer.append("]"); - writer.close(); - InputOutput.println("End"); - InputOutput.println(((("#nodes:" + Integer.valueOf(numNodes)) + ", #edges:") + Integer.valueOf(numEdges))); - } catch (Throwable _e) { - throw Exceptions.sneakyThrow(_e); - } - } - - public static void printset(final String name, final Collection s) { - InputOutput.println((name + ":")); - for (final Object k : s) { - InputOutput.println(("- " + k)); - } - InputOutput.println(); - } -} diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/.gitignore b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/.gitignore index 5f299742..18e1ed03 100644 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.run/.gitignore +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.run/.gitignore @@ -6,3 +6,4 @@ /x/ /.ipynb_checkpoints/ /measurements1/ +/archives/ -- cgit v1.2.3-70-g09d2