Mercurial > code > home > repos > homeauto
comparison service/reasoning/inputgraph.py @ 1117:d5687ba23279
fix input graph web display by dirtying combinedGraph better.
Ignore-this: e40e7499e3d675b029f829a1f269b83a
darcs-hash:c15a1820ca7b5e40b2a27946bfe1c87cc80612fa
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 09 Oct 2016 13:57:50 -0700 |
parents | 8caf62030955 |
children | c51075f267bc |
comparison
equal
deleted
inserted
replaced
1116:d22c0c502ff6 | 1117:d5687ba23279 |
---|---|
89 ones with the predicates on the boring list. onChange(self, | 89 ones with the predicates on the boring list. onChange(self, |
90 oneShot=True) means: don't store the result of this change | 90 oneShot=True) means: don't store the result of this change |
91 anywhere; it needs to be processed only once | 91 anywhere; it needs to be processed only once |
92 """ | 92 """ |
93 self.inputDirs = inputDirs | 93 self.inputDirs = inputDirs |
94 self.onChange = onChange | 94 self._onChange = onChange |
95 self._fileGraph = Graph() | 95 self._fileGraph = Graph() |
96 self._remoteData = RemoteData(lambda: self.onChange(self)) | 96 self._remoteData = RemoteData(lambda: self.onChangeLocal()) |
97 self._combinedGraph = None | 97 self._combinedGraph = None |
98 self._oneShotAdditionGraph = None | 98 self._oneShotAdditionGraph = None |
99 | 99 |
100 def onChangeLocal(self, oneShot=False, oneShotGraph=None): | |
101 self._combinedGraph = None | |
102 self._onChange(self, oneShot=oneShot, oneShotGraph=oneShotGraph) | |
103 | |
100 def updateFileData(self): | 104 def updateFileData(self): |
101 """ | 105 """ |
102 make sure we contain the correct data from the files in inputDirs | 106 make sure we contain the correct data from the files in inputDirs |
103 """ | 107 """ |
104 # this sample one is actually only needed for the output, but I don't | 108 # this sample one is actually only needed for the output, but I don't |
113 log.debug("read %s", fp) | 117 log.debug("read %s", fp) |
114 # todo: if this fails, leave the report in the graph | 118 # todo: if this fails, leave the report in the graph |
115 self._fileGraph.parse(fp.open(), format="n3") | 119 self._fileGraph.parse(fp.open(), format="n3") |
116 self._combinedGraph = None | 120 self._combinedGraph = None |
117 | 121 |
118 self.onChange(self) | 122 self.onChangeLocal() |
119 | 123 |
120 def addOneShot(self, g): | 124 def addOneShot(self, g): |
121 """ | 125 """ |
122 add this graph to the total, call onChange, and then revert | 126 add this graph to the total, call onChange, and then revert |
123 the addition of this graph | 127 the addition of this graph |