comparison service/mqtt_to_rdf/inference.py @ 1653:e7d594c065d4

minor refactoring
author drewp@bigasterisk.com
date Sun, 19 Sep 2021 13:20:39 -0700
parents dddfa09ea0b9
children d8e5b2232474
comparison
equal deleted inserted replaced
1652:dddfa09ea0b9 1653:e7d594c065d4
250 250
251 def _assembleRings(self, knownTrue: ChunkedGraph, stats) -> List[ChunkLooper]: 251 def _assembleRings(self, knownTrue: ChunkedGraph, stats) -> List[ChunkLooper]:
252 """make ChunkLooper for each stmt in our LHS graph, but do it in a way that they all 252 """make ChunkLooper for each stmt in our LHS graph, but do it in a way that they all
253 start out valid (or else raise NoOptions). static chunks have already been confirmed.""" 253 start out valid (or else raise NoOptions). static chunks have already been confirmed."""
254 254
255 log.info(f'{INDENT*2} stats={dict(stats)}') 255 log.info(f' {INDENT*4} stats={dict(stats)}')
256 log.info(f'{INDENT*2} taking permutations of {len(self.graph.patternChunks)=}') 256 chunks = self.graph.patternChunks.union(self.graph.chunksUsedByFuncs)
257 for i, perm in enumerate(itertools.permutations(self.graph.patternChunks)): 257 log.info(f' {INDENT*4} taking permutations of {len(chunks)=}')
258 for i, perm in enumerate(itertools.permutations(chunks)):
258 stmtStack: List[ChunkLooper] = [] 259 stmtStack: List[ChunkLooper] = []
259 prev: Optional[ChunkLooper] = None 260 prev: Optional[ChunkLooper] = None
260 if log.isEnabledFor(logging.DEBUG): 261 if log.isEnabledFor(logging.DEBUG):
261 log.debug(f'{INDENT*5} [perm {i}] try stmts in this order: {" -> ".join(repr(p) for p in perm)}') 262 log.debug(f'{INDENT*5} [perm {i}] try stmts in this order: {" -> ".join(repr(p) for p in perm)}')
262 263