# HG changeset patch # User drewp@bigasterisk.com # Date 1630994631 25200 # Node ID 03ed8c9abd5bbf5535615d8c25f9c3c75d800046 # Parent 272f78d4671a6ad32051f73fb46bbf5a434e1150 forget GRAPH_ID optimization in this case diff -r 272f78d4671a -r 03ed8c9abd5b service/mqtt_to_rdf/inference.py --- a/service/mqtt_to_rdf/inference.py Mon Sep 06 18:39:38 2021 -0700 +++ b/service/mqtt_to_rdf/inference.py Mon Sep 06 23:03:51 2021 -0700 @@ -27,10 +27,6 @@ LOG = Namespace('http://www.w3.org/2000/10/swap/log#') MATH = Namespace('http://www.w3.org/2000/10/swap/math#') -# Graph() makes a BNode if you don't pass -# identifier, which can be a bottleneck. -GRAPH_ID = URIRef('dont/care') - @dataclass class Lhs: @@ -80,6 +76,8 @@ yield binding def _allStaticStatementsMatch(self, workingSet: ReadOnlyWorkingSet) -> bool: + # bug: see TestSelfFulfillingRule.test3 for a case where this rule's + # static stmt is matched by a non-static stmt in the rule itself for ruleStmt in self.staticRuleStmts: if ruleStmt not in workingSet: log.debug(f'{INDENT*3} {ruleStmt} not in working set- skip rule') @@ -153,7 +151,7 @@ binding: CandidateBinding def __post_init__(self): - self.usedByFuncs = Graph(identifier=GRAPH_ID) + self.usedByFuncs = Graph() self._applyFunctions() self.graphWithoutEvals = self.lhs.graph - self.usedByFuncs