aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/interpreter-rete-recipes
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/interpreter-rete-recipes')
-rw-r--r--subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF18
-rw-r--r--subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF.license4
-rw-r--r--subprojects/interpreter-rete-recipes/NOTICE.md94
-rw-r--r--subprojects/interpreter-rete-recipes/about.html26
-rw-r--r--subprojects/interpreter-rete-recipes/build.gradle.kts62
-rw-r--r--subprojects/interpreter-rete-recipes/build.properties15
-rw-r--r--subprojects/interpreter-rete-recipes/plugin.properties9
-rw-r--r--subprojects/interpreter-rete-recipes/plugin.xml23
-rw-r--r--subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe225
-rw-r--r--subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipeRecognizer.java204
-rw-r--r--subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipesHelper.java81
-rw-r--r--subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore400
-rw-r--r--subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore.license4
-rw-r--r--subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel171
-rw-r--r--subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license4
15 files changed, 1140 insertions, 0 deletions
diff --git a/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF b/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..c732af46
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
1Manifest-Version: 1.0
2Bundle-ManifestVersion: 2
3Bundle-Name: %pluginName
4Bundle-SymbolicName: viatra-runtime-rete-recipes;singleton:=true
5Automatic-Module-Name: viatra-runtime-rete-recipes
6Bundle-Version: 1.0.0.qualifier
7Bundle-ClassPath: viatra-runtime-rete-recipes.jar
8Bundle-Vendor: %providerName
9Bundle-Localization: plugin
10Bundle-RequiredExecutionEnvironment: JavaSE-1.7
11Export-Package: org.eclipse.viatra.query.runtime.rete.recipes,
12 org.eclipse.viatra.query.runtime.rete.recipes.impl,
13 org.eclipse.viatra.query.runtime.rete.recipes.util
14Require-Bundle: org.eclipse.core.runtime,
15 org.eclipse.emf.ecore;visibility:=reexport,
16 org.eclipse.xtext.xbase.lib,
17 org.eclipse.emf.ecore.xcore.lib
18Bundle-ActivationPolicy: lazy
diff --git a/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF.license b/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF.license
new file mode 100644
index 00000000..03d1d42b
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF.license
@@ -0,0 +1,4 @@
1Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro
2Copyright (c) 2023 The Refinery Authors <https://refinery.tools>
3
4SPDX-License-Identifier: EPL-2.0
diff --git a/subprojects/interpreter-rete-recipes/NOTICE.md b/subprojects/interpreter-rete-recipes/NOTICE.md
new file mode 100644
index 00000000..94c1d803
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/NOTICE.md
@@ -0,0 +1,94 @@
1<!--
2 Copyright (c) 2018-2019, Zoltan Ujhelyi, IncQuery Labs Ltd.
3 Copyright (c) 2023 The Refinery Authors <https://refinery.tools/>
4
5 SPDX-License-Identifier: EPL-2.0
6-->
7
8This module contains source code from the [Eclipse VIATRA&trade; project](https://projects.eclipse.org/projects/modeling.viatra), which is available under the terms of the [Eclipse Public License v 2.0](http://www.eclipse.org/legal/epl-v20.html).
9
10Eclipse&reg;, VIATRA&trade; and &lsquo;Eclipse VIATRA&trade;&rsquo; are trademarks of Eclipse Foundation, Inc.
11
12To comply with the [Eclipse Foundation Trademark Usage Policy](https://www.eclipse.org/legal/logo_guidelines.php), we replaced the Eclipse VIATRA&trade; branding in this repository with the name _Refinery Interpreter_, since the [Eclipse Public License - v 2.0](https://www.eclipse.org/legal/epl-2.0/) does not grant trademark usage rights to derived projects.
13_Refinery Interpreter_ is not endorsed or sponsored by Eclipse Foundation, Inc. or any other organizations using the Eclipse VIATRA&trade; trademark.
14
15We publish our modifications to Eclipse VIATRA&trade; for use within the Refinery framework under the name _Refinery Interpreter_. When not using _Refinery Interpreter_ directly in the Refinery framework, users are strongly encouraged to rely on [Eclipse VIATRA&trade;](https://eclipse.dev/viatra/) instead. In particular, _Refinery Interpreter_ does not provide any API stability guarantees that are provided by Eclipse VIATRA&trade;.
16
17We reproduce the [accompanying notices of Eclipse VIATRA&trade;](https://github.com/viatra/org.eclipse.viatra/blob/d422bcc626a99c4640c0d13931f393ccea0d2326/NOTICE.md) in full below:
18
19# Notices for Eclipse VIATRA&trade;
20
21This content is produced and maintained by the Eclipse VIATRA project.
22
23* Project home: https://projects.eclipse.org/projects/modeling.viatra
24
25## Trademarks
26
27Eclipse VIATRA, and VIATRA are trademarks of the Eclipse Foundation.
28
29## Copyright
30
31All content is the property of the respective authors or their employers. For
32more information regarding authorship of content, please consult the listed
33source code repository logs.
34
35## Declared Project Licenses
36
37This program and the accompanying materials are made available under the terms
38of the Eclipse Public License v. 2.0 which is available at
39http://www.eclipse.org/legal/epl-v20.html.
40
41SPDX-License-Identifier: EPL-2.0
42
43## Source Code
44
45The project maintains the following source code repositories:
46
47* http://git.eclipse.org/c/viatra/org.eclipse.viatra.git
48* http://git.eclipse.org/c/viatra/org.eclipse.viatra.modelobfuscator.git
49* http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git
50* http://git.eclipse.org/c/viatra/org.eclipse.viatra2.vpm.git
51
52## Third-party Content
53
54This project leverages the following third party content.
55
56ANTLR Runtime only: (3.2)
57
58* License: New BSD license
59
60Apache Commons Language Library (2.1)
61
62* License: Apache License, 2.0
63
64Google Guice / Inject Core API (3.0.0)
65
66* License: Apache License, 2.0
67
68Google Guice / Inject Core API (3.0.0)
69
70* License: Apache License 2.0
71
72Guava (10.0.1)
73
74* License: Apache License, 2.0
75
76Guice (2.0)
77
78* License: Apache License, 2.0
79
80guice-multibindings (3.0.0)
81
82* License: Apache License, 2.0
83
84log4j (1.2.15)
85
86* License: Apache License 2.0
87
88LPG Java Runtime (lpgjavaruntime.jar) (1.1)
89
90* License: Eclipse Public License
91
92mockito (1.9.5)
93
94* License: Apache License, 2.0, New BSD license, MIT license
diff --git a/subprojects/interpreter-rete-recipes/about.html b/subprojects/interpreter-rete-recipes/about.html
new file mode 100644
index 00000000..d1d5593a
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/about.html
@@ -0,0 +1,26 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
2<html>
3<!--
4 Copyright (c) 2017, Eclipse.org Foundation, Inc.
5
6 SPDX-License-Identifier: LicenseRef-EPL-Steward
7-->
8<head>
9<title>About</title>
10<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
11</head>
12<body lang="EN-US">
13<h2>About This Content</h2>
14
15<p>March 18, 2019</p>
16<h3>License</h3>
17
18<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
19Eclipse Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/org/documents/epl-v20.php">http://www.eclipse.org/legal/epl-v20.html</a>.
20For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
21
22<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
23apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
24indicated below, the terms and conditions of the EPL still apply to any source code in the Content and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
25</body>
26</html>
diff --git a/subprojects/interpreter-rete-recipes/build.gradle.kts b/subprojects/interpreter-rete-recipes/build.gradle.kts
new file mode 100644
index 00000000..1b892e4e
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/build.gradle.kts
@@ -0,0 +1,62 @@
1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
7import tools.refinery.gradle.utils.SonarPropertiesUtils
8
9plugins {
10 id("tools.refinery.gradle.interpreter-library")
11 id("tools.refinery.gradle.mwe2")
12 id("tools.refinery.gradle.sonarqube")
13}
14
15dependencies {
16 api(project(":refinery-interpreter"))
17 api(libs.ecore)
18 mwe2(libs.ecore.codegen)
19 mwe2(libs.mwe.utils)
20 mwe2(libs.mwe2.lib)
21 mwe2(libs.slf4j.simple)
22 mwe2(libs.xtext.core)
23 mwe2(libs.xtext.xbase)
24}
25
26sourceSets {
27 main {
28 java.srcDir("src/main/emf-gen")
29 }
30}
31
32tasks {
33 val generateEPackage by registering(JavaExec::class) {
34 mainClass.set("org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher")
35 classpath(configurations.mwe2)
36 inputs.file("src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2")
37 inputs.file("src/main/resources/model/recipes.ecore")
38 inputs.file("src/main/resources/model/rete-recipes.genmodel")
39 outputs.file("build.properties")
40 outputs.file("META-INF/MANIFEST.MF")
41 outputs.file("plugin.xml")
42 outputs.file("plugin.properties")
43 outputs.dir("src/main/emf-gen")
44 args("src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2",
45 "-p", "rootPath=/$projectDir")
46 }
47
48 for (taskName in listOf("compileJava", "processResources", "generateEclipseSourceFolders")) {
49 named(taskName) {
50 dependsOn(generateEPackage)
51 }
52 }
53
54 clean {
55 delete("src/main/emf-gen")
56 }
57}
58
59sonarqube.properties {
60 SonarPropertiesUtils.addToList(properties, "sonar.exclusions", "src/main/emf-gen/**")
61}
62
diff --git a/subprojects/interpreter-rete-recipes/build.properties b/subprojects/interpreter-rete-recipes/build.properties
new file mode 100644
index 00000000..97e4d6bd
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/build.properties
@@ -0,0 +1,15 @@
1# Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro
2# This program and the accompanying materials are made available under the
3# terms of the Eclipse Public License v. 2.0 which is available at
4# http://www.eclipse.org/legal/epl-v20.html.
5#
6# SPDX-License-Identifier: EPL-2.0
7
8bin.includes = viatra-runtime-rete-recipes.jar,\
9 model/,\
10 META-INF/,\
11 plugin.xml,\
12 plugin.properties
13jars.compile.order = viatra-runtime-rete-recipes.jar
14source.viatra-runtime-rete-recipes.jar = src-gen/
15output.viatra-runtime-rete-recipes.jar = bin/
diff --git a/subprojects/interpreter-rete-recipes/plugin.properties b/subprojects/interpreter-rete-recipes/plugin.properties
new file mode 100644
index 00000000..43a7236d
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/plugin.properties
@@ -0,0 +1,9 @@
1# Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro
2# This program and the accompanying materials are made available under the
3# terms of the Eclipse Public License v. 2.0 which is available at
4# http://www.eclipse.org/legal/epl-v20.html.
5#
6# SPDX-License-Identifier: EPL-2.0
7
8pluginName = Rete-recipes Model
9providerName = www.example.org
diff --git a/subprojects/interpreter-rete-recipes/plugin.xml b/subprojects/interpreter-rete-recipes/plugin.xml
new file mode 100644
index 00000000..3106788c
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/plugin.xml
@@ -0,0 +1,23 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<?eclipse version="3.0"?>
3
4<!--
5 Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro
6 This program and the accompanying materials are made available under the
7 terms of the Eclipse Public License v. 2.0 which is available at
8 http://www.eclipse.org/legal/epl-v20.html.
9
10 SPDX-License-Identifier: EPL-2.0
11-->
12
13<plugin>
14
15 <extension point="org.eclipse.emf.ecore.generated_package">
16 <!-- @generated rete-recipes -->
17 <package
18 uri="https://refinery.tools/emf/2023/InterpreterReteRecipes"
19 class="tools.refinery.interpreter.rete.recipes.RecipesPackage"
20 genModel="src/main/resources/model/rete-recipes.genmodel"/>
21 </extension>
22
23</plugin>
diff --git a/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2 b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2
new file mode 100644
index 00000000..324d93a5
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2
@@ -0,0 +1,25 @@
1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6module tools.refinery.viatra.runtime.rete.recipes.GenerateReteRecipes
7
8Workflow {
9 bean = org.eclipse.emf.mwe.utils.StandaloneSetup {
10 projectMapping = {
11 projectName = "tools.refinery.refinery-interpreter-rete-recipes"
12 path = "."
13 }
14 }
15
16 component = org.eclipse.emf.mwe.utils.DirectoryCleaner {
17 directory = "src/main/emf-gen"
18 }
19
20 component = org.eclipse.emf.mwe2.ecore.EcoreGenerator {
21 generateCustomClasses = false
22 genModel = "platform:/resource/tools.refinery.refinery-interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel"
23 srcPath = "platform:/resource/tools.refinery.refinery-interpreter-rete-recipes/src/main/emf-gen"
24 }
25}
diff --git a/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipeRecognizer.java b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipeRecognizer.java
new file mode 100644
index 00000000..ed551b6e
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipeRecognizer.java
@@ -0,0 +1,204 @@
1/*******************************************************************************
2 * Copyright (c) 2010-2016, Gabor Bergmann, Istvan Rath and Daniel Varro
3 * This program and the accompanying materials are made available under the
4 * terms of the Eclipse Public License v. 2.0 which is available at
5 * http://www.eclipse.org/legal/epl-v20.html.
6 *
7 * SPDX-License-Identifier: EPL-2.0
8 *******************************************************************************/
9package tools.refinery.interpreter.rete.recipes.helper;
10
11import org.eclipse.emf.common.util.EList;
12import org.eclipse.emf.ecore.EAttribute;
13import org.eclipse.emf.ecore.EClass;
14import org.eclipse.emf.ecore.EObject;
15import org.eclipse.emf.ecore.EStructuralFeature;
16import org.eclipse.emf.ecore.util.EcoreUtil;
17import tools.refinery.interpreter.rete.recipes.RecipesPackage;
18import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe;
19import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext;
20
21import java.util.*;
22
23/**
24 * Stores a set of known <em>canonical</em> recipes, each representing a disjoint equivalence class of recipes, modulo
25 * {@link #isEquivalentRecipe(ReteNodeRecipe, ReteNodeRecipe)}.
26 *
27 * @author Gabor Bergmann
28 * @since 1.3
29 *
30 */
31public class RecipeRecognizer {
32 private static long nextRecipeEquivalenceClassID = 0;
33
34 /**
35 * if EcoreUtil.equals(recipe1, recipe2), only one of them will be included here
36 */
37 Map<EClass, Set<ReteNodeRecipe>> canonicalRecipesByClass = new HashMap<>();
38 Map<Long, ReteNodeRecipe> canonicalRecipeByEquivalenceClassID = new HashMap<>();
39
40 private IQueryRuntimeContext runtimeContext;
41
42 /**
43 * @param can be null; if provided, further equivalences can be detected based on {@link IQueryRuntimeContext#wrapElement(Object)}
44 * @since 1.6
45 */
46 public RecipeRecognizer(IQueryRuntimeContext runtimeContext) {
47 this.runtimeContext = runtimeContext;
48 }
49 public RecipeRecognizer() {
50 this(null);
51 }
52
53 /**
54 * Recognizes when an equivalent canonical recipe is already known.
55 *
56 * @return an equivalent canonical recipe, or the null if no known equivalent found
57 */
58 public ReteNodeRecipe peekCanonicalRecipe(final ReteNodeRecipe recipe) {
59 // equivalence class already known
60 for (Long classID : recipe.getEquivalenceClassIDs()) {
61 ReteNodeRecipe knownRecipe = canonicalRecipeByEquivalenceClassID.get(classID);
62 if (knownRecipe != null)
63 return knownRecipe;
64 }
65
66 // equivalence class not known, but maybe equivalent recipe still
67 // available
68 Collection<ReteNodeRecipe> sameClassRecipes = getSameClassCanonicalRecipes(recipe);
69 for (ReteNodeRecipe knownRecipe : sameClassRecipes) {
70 if (isEquivalentRecipe(recipe, knownRecipe)) {
71 // FOUND EQUIVALENT RECIPE
72 recipe.getEquivalenceClassIDs().add(knownRecipe.getEquivalenceClassIDs().get(0));
73 return knownRecipe;
74 }
75 }
76
77 return null;
78 }
79
80 /**
81 * This recipe will be remembered as a canonical recipe. Method maintains both internal data structures and the
82 * equivalence class attribute of the recipe. PRECONDITION: {@link #peekCanonicalRecipe(ReteNodeRecipe)} must return
83 * null or the recipe itself
84 */
85 public void makeCanonical(final ReteNodeRecipe recipe) {
86 // this is a canonical recipe, chosen representative of its new
87 // equivalence class
88 if (recipe.getEquivalenceClassIDs().isEmpty()) {
89 recipe.getEquivalenceClassIDs().add(nextRecipeEquivalenceClassID++);
90 }
91 for (Long classID : recipe.getEquivalenceClassIDs()) {
92 canonicalRecipeByEquivalenceClassID.put(classID, recipe);
93 }
94 getSameClassCanonicalRecipes(recipe).add(recipe);
95 }
96
97 /**
98 * Ensures that there is an equivalent canonical recipe; if none is known yet, this recipe will be remembered as
99 * canonical.
100 *
101 * @return an equivalent canonical recipe; the argument recipe itself (which is made canonical) if no known
102 * equivalent found
103 */
104 public ReteNodeRecipe canonicalizeRecipe(final ReteNodeRecipe recipe) {
105 ReteNodeRecipe knownRecipe = peekCanonicalRecipe(recipe);
106 if (knownRecipe == null) {
107 knownRecipe = recipe;
108 makeCanonical(recipe);
109 }
110 return knownRecipe;
111 }
112
113 /**
114 * @return true iff recipe is a canonical recipe
115 */
116 public boolean isKnownCanonicalRecipe(final ReteNodeRecipe recipe) {
117 if (recipe.getEquivalenceClassIDs().isEmpty()) {
118 return false;
119 }
120 ReteNodeRecipe knownRecipe = canonicalRecipeByEquivalenceClassID.get(recipe.getEquivalenceClassIDs().get(0));
121 return recipe == knownRecipe;
122 }
123
124 private Set<ReteNodeRecipe> getSameClassCanonicalRecipes(final ReteNodeRecipe recipe) {
125 Set<ReteNodeRecipe> sameClassRecipes = canonicalRecipesByClass.get(recipe.eClass());
126 if (sameClassRecipes == null) {
127 sameClassRecipes = new HashSet<>();
128 canonicalRecipesByClass.put(recipe.eClass(), sameClassRecipes);
129 }
130 return sameClassRecipes;
131 }
132
133 private boolean isEquivalentRecipe(ReteNodeRecipe recipe, ReteNodeRecipe knownRecipe) {
134 return new EqualityHelper(runtimeContext).equals(recipe, knownRecipe);
135 }
136
137 // TODO reuse in more cases later, e.g. switching join node parents, etc.
138 private static class EqualityHelper extends EcoreUtil.EqualityHelper {
139
140
141
142
143 private static final long serialVersionUID = -8841971394686015188L;
144
145 private static final EAttribute RETE_NODE_RECIPE_EQUIVALENCE_CLASS_IDS =
146 RecipesPackage.eINSTANCE.getReteNodeRecipe_EquivalenceClassIDs();
147 private static final EAttribute CONSTANT_RECIPE_CONSTANT_VALUES =
148 RecipesPackage.eINSTANCE.getConstantRecipe_ConstantValues();
149 private static final EAttribute DISCRIMINATOR_BUCKET_RECIPE_BUCKET_KEY =
150 RecipesPackage.eINSTANCE.getDiscriminatorBucketRecipe_BucketKey();
151
152 private IQueryRuntimeContext runtimeContext;
153
154 public EqualityHelper(IQueryRuntimeContext runtimeContext) {
155 this.runtimeContext = runtimeContext;
156 }
157
158 @Override
159 protected boolean haveEqualFeature(EObject eObject1, EObject eObject2, EStructuralFeature feature) {
160 // ignore differences in this attribute, as it may only be assigned
161 // after the equivalence check
162 if (RETE_NODE_RECIPE_EQUIVALENCE_CLASS_IDS.equals(feature))
163 return true;
164
165 if (runtimeContext != null) {
166 // constant values
167 if (/*CONSTANT_RECIPE_CONSTANT_VALUES.equals(feature) ||*/ DISCRIMINATOR_BUCKET_RECIPE_BUCKET_KEY.equals(feature)) {
168 // use runtime context to map to canonical wrapped form
169 // this is costly for constant recipes (TODO improve this), but essential for discriminator buckets
170
171 Object val1 = eObject1.eGet(feature);
172 Object val2 = eObject2.eGet(feature);
173
174 if (val1 != null && val2 != null) {
175 return runtimeContext.wrapElement(val1).equals(runtimeContext.wrapElement(val2));
176 } else {
177 return val1 == null && val2 == null;
178 }
179
180 }
181 }
182
183 // fallback to general comparison
184 return super.haveEqualFeature(eObject1, eObject2, feature);
185 }
186
187 @Override
188 public boolean equals(EObject eObject1, EObject eObject2) {
189 // short-circuit if already known to be equivalent
190 if (eObject1 instanceof ReteNodeRecipe) {
191 if (eObject2 instanceof ReteNodeRecipe) {
192 EList<Long> eqClassIDs1 = ((ReteNodeRecipe) eObject1).getEquivalenceClassIDs();
193 EList<Long> eqClassIDs2 = ((ReteNodeRecipe) eObject2).getEquivalenceClassIDs();
194
195 if (!Collections.disjoint(eqClassIDs1, eqClassIDs2))
196 return true;
197 }
198 }
199
200 // fallback to general comparison
201 return super.equals(eObject1, eObject2);
202 }
203 }
204}
diff --git a/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipesHelper.java b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipesHelper.java
new file mode 100644
index 00000000..763989ea
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipesHelper.java
@@ -0,0 +1,81 @@
1/**
2 * Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro
3 * This program and the accompanying materials are made available under the
4 * terms of the Eclipse Public License v. 2.0 which is available at
5 * http://www.eclipse.org/legal/epl-v20.html.
6 *
7 * SPDX-License-Identifier: EPL-2.0
8 */
9package tools.refinery.interpreter.rete.recipes.helper;
10
11import org.eclipse.emf.common.util.EList;
12import tools.refinery.interpreter.rete.recipes.*;
13
14import java.util.Collection;
15
16/**
17 * Static helper class for easy construction of recipes.
18 *
19 * @author Bergmann Gabor
20 */
21public class RecipesHelper {
22 private static final RecipesFactory FACTORY = RecipesFactory.eINSTANCE;
23
24 private RecipesHelper() {/* Utility class constructor */}
25
26 /**
27 * @since 2.0
28 */
29 public static Mask mask(final int sourceArity, final Collection<Integer> sourceIndices) {
30 Mask mask = RecipesHelper.FACTORY.createMask();
31 mask.setSourceArity(sourceArity);
32 mask.getSourceIndices().addAll(sourceIndices);
33 return mask;
34 }
35
36 public static Mask mask(final int sourceArity, final int... sourceIndices) {
37 Mask mask = RecipesHelper.FACTORY.createMask();
38 mask.setSourceArity(sourceArity);
39 final EList<Integer> maskIndeces = mask.getSourceIndices();
40 for (int index : sourceIndices) {
41 maskIndeces.add(index);
42 }
43 return mask;
44 }
45
46 public static ProjectionIndexerRecipe projectionIndexerRecipe(final ReteNodeRecipe parent, final Mask mask) {
47 ProjectionIndexerRecipe recipe = RecipesHelper.FACTORY.createProjectionIndexerRecipe();
48 recipe.setParent(parent);
49 recipe.setMask(mask);
50 return recipe;
51 }
52
53 public static ExpressionDefinition expressionDefinition(final Object evaluator) {
54 ExpressionDefinition definition = RecipesHelper.FACTORY.createExpressionDefinition();
55 definition.setEvaluator(evaluator);
56 return definition;
57 }
58
59 public static InputRecipe inputRecipe(final Object inputKey, final String inputKeyID, final int arity) {
60 InputRecipe recipe = RecipesHelper.FACTORY.createInputRecipe();
61 recipe.setInputKey(inputKey);
62 recipe.setKeyArity(arity);
63 recipe.setKeyID(inputKeyID);
64 recipe.setTraceInfo(inputKeyID);
65 return recipe;
66 }
67
68 /**
69 * Mask can be null in case no tuple reordering or trimming is needed
70 */
71 public static InputFilterRecipe inputFilterRecipe(final ReteNodeRecipe parent, final Object inputKey,
72 final String inputKeyID, final Mask mask) {
73 InputFilterRecipe it = RecipesHelper.FACTORY.createInputFilterRecipe();
74 it.setParent(parent);
75 it.setInputKey(inputKey);
76 it.setKeyID(inputKeyID);
77 it.setTraceInfo(inputKeyID);
78 it.setMask(mask);
79 return it;
80 }
81}
diff --git a/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore
new file mode 100644
index 00000000..a4617833
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore
@@ -0,0 +1,400 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="recipes" nsURI="https://refinery.tools/emf/2023/InterpreterReteRecipes"
4 nsPrefix="recipes">
5 <eClassifiers xsi:type="ecore:EClass" name="ReteRecipe">
6 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
7 <details key="documentation" value="Container for Rete recipes."/>
8 </eAnnotations>
9 <eStructuralFeatures xsi:type="ecore:EReference" name="recipeNodes" upperBound="-1"
10 eType="#//ReteNodeRecipe" containment="true" resolveProxies="false"/>
11 </eClassifiers>
12 <eClassifiers xsi:type="ecore:EClass" name="ReteNodeRecipe" abstract="true">
13 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
14 <details key="documentation" value="Abstract base class for model elements that represent &quot;Rete node recipes&quot;,&#xD;&#xA;that is DTOs that carry information for Rete network construction.&#xD;&#xA;&#xD;&#xA;@noimplement"/>
15 </eAnnotations>
16 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
17 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
18 <details key="documentation" value=" The width of tuples contained by this node."/>
19 <details key="body" value="throw new &lt;%java.lang.UnsupportedOperationException%>();"/>
20 </eAnnotations>
21 </eOperations>
22 <eStructuralFeatures xsi:type="ecore:EAttribute" name="traceInfo" unique="false"
23 eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
24 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
25 <details key="documentation" value="Temporary construct for storing traceability information."/>
26 </eAnnotations>
27 </eStructuralFeatures>
28 <eStructuralFeatures xsi:type="ecore:EAttribute" name="equivalenceClassIDs" upperBound="-1"
29 eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong" transient="true">
30 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
31 <details key="documentation" value="If two recipes were found equivalent, a matching equivalence ID can be assigned to them by {@link RecipeRecognizer}. &#xD;&#xA;If two recipes share (at least one) equivalence ID, they are known to be equivalent.&#xD;&#xA;&#xD;&#xA;&lt;p>&#xD;&#xA;A difference in this attribute only does not preclude two recipe elements to be considered equal. &#xD;&#xA;If they are shown to be equivalent using deeper analysis, equivalence ids can be set so that the equivalence is recognized more easily the next time.&#xD;&#xA;&#xD;&#xA;@since 1.3"/>
32 </eAnnotations>
33 </eStructuralFeatures>
34 </eClassifiers>
35 <eClassifiers xsi:type="ecore:EClass" name="SingleParentNodeRecipe" abstract="true"
36 eSuperTypes="#//ReteNodeRecipe">
37 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
38 <details key="documentation" value="Abstract base class for single-parent node recipes."/>
39 </eAnnotations>
40 <eStructuralFeatures xsi:type="ecore:EReference" name="parent" eType="#//ReteNodeRecipe"/>
41 </eClassifiers>
42 <eClassifiers xsi:type="ecore:EClass" name="AlphaRecipe" abstract="true" eSuperTypes="#//SingleParentNodeRecipe">
43 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
44 <details key="documentation" value="Abstract base class for alpha node recipes."/>
45 </eAnnotations>
46 </eClassifiers>
47 <eClassifiers xsi:type="ecore:EClass" name="MultiParentNodeRecipe" abstract="true"
48 eSuperTypes="#//ReteNodeRecipe">
49 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
50 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
51 <details key="body" value="&lt;%org.eclipse.emf.common.util.EList%>&lt;&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%>> _parents = this.getParents();&#xA;&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _get = _parents.get(0);&#xA;return _get.getArity();"/>
52 </eAnnotations>
53 </eOperations>
54 <eStructuralFeatures xsi:type="ecore:EReference" name="parents" upperBound="-1"
55 eType="#//ReteNodeRecipe"/>
56 </eClassifiers>
57 <eClassifiers xsi:type="ecore:EClass" name="MonotonicityInfo">
58 <eStructuralFeatures xsi:type="ecore:EReference" name="coreMask" eType="#//Mask"
59 containment="true" resolveProxies="false"/>
60 <eStructuralFeatures xsi:type="ecore:EReference" name="posetMask" eType="#//Mask"
61 containment="true" resolveProxies="false"/>
62 <eStructuralFeatures xsi:type="ecore:EAttribute" name="posetComparator" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
63 </eClassifiers>
64 <eClassifiers xsi:type="ecore:EClass" name="UniquenessEnforcerRecipe" eSuperTypes="#//MultiParentNodeRecipe #//RederivableNodeRecipe">
65 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
66 <details key="documentation" value="Represents nodes that enforce tuple uniqueness, i.e. filter out&#xA;duplicate input tuples for output."/>
67 </eAnnotations>
68 </eClassifiers>
69 <eClassifiers xsi:type="ecore:EClass" name="ProductionRecipe" eSuperTypes="#//MultiParentNodeRecipe #//RederivableNodeRecipe">
70 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
71 <details key="documentation" value="The production node represents the output of the Rete network,&#xA;from which the results of a query can be read."/>
72 </eAnnotations>
73 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
74 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
75 <details key="body" value="return this.getMappedIndices().size();"/>
76 </eAnnotations>
77 </eOperations>
78 <eStructuralFeatures xsi:type="ecore:EReference" name="mappedIndices" upperBound="-1"
79 eType="#//StringIndexMapEntry" containment="true" resolveProxies="false">
80 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
81 <details key="documentation" value="String -> Index map.&#xA;Indicates the positions of parameters."/>
82 </eAnnotations>
83 </eStructuralFeatures>
84 <eStructuralFeatures xsi:type="ecore:EAttribute" name="pattern" unique="false"
85 eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
86 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
87 <details key="documentation" value="Traceability link to defining pattern object (from EMFPatternLanguage)&#xA;TODO unused?"/>
88 </eAnnotations>
89 </eStructuralFeatures>
90 <eStructuralFeatures xsi:type="ecore:EAttribute" name="patternFQN" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
91 </eClassifiers>
92 <eClassifiers xsi:type="ecore:EClass" name="IndexerRecipe" abstract="true" eSuperTypes="#//SingleParentNodeRecipe">
93 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
94 <details key="documentation" value="Represents a node that indexes the contents of a parent based on a projection defined by a Mask."/>
95 </eAnnotations>
96 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
97 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
98 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.Mask%> _mask = this.getMask();&#xA;return _mask.getSourceArity();"/>
99 </eAnnotations>
100 </eOperations>
101 <eStructuralFeatures xsi:type="ecore:EReference" name="mask" eType="#//Mask" containment="true"
102 resolveProxies="false"/>
103 </eClassifiers>
104 <eClassifiers xsi:type="ecore:EClass" name="ProjectionIndexerRecipe" eSuperTypes="#//IndexerRecipe">
105 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
106 <details key="documentation" value="Represents helper nodes that provide projection indexing for Beta nodes and user queries."/>
107 </eAnnotations>
108 </eClassifiers>
109 <eClassifiers xsi:type="ecore:EClass" name="AggregatorIndexerRecipe" eSuperTypes="#//IndexerRecipe">
110 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
111 <details key="documentation" value="Attached to an aggregator node, provides the aggregated values for outer join."/>
112 </eAnnotations>
113 </eClassifiers>
114 <eClassifiers xsi:type="ecore:EClass" name="BetaRecipe" abstract="true" eSuperTypes="#//ReteNodeRecipe">
115 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
116 <details key="documentation" value="Abstract base class for Beta node recipes."/>
117 </eAnnotations>
118 <eStructuralFeatures xsi:type="ecore:EReference" name="leftParent" eType="#//ProjectionIndexerRecipe"
119 containment="true" resolveProxies="false"/>
120 <eStructuralFeatures xsi:type="ecore:EReference" name="rightParent" eType="#//IndexerRecipe"
121 containment="true" resolveProxies="false">
122 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
123 <details key="documentation" value=" can be an AggregatorIndexer"/>
124 </eAnnotations>
125 </eStructuralFeatures>
126 </eClassifiers>
127 <eClassifiers xsi:type="ecore:EClass" name="Mask">
128 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
129 <details key="documentation" value="A mask defines the set of tuple variables that need to be taken into consideration for operations."/>
130 </eAnnotations>
131 <eStructuralFeatures xsi:type="ecore:EAttribute" name="sourceIndices" unique="false"
132 upperBound="-1" eType="#//Index">
133 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
134 <details key="documentation" value="The indices that are relevant for tuple operations."/>
135 </eAnnotations>
136 </eStructuralFeatures>
137 <eStructuralFeatures xsi:type="ecore:EAttribute" name="sourceArity" unique="false"
138 eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
139 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
140 <details key="documentation" value="The arity of tuples."/>
141 </eAnnotations>
142 </eStructuralFeatures>
143 </eClassifiers>
144 <eClassifiers xsi:type="ecore:EDataType" name="Index" instanceClassName="java.lang.Integer">
145 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
146 <details key="documentation" value="Indexes tell which variable of tuples are relevant for a given operation.&#xA;TODO: is this necessary at all?"/>
147 </eAnnotations>
148 </eClassifiers>
149 <eClassifiers xsi:type="ecore:EClass" name="StringIndexMapEntry" instanceClassName="java.util.Map$Entry">
150 <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
151 <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" unique="false" eType="#//Index"/>
152 </eClassifiers>
153 <eClassifiers xsi:type="ecore:EClass" name="InputRecipe" eSuperTypes="#//ReteNodeRecipe">
154 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
155 <details key="documentation" value="Represents input nodes for the Rete network, i.e. nodes&#xA;that generate input tuples for processing."/>
156 </eAnnotations>
157 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
158 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
159 <details key="body" value="return getKeyArity();"/>
160 </eAnnotations>
161 </eOperations>
162 <eStructuralFeatures xsi:type="ecore:EAttribute" name="inputKey" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"
163 transient="true"/>
164 <eStructuralFeatures xsi:type="ecore:EAttribute" name="keyID" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
165 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
166 <details key="documentation" value="Temporary construct for identifying types over the wire.&#xA;TODO improve type references"/>
167 </eAnnotations>
168 </eStructuralFeatures>
169 <eStructuralFeatures xsi:type="ecore:EAttribute" name="keyArity" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
170 </eClassifiers>
171 <eClassifiers xsi:type="ecore:EClass" name="ConstantRecipe" eSuperTypes="#//ReteNodeRecipe">
172 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
173 <details key="documentation" value="Simple node that stores constant values."/>
174 </eAnnotations>
175 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
176 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
177 <details key="body" value="return this.getConstantValues().size();"/>
178 </eAnnotations>
179 </eOperations>
180 <eStructuralFeatures xsi:type="ecore:EAttribute" name="constantValues" unique="false"
181 upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
182 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
183 <details key="documentation" value="Stores constant values. May be empty.&#xA;&#xA;TODO store constants as strings instead? (for easier serialization)"/>
184 </eAnnotations>
185 </eStructuralFeatures>
186 </eClassifiers>
187 <eClassifiers xsi:type="ecore:EClass" name="TransitiveClosureRecipe" eSuperTypes="#//AlphaRecipe">
188 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
189 <details key="documentation" value="Represents transitive closure."/>
190 </eAnnotations>
191 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
192 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
193 <details key="body" value="return 2;"/>
194 </eAnnotations>
195 </eOperations>
196 </eClassifiers>
197 <eClassifiers xsi:type="ecore:EClass" name="FilterRecipe" abstract="true" eSuperTypes="#//AlphaRecipe">
198 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
199 <details key="documentation" value="Abstract base class for nodes that implement filtering operations."/>
200 </eAnnotations>
201 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
202 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
203 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;return _parent.getArity();"/>
204 </eAnnotations>
205 </eOperations>
206 </eClassifiers>
207 <eClassifiers xsi:type="ecore:EClass" name="InequalityFilterRecipe" eSuperTypes="#//FilterRecipe">
208 <eStructuralFeatures xsi:type="ecore:EAttribute" name="subject" unique="false"
209 eType="#//Index"/>
210 <eStructuralFeatures xsi:type="ecore:EAttribute" name="inequals" unique="false"
211 upperBound="-1" eType="#//Index"/>
212 </eClassifiers>
213 <eClassifiers xsi:type="ecore:EClass" name="EqualityFilterRecipe" eSuperTypes="#//FilterRecipe">
214 <eStructuralFeatures xsi:type="ecore:EAttribute" name="indices" unique="false"
215 upperBound="-1" eType="#//Index"/>
216 </eClassifiers>
217 <eClassifiers xsi:type="ecore:EClass" name="TransparentRecipe" eSuperTypes="#//FilterRecipe"/>
218 <eClassifiers xsi:type="ecore:EClass" name="TrimmerRecipe" eSuperTypes="#//AlphaRecipe">
219 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
220 <details key="documentation" value="Implements projection without uniqueness checking."/>
221 </eAnnotations>
222 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
223 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
224 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.Mask%> _mask = this.getMask();&#xA;&lt;%org.eclipse.emf.common.util.EList%>&lt;&lt;%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();&#xA;return _sourceIndices.size();"/>
225 </eAnnotations>
226 </eOperations>
227 <eStructuralFeatures xsi:type="ecore:EReference" name="mask" eType="#//Mask" containment="true"
228 resolveProxies="false"/>
229 </eClassifiers>
230 <eClassifiers xsi:type="ecore:EClass" name="ExpressionDefinition">
231 <eStructuralFeatures xsi:type="ecore:EAttribute" name="evaluator" unique="false"
232 eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
233 </eClassifiers>
234 <eClassifiers xsi:type="ecore:EClass" name="ExpressionEnforcerRecipe" abstract="true"
235 eSuperTypes="#//AlphaRecipe">
236 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
237 <details key="documentation" value="type RuntimeExpressionEvaluator wraps psystem.matchers.tools.refinery.interpreter.IExpressionEvaluator&#xA;class RuntimeExpressionDefinition extends ExpressionDefinition {&#xA;&#x9;RuntimeExpressionEvaluator evaluator&#xA;}"/>
238 </eAnnotations>
239 <eStructuralFeatures xsi:type="ecore:EReference" name="expression" eType="#//ExpressionDefinition"
240 containment="true" resolveProxies="false">
241 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
242 <details key="documentation" value="Provides traceability to expression representation."/>
243 </eAnnotations>
244 </eStructuralFeatures>
245 <eStructuralFeatures xsi:type="ecore:EReference" name="mappedIndices" upperBound="-1"
246 eType="#//StringIndexMapEntry" containment="true" resolveProxies="false">
247 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
248 <details key="documentation" value="String -> Index map.&#xA;Maps variable names in the expression to tuple indices."/>
249 </eAnnotations>
250 </eStructuralFeatures>
251 <eStructuralFeatures xsi:type="ecore:EAttribute" name="cacheOutput" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
252 </eClassifiers>
253 <eClassifiers xsi:type="ecore:EClass" name="CheckRecipe" eSuperTypes="#//ExpressionEnforcerRecipe">
254 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
255 <details key="documentation" value="Computes the result of the boolean expression evaluation and&#xA;only passes tuples for which the result is true."/>
256 </eAnnotations>
257 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
258 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
259 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;return _parent.getArity();"/>
260 </eAnnotations>
261 </eOperations>
262 </eClassifiers>
263 <eClassifiers xsi:type="ecore:EClass" name="EvalRecipe" eSuperTypes="#//ExpressionEnforcerRecipe">
264 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
265 <details key="documentation" value="Computes the result of expression evaluation and suffixes the result&#xA;to output tuples as the last element."/>
266 </eAnnotations>
267 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
268 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
269 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;int _arity = _parent.getArity();&#xA;return (1 + _arity);"/>
270 </eAnnotations>
271 </eOperations>
272 <eStructuralFeatures xsi:type="ecore:EAttribute" name="unwinding" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
273 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
274 <details key="documentation" value="@since 2.4"/>
275 </eAnnotations>
276 </eStructuralFeatures>
277 </eClassifiers>
278 <eClassifiers xsi:type="ecore:EClass" name="IndexerBasedAggregatorRecipe" abstract="true"
279 eSuperTypes="#//ReteNodeRecipe">
280 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
281 <details key="documentation" value="Represents a (compound) node that performs an aggregation operation.&#xA;Parent must be a ProjectionIndexer, which defines how tuples are to be aggregated.&#xA;Usable only through an Join with an AggregatorIndexer as the right parent"/>
282 </eAnnotations>
283 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
284 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
285 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _parent = this.getParent();&#xA;&lt;%tools.refinery.interpreter.rete.recipes.Mask%> _mask = _parent.getMask();&#xA;&lt;%org.eclipse.emf.common.util.EList%>&lt;&lt;%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();&#xA;int _size = _sourceIndices.size();&#xA;return (1 + _size);"/>
286 </eAnnotations>
287 </eOperations>
288 <eStructuralFeatures xsi:type="ecore:EReference" name="parent" eType="#//ProjectionIndexerRecipe"
289 containment="true" resolveProxies="false"/>
290 </eClassifiers>
291 <eClassifiers xsi:type="ecore:EClass" name="CountAggregatorRecipe" eSuperTypes="#//IndexerBasedAggregatorRecipe">
292 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
293 <details key="documentation" value="The count aggregator node represents a &quot;count find&quot; operation."/>
294 </eAnnotations>
295 </eClassifiers>
296 <eClassifiers xsi:type="ecore:EClass" name="JoinRecipe" eSuperTypes="#//BetaRecipe">
297 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
298 <details key="documentation" value="The most basic beta operation, the join node performs a join operation over two input tuple sets."/>
299 </eAnnotations>
300 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
301 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
302 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();&#xA;int _arity = _leftParent.getArity();&#xA;&lt;%tools.refinery.interpreter.rete.recipes.IndexerRecipe%> _rightParent = this.getRightParent();&#xA;int _arity_1 = _rightParent.getArity();&#xA;int _plus = (_arity + _arity_1);&#xA;&lt;%tools.refinery.interpreter.rete.recipes.IndexerRecipe%> _rightParent_1 = this.getRightParent();&#xA;&lt;%tools.refinery.interpreter.rete.recipes.Mask%> _mask = _rightParent_1.getMask();&#xA;&lt;%org.eclipse.emf.common.util.EList%>&lt;&lt;%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();&#xA;int _size = _sourceIndices.size();&#xA;return (_plus - _size);"/>
303 </eAnnotations>
304 </eOperations>
305 <eStructuralFeatures xsi:type="ecore:EReference" name="rightParentComplementaryMask"
306 eType="#//Mask" containment="true" resolveProxies="false"/>
307 </eClassifiers>
308 <eClassifiers xsi:type="ecore:EClass" name="ExistenceJoinRecipe" abstract="true"
309 eSuperTypes="#//BetaRecipe">
310 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
311 <details key="documentation" value="Existence joins are TODO&#xA;&#xA;See http://en.wikipedia.org/wiki/Relational_algebra"/>
312 </eAnnotations>
313 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
314 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
315 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();&#xA;return _leftParent.getArity();"/>
316 </eAnnotations>
317 </eOperations>
318 </eClassifiers>
319 <eClassifiers xsi:type="ecore:EClass" name="SemiJoinRecipe" eSuperTypes="#//ExistenceJoinRecipe">
320 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
321 <details key="documentation" value="A semi-join is TODO&#xA;&#xA;See http://en.wikipedia.org/wiki/Relational_algebra"/>
322 </eAnnotations>
323 </eClassifiers>
324 <eClassifiers xsi:type="ecore:EClass" name="AntiJoinRecipe" eSuperTypes="#//ExistenceJoinRecipe">
325 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
326 <details key="documentation" value="An anti-join is TODO&#xA;&#xA;See http://en.wikipedia.org/wiki/Relational_algebra"/>
327 </eAnnotations>
328 </eClassifiers>
329 <eClassifiers xsi:type="ecore:EClass" name="InputFilterRecipe" eSuperTypes="#//FilterRecipe">
330 <eStructuralFeatures xsi:type="ecore:EAttribute" name="inputKey" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"
331 transient="true"/>
332 <eStructuralFeatures xsi:type="ecore:EAttribute" name="keyID" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
333 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
334 <details key="documentation" value="Temporary construct for identifying types over the wire.&#xA;TODO improve type references"/>
335 </eAnnotations>
336 </eStructuralFeatures>
337 <eStructuralFeatures xsi:type="ecore:EReference" name="mask" eType="#//Mask" containment="true"
338 resolveProxies="false"/>
339 </eClassifiers>
340 <eClassifiers xsi:type="ecore:EClass" name="SingleColumnAggregatorRecipe" eSuperTypes="#//AlphaRecipe #//RederivableNodeRecipe">
341 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
342 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
343 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.MonotonicityInfo%> info = getOptionalMonotonicityInfo();&#xA;if (info == null) {&#xA;&#x9;return 1 + getGroupByMask().getSourceIndices().size();&#xA;} else {&#x9;&#xA;&#x9;return info.getCoreMask().getSourceIndices().size() + info.getPosetMask().getSourceIndices().size();&#xA;}"/>
344 </eAnnotations>
345 </eOperations>
346 <eStructuralFeatures xsi:type="ecore:EAttribute" name="multisetAggregationOperator"
347 eType="#//AggregationOperator"/>
348 <eStructuralFeatures xsi:type="ecore:EAttribute" name="aggregableIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
349 <eStructuralFeatures xsi:type="ecore:EReference" name="groupByMask" lowerBound="1"
350 eType="#//Mask" containment="true"/>
351 </eClassifiers>
352 <eClassifiers xsi:type="ecore:EDataType" name="AggregationOperator" instanceTypeName="tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator&lt;?, ?, ?>"/>
353 <eClassifiers xsi:type="ecore:EClass" name="DiscriminatorDispatcherRecipe" eSuperTypes="#//SingleParentNodeRecipe">
354 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
355 <details key="documentation" value="Node that sends tuples off to different buckets (attached as children) based on the value of a given column."/>
356 </eAnnotations>
357 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
358 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
359 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;return _parent.getArity();"/>
360 </eAnnotations>
361 </eOperations>
362 <eStructuralFeatures xsi:type="ecore:EAttribute" name="discriminationColumnIndex"
363 eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
364 </eClassifiers>
365 <eClassifiers xsi:type="ecore:EClass" name="DiscriminatorBucketRecipe" eSuperTypes="#//SingleParentNodeRecipe">
366 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
367 <details key="documentation" value="A bucket holds a filtered set of tuples of its parent DiscriminatorDispatcher; exactly those that have the given bucket key at their discrimination column."/>
368 </eAnnotations>
369 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
370 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
371 <details key="body" value="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;return _parent.getArity();"/>
372 </eAnnotations>
373 </eOperations>
374 <eStructuralFeatures xsi:type="ecore:EAttribute" name="bucketKey" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
375 </eClassifiers>
376 <eClassifiers xsi:type="ecore:EClass" name="RederivableNodeRecipe" abstract="true">
377 <eStructuralFeatures xsi:type="ecore:EAttribute" name="deleteRederiveEvaluation"
378 eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" defaultValueLiteral="false"/>
379 <eStructuralFeatures xsi:type="ecore:EReference" name="optionalMonotonicityInfo"
380 eType="#//MonotonicityInfo" containment="true"/>
381 </eClassifiers>
382 <eClassifiers xsi:type="ecore:EClass" name="RelationEvaluationRecipe" eSuperTypes="#//MultiParentNodeRecipe">
383 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
384 <details key="documentation" value="@since 2.8"/>
385 </eAnnotations>
386 <eStructuralFeatures xsi:type="ecore:EReference" name="evaluator" eType="#//ExpressionDefinition"/>
387 </eClassifiers>
388 <eClassifiers xsi:type="ecore:EClass" name="RepresentativeElectionRecipe" eSuperTypes="#//AlphaRecipe">
389 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
390 <details key="documentation" value="Represents represenative election."/>
391 </eAnnotations>
392 <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
393 <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
394 <details key="body" value="return 2;"/>
395 </eAnnotations>
396 </eOperations>
397 <eStructuralFeatures xsi:type="ecore:EAttribute" name="connectivity" eType="#//Connectivity"/>
398 </eClassifiers>
399 <eClassifiers xsi:type="ecore:EDataType" name="Connectivity" instanceClassName="tools.refinery.interpreter.matchers.psystem.basicenumerables.Connectivity"/>
400</ecore:EPackage>
diff --git a/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore.license b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore.license
new file mode 100644
index 00000000..03d1d42b
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore.license
@@ -0,0 +1,4 @@
1Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro
2Copyright (c) 2023 The Refinery Authors <https://refinery.tools>
3
4SPDX-License-Identifier: EPL-2.0
diff --git a/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel
new file mode 100644
index 00000000..89ff6e3a
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel
@@ -0,0 +1,171 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
3 xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro&#xA;Copyright (c) 2023 The Refinery Authors &lt;https://refinery.tools>&#xA;This program and the accompanying materials are made available under the&#xA;terms of the Eclipse Public License v. 2.0 which is available at&#xA;http://www.eclipse.org/legal/epl-v20.html.&#xA;&#xA;SPDX-License-Identifier: EPL-2.0"
4 modelDirectory="/tools.refinery.refinery-interpreter-rete-recipes/src/main/emf-gen"
5 modelPluginID="tools.refinery.refinery-interpreter-rete-recipes" runtimeJar="true" forceOverwrite="true"
6 modelName="Rete-recipes" updateClasspath="false" nonNLSMarkers="true" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
7 testsDirectory="" importerID="org.eclipse.emf.importer.ecore" containmentProxies="true"
8 complianceLevel="7.0" language="en" operationReflection="true">
9 <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/exporter/org.eclipse.xsd.ecore.exporter">
10 <genAnnotations source="selectedPackages">
11 <details key="http://www.eclipse.org/emf/2002/Ecore" value="Ecore.xsd"/>
12 </genAnnotations>
13 <details key="directoryURI" value="."/>
14 </genAnnotations>
15 <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/exporter/org.eclipse.xsd.ecore.exporter.xmi">
16 <genAnnotations source="selectedPackages">
17 <details key="http://www.eclipse.org/emf/2002/Ecore" value="EcoreXMI.xsd"/>
18 </genAnnotations>
19 <details key="directoryURI" value="."/>
20 </genAnnotations>
21 <foreignModel>recipes.ecore</foreignModel>
22 <modelPluginVariables>org.eclipse.xtext.xbase.lib</modelPluginVariables>
23 <modelPluginVariables>org.eclipse.emf.ecore.xcore.lib</modelPluginVariables>
24 <genPackages prefix="Recipes" basePackage="tools.refinery.interpreter.rete" disposableProviderFactory="true"
25 ecorePackage="recipes.ecore#/">
26 <genDataTypes ecoreDataType="recipes.ecore#//Index"/>
27 <genDataTypes ecoreDataType="recipes.ecore#//AggregationOperator"/>
28 <genDataTypes ecoreDataType="recipes.ecore#//Connectivity"/>
29 <genClasses ecoreClass="recipes.ecore#//ReteRecipe">
30 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//ReteRecipe/recipeNodes"/>
31 </genClasses>
32 <genClasses image="false" ecoreClass="recipes.ecore#//ReteNodeRecipe">
33 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ReteNodeRecipe/traceInfo"/>
34 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ReteNodeRecipe/equivalenceClassIDs"/>
35 <genOperations ecoreOperation="recipes.ecore#//ReteNodeRecipe/getArity" body="throw new &lt;%java.lang.UnsupportedOperationException%>();"/>
36 </genClasses>
37 <genClasses image="false" ecoreClass="recipes.ecore#//SingleParentNodeRecipe">
38 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference recipes.ecore#//SingleParentNodeRecipe/parent"/>
39 </genClasses>
40 <genClasses image="false" ecoreClass="recipes.ecore#//AlphaRecipe"/>
41 <genClasses image="false" ecoreClass="recipes.ecore#//MultiParentNodeRecipe">
42 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference recipes.ecore#//MultiParentNodeRecipe/parents"/>
43 <genOperations ecoreOperation="recipes.ecore#//MultiParentNodeRecipe/getArity"
44 body="&lt;%org.eclipse.emf.common.util.EList%>&lt;&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%>> _parents = this.getParents();&#xA;&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _get = _parents.get(0);&#xA;return _get.getArity();"/>
45 </genClasses>
46 <genClasses ecoreClass="recipes.ecore#//MonotonicityInfo">
47 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//MonotonicityInfo/coreMask"/>
48 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//MonotonicityInfo/posetMask"/>
49 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//MonotonicityInfo/posetComparator"/>
50 </genClasses>
51 <genClasses ecoreClass="recipes.ecore#//UniquenessEnforcerRecipe"/>
52 <genClasses ecoreClass="recipes.ecore#//ProductionRecipe">
53 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//ProductionRecipe/mappedIndices"/>
54 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ProductionRecipe/pattern"/>
55 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ProductionRecipe/patternFQN"/>
56 <genOperations ecoreOperation="recipes.ecore#//ProductionRecipe/getArity" body="return this.getMappedIndices().size();"/>
57 </genClasses>
58 <genClasses image="false" ecoreClass="recipes.ecore#//IndexerRecipe">
59 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//IndexerRecipe/mask"/>
60 <genOperations ecoreOperation="recipes.ecore#//IndexerRecipe/getArity" body="&lt;%tools.refinery.interpreter.rete.recipes.Mask%> _mask = this.getMask();&#xA;return _mask.getSourceArity();"/>
61 </genClasses>
62 <genClasses ecoreClass="recipes.ecore#//ProjectionIndexerRecipe"/>
63 <genClasses ecoreClass="recipes.ecore#//AggregatorIndexerRecipe"/>
64 <genClasses image="false" ecoreClass="recipes.ecore#//BetaRecipe">
65 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//BetaRecipe/leftParent"/>
66 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//BetaRecipe/rightParent"/>
67 </genClasses>
68 <genClasses ecoreClass="recipes.ecore#//Mask">
69 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//Mask/sourceIndices"/>
70 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//Mask/sourceArity"/>
71 </genClasses>
72 <genClasses ecoreClass="recipes.ecore#//StringIndexMapEntry">
73 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//StringIndexMapEntry/key"/>
74 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//StringIndexMapEntry/value"/>
75 </genClasses>
76 <genClasses ecoreClass="recipes.ecore#//InputRecipe">
77 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//InputRecipe/inputKey"/>
78 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//InputRecipe/keyID"/>
79 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//InputRecipe/keyArity"/>
80 <genOperations ecoreOperation="recipes.ecore#//InputRecipe/getArity" body="return getKeyArity();"/>
81 </genClasses>
82 <genClasses ecoreClass="recipes.ecore#//ConstantRecipe">
83 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ConstantRecipe/constantValues"/>
84 <genOperations ecoreOperation="recipes.ecore#//ConstantRecipe/getArity" body="return this.getConstantValues().size();"/>
85 </genClasses>
86 <genClasses ecoreClass="recipes.ecore#//TransitiveClosureRecipe">
87 <genOperations ecoreOperation="recipes.ecore#//TransitiveClosureRecipe/getArity"
88 body="return 2;"/>
89 </genClasses>
90 <genClasses image="false" ecoreClass="recipes.ecore#//FilterRecipe">
91 <genOperations ecoreOperation="recipes.ecore#//FilterRecipe/getArity" body="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;return _parent.getArity();"/>
92 </genClasses>
93 <genClasses ecoreClass="recipes.ecore#//InequalityFilterRecipe">
94 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//InequalityFilterRecipe/subject"/>
95 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//InequalityFilterRecipe/inequals"/>
96 </genClasses>
97 <genClasses ecoreClass="recipes.ecore#//EqualityFilterRecipe">
98 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//EqualityFilterRecipe/indices"/>
99 </genClasses>
100 <genClasses ecoreClass="recipes.ecore#//TransparentRecipe"/>
101 <genClasses ecoreClass="recipes.ecore#//TrimmerRecipe">
102 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//TrimmerRecipe/mask"/>
103 <genOperations ecoreOperation="recipes.ecore#//TrimmerRecipe/getArity" body="&lt;%tools.refinery.interpreter.rete.recipes.Mask%> _mask = this.getMask();&#xA;&lt;%org.eclipse.emf.common.util.EList%>&lt;&lt;%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();&#xA;return _sourceIndices.size();"/>
104 </genClasses>
105 <genClasses ecoreClass="recipes.ecore#//ExpressionDefinition">
106 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ExpressionDefinition/evaluator"/>
107 </genClasses>
108 <genClasses image="false" ecoreClass="recipes.ecore#//ExpressionEnforcerRecipe">
109 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//ExpressionEnforcerRecipe/expression"/>
110 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//ExpressionEnforcerRecipe/mappedIndices"/>
111 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ExpressionEnforcerRecipe/cacheOutput"/>
112 </genClasses>
113 <genClasses ecoreClass="recipes.ecore#//CheckRecipe">
114 <genOperations ecoreOperation="recipes.ecore#//CheckRecipe/getArity" body="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;return _parent.getArity();"/>
115 </genClasses>
116 <genClasses ecoreClass="recipes.ecore#//EvalRecipe">
117 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//EvalRecipe/unwinding"/>
118 <genOperations ecoreOperation="recipes.ecore#//EvalRecipe/getArity" body="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;int _arity = _parent.getArity();&#xA;return (1 + _arity);"/>
119 </genClasses>
120 <genClasses image="false" ecoreClass="recipes.ecore#//IndexerBasedAggregatorRecipe">
121 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//IndexerBasedAggregatorRecipe/parent"/>
122 <genOperations ecoreOperation="recipes.ecore#//IndexerBasedAggregatorRecipe/getArity"
123 body="&lt;%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _parent = this.getParent();&#xA;&lt;%tools.refinery.interpreter.rete.recipes.Mask%> _mask = _parent.getMask();&#xA;&lt;%org.eclipse.emf.common.util.EList%>&lt;&lt;%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();&#xA;int _size = _sourceIndices.size();&#xA;return (1 + _size);"/>
124 </genClasses>
125 <genClasses ecoreClass="recipes.ecore#//CountAggregatorRecipe"/>
126 <genClasses ecoreClass="recipes.ecore#//JoinRecipe">
127 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//JoinRecipe/rightParentComplementaryMask"/>
128 <genOperations ecoreOperation="recipes.ecore#//JoinRecipe/getArity" body="&lt;%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();&#xA;int _arity = _leftParent.getArity();&#xA;&lt;%tools.refinery.interpreter.rete.recipes.IndexerRecipe%> _rightParent = this.getRightParent();&#xA;int _arity_1 = _rightParent.getArity();&#xA;int _plus = (_arity + _arity_1);&#xA;&lt;%tools.refinery.interpreter.rete.recipes.IndexerRecipe%> _rightParent_1 = this.getRightParent();&#xA;&lt;%tools.refinery.interpreter.rete.recipes.Mask%> _mask = _rightParent_1.getMask();&#xA;&lt;%org.eclipse.emf.common.util.EList%>&lt;&lt;%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();&#xA;int _size = _sourceIndices.size();&#xA;return (_plus - _size);"/>
129 </genClasses>
130 <genClasses image="false" ecoreClass="recipes.ecore#//ExistenceJoinRecipe">
131 <genOperations ecoreOperation="recipes.ecore#//ExistenceJoinRecipe/getArity"
132 body="&lt;%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();&#xA;return _leftParent.getArity();"/>
133 </genClasses>
134 <genClasses ecoreClass="recipes.ecore#//SemiJoinRecipe"/>
135 <genClasses ecoreClass="recipes.ecore#//AntiJoinRecipe"/>
136 <genClasses ecoreClass="recipes.ecore#//InputFilterRecipe">
137 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//InputFilterRecipe/inputKey"/>
138 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//InputFilterRecipe/keyID"/>
139 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//InputFilterRecipe/mask"/>
140 </genClasses>
141 <genClasses ecoreClass="recipes.ecore#//SingleColumnAggregatorRecipe">
142 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//SingleColumnAggregatorRecipe/multisetAggregationOperator"/>
143 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//SingleColumnAggregatorRecipe/aggregableIndex"/>
144 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//SingleColumnAggregatorRecipe/groupByMask"/>
145 <genOperations ecoreOperation="recipes.ecore#//SingleColumnAggregatorRecipe/getArity"
146 body="&lt;%tools.refinery.interpreter.rete.recipes.MonotonicityInfo%> info = getOptionalMonotonicityInfo();&#xA;if (info == null) {&#xA;&#x9;return 1 + getGroupByMask().getSourceIndices().size();&#xA;} else {&#x9;&#xA;&#x9;return info.getCoreMask().getSourceIndices().size() + info.getPosetMask().getSourceIndices().size();&#xA;}"/>
147 </genClasses>
148 <genClasses ecoreClass="recipes.ecore#//DiscriminatorDispatcherRecipe">
149 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//DiscriminatorDispatcherRecipe/discriminationColumnIndex"/>
150 <genOperations ecoreOperation="recipes.ecore#//DiscriminatorDispatcherRecipe/getArity"
151 body="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;return _parent.getArity();"/>
152 </genClasses>
153 <genClasses ecoreClass="recipes.ecore#//DiscriminatorBucketRecipe">
154 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//DiscriminatorBucketRecipe/bucketKey"/>
155 <genOperations ecoreOperation="recipes.ecore#//DiscriminatorBucketRecipe/getArity"
156 body="&lt;%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();&#xA;return _parent.getArity();"/>
157 </genClasses>
158 <genClasses image="false" ecoreClass="recipes.ecore#//RederivableNodeRecipe">
159 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//RederivableNodeRecipe/deleteRederiveEvaluation"/>
160 <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//RederivableNodeRecipe/optionalMonotonicityInfo"/>
161 </genClasses>
162 <genClasses ecoreClass="recipes.ecore#//RelationEvaluationRecipe">
163 <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference recipes.ecore#//RelationEvaluationRecipe/evaluator"/>
164 </genClasses>
165 <genClasses ecoreClass="recipes.ecore#//RepresentativeElectionRecipe">
166 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//RepresentativeElectionRecipe/connectivity"/>
167 <genOperations ecoreOperation="recipes.ecore#//RepresentativeElectionRecipe/getArity"
168 body="return 2;"/>
169 </genClasses>
170 </genPackages>
171</genmodel:GenModel>
diff --git a/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license
new file mode 100644
index 00000000..03d1d42b
--- /dev/null
+++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license
@@ -0,0 +1,4 @@
1Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro
2Copyright (c) 2023 The Refinery Authors <https://refinery.tools>
3
4SPDX-License-Identifier: EPL-2.0