aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/interpreter-rete-recipes/src/main/resources/model
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-10-14 14:54:38 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-10-14 14:54:38 +0200
commit54c4c91097c50f6cedb02cb5b1aea32ae16a3421 (patch)
tree222b86f87511582c2b602c896e210d1b138220a9 /subprojects/interpreter-rete-recipes/src/main/resources/model
parentfix(query-interpreter): register Recipes package (diff)
downloadrefinery-54c4c91097c50f6cedb02cb5b1aea32ae16a3421.tar.gz
refinery-54c4c91097c50f6cedb02cb5b1aea32ae16a3421.tar.zst
refinery-54c4c91097c50f6cedb02cb5b1aea32ae16a3421.zip
refactor(interpreter-rete): recipe hashing
Use isomorphism-aware hashing to speed up RecipeRecognizer. Due to possibly cyclic (recursive) recipes, we can't recursively turn recipes into a canonical form. Recipes referring to already canonical (non-recurisve, or recursive and entirely canonicalized) recipes can be hashed, while recursive recipes in the middle of caninicalization still have to be compared more slowly by their contents. To keep the list of recipes compared by contents small, recipes are assigned a hash code whenever possible. We keep the equivalence class IDs for recipes, as there might be hash code clashes, as well as recursive recipes that only later get assigned a hash code. Also fixes a concurrency problem with equivalence class IDs by using an AtomicLong. Also reworks recipe instantiation, as now recipes might be canonicalized before they are instantiated.
Diffstat (limited to 'subprojects/interpreter-rete-recipes/src/main/resources/model')
-rw-r--r--subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore2
-rw-r--r--subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel11
2 files changed, 9 insertions, 4 deletions
diff --git a/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore
index a4617833..6b8f10ea 100644
--- a/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore
+++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore
@@ -31,6 +31,8 @@
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"/> 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> 32 </eAnnotations>
33 </eStructuralFeatures> 33 </eStructuralFeatures>
34 <eStructuralFeatures xsi:type="ecore:EAttribute" name="cachedHashCode" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELongObject"/>
35 <eStructuralFeatures xsi:type="ecore:EAttribute" name="constructed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
34 </eClassifiers> 36 </eClassifiers>
35 <eClassifiers xsi:type="ecore:EClass" name="SingleParentNodeRecipe" abstract="true" 37 <eClassifiers xsi:type="ecore:EClass" name="SingleParentNodeRecipe" abstract="true"
36 eSuperTypes="#//ReteNodeRecipe"> 38 eSuperTypes="#//ReteNodeRecipe">
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
index 89ff6e3a..f7dc7a4e 100644
--- a/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel
+++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel
@@ -2,10 +2,11 @@
2<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" 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" 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" 4 modelDirectory="/tools.refinery.refinery-interpreter-rete-recipes/src/main/emf-gen"
5 modelPluginID="tools.refinery.refinery-interpreter-rete-recipes" runtimeJar="true" forceOverwrite="true" 5 modelPluginID="tools.refinery.refinery-interpreter-rete-recipes" runtimeJar="true"
6 modelName="Rete-recipes" updateClasspath="false" nonNLSMarkers="true" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" 6 forceOverwrite="true" modelName="Rete-recipes" updateClasspath="false" nonNLSMarkers="true"
7 testsDirectory="" importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" 7 rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" testsDirectory=""
8 complianceLevel="7.0" language="en" operationReflection="true"> 8 importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" complianceLevel="7.0"
9 language="en" operationReflection="true">
9 <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/exporter/org.eclipse.xsd.ecore.exporter"> 10 <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/exporter/org.eclipse.xsd.ecore.exporter">
10 <genAnnotations source="selectedPackages"> 11 <genAnnotations source="selectedPackages">
11 <details key="http://www.eclipse.org/emf/2002/Ecore" value="Ecore.xsd"/> 12 <details key="http://www.eclipse.org/emf/2002/Ecore" value="Ecore.xsd"/>
@@ -32,6 +33,8 @@
32 <genClasses image="false" ecoreClass="recipes.ecore#//ReteNodeRecipe"> 33 <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/traceInfo"/>
34 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ReteNodeRecipe/equivalenceClassIDs"/> 35 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ReteNodeRecipe/equivalenceClassIDs"/>
36 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ReteNodeRecipe/cachedHashCode"/>
37 <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ReteNodeRecipe/constructed"/>
35 <genOperations ecoreOperation="recipes.ecore#//ReteNodeRecipe/getArity" body="throw new &lt;%java.lang.UnsupportedOperationException%>();"/> 38 <genOperations ecoreOperation="recipes.ecore#//ReteNodeRecipe/getArity" body="throw new &lt;%java.lang.UnsupportedOperationException%>();"/>
36 </genClasses> 39 </genClasses>
37 <genClasses image="false" ecoreClass="recipes.ecore#//SingleParentNodeRecipe"> 40 <genClasses image="false" ecoreClass="recipes.ecore#//SingleParentNodeRecipe">