changeset 1602:e3c44ac6d3c5

do findEvals once at setRules time
author drewp@bigasterisk.com
date Mon, 06 Sep 2021 00:56:13 -0700
parents 30463df12d89
children 7f8bf68534ed
files service/mqtt_to_rdf/inference.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/service/mqtt_to_rdf/inference.py	Sun Sep 05 23:27:49 2021 -0700
+++ b/service/mqtt_to_rdf/inference.py	Mon Sep 06 00:56:13 2021 -0700
@@ -79,7 +79,7 @@
     def _applyFunctionsIteration(self, lhs, usedByFuncs: Graph):
         before = len(self.binding)
         delta = 0
-        for ev in Evaluation.findEvals(lhs.graph):
+        for ev in lhs.evaluations:
             log.debug(f'{INDENT*3} found Evaluation')
 
             newBindings, usedGraph = ev.resultBindings(self.binding)
@@ -153,6 +153,9 @@
             if not varsAndBnodesInStmt:
                 self.staticRuleStmts.add(ruleStmt)
 
+        self.evaluations = list(Evaluation.findEvals(self.graph))
+
+
     def findCandidateBindings(self, workingSet: ReadOnlyWorkingSet) -> Iterator[CandidateBinding]:
         """bindings that fit the LHS of a rule, using statements from workingSet and functions
         from LHS"""