Mercurial > code > home > repos > homeauto
changeset 1598:9e6a593180b6
Evaluation doesn't have to depend on Lhs class
author | drewp@bigasterisk.com |
---|---|
date | Sun, 05 Sep 2021 22:40:50 -0700 |
parents | 387a9cb66517 |
children | abbf0eb0e640 |
files | service/mqtt_to_rdf/inference.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/service/mqtt_to_rdf/inference.py Sun Sep 05 22:39:38 2021 -0700 +++ b/service/mqtt_to_rdf/inference.py Sun Sep 05 22:40:50 2021 -0700 @@ -63,7 +63,7 @@ def _applyFunctionsIteration(self, lhs, usedByFuncs: Graph): before = len(self.binding) delta = 0 - for ev in Evaluation.findEvals(lhs): + for ev in Evaluation.findEvals(lhs.graph): log.debug(f'{INDENT*3} found Evaluation') newBindings, usedGraph = ev.resultBindings(self.binding) @@ -240,15 +240,15 @@ """ @staticmethod - def findEvals(lhs: Lhs) -> Iterator['Evaluation']: - for stmt in lhs.graph.triples((None, MATH['sum'], None)): - operands, operandsStmts = parseList(lhs.graph, stmt[0]) + def findEvals(graph: Graph) -> Iterator['Evaluation']: + for stmt in graph.triples((None, MATH['sum'], None)): + operands, operandsStmts = parseList(graph, stmt[0]) yield Evaluation(operands, stmt, operandsStmts) - for stmt in lhs.graph.triples((None, MATH['greaterThan'], None)): + for stmt in graph.triples((None, MATH['greaterThan'], None)): yield Evaluation([stmt[0], stmt[2]], stmt, []) - for stmt in lhs.graph.triples((None, ROOM['asFarenheit'], None)): + for stmt in graph.triples((None, ROOM['asFarenheit'], None)): yield Evaluation([stmt[0]], stmt, []) # internal, use findEvals