Mercurial > code > home > repos > homeauto
changeset 1266:ee5698ef64dd
add separate :matchPredicate support. some build and log edits.
Ignore-this: acdab8c2859e5f8622b491228d0c74dd
darcs-hash:564fab06788fee02dbb69e33c087085313fc24e1
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 20 Apr 2019 23:36:30 -0700 |
parents | 1ddd1f057749 |
children | 19ba6f9787b9 |
files | service/reasoning/actions.py service/reasoning/inputgraph.py service/reasoning/makefile service/reasoning/reasoning.py |
diffstat | 4 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/service/reasoning/actions.py Sat Apr 20 23:35:46 2019 -0700 +++ b/service/reasoning/actions.py Sat Apr 20 23:36:30 2019 -0700 @@ -103,10 +103,12 @@ for stmt in inferred: putUrl = deviceGraph.value(stmt[0], ROOM['putUrl']) putPred = deviceGraph.value(stmt[0], ROOM['putPredicate']) - if putUrl and putPred == stmt[1]: + matchPred = deviceGraph.value(stmt[0], ROOM['matchPredicate'], + default=putPred) + if putUrl and matchPred == stmt[1]: self._put(putUrl + '?' + urllib.urlencode([ ('s', str(stmt[0])), - ('p', str(stmt[1]))]), + ('p', str(putPred))]), str(stmt[2].toPython()), agent=agentFor.get(stmt[0], None))
--- a/service/reasoning/inputgraph.py Sat Apr 20 23:35:46 2019 -0700 +++ b/service/reasoning/inputgraph.py Sat Apr 20 23:36:30 2019 -0700 @@ -40,7 +40,7 @@ self.patchSource = ReconnectingPatchSource( URIRef('http://bang:9072/graph/home'), #URIRef('http://frontdoor:10012/graph/events'), - self.onPatch, reconnectSecs=10) + self.onPatch, reconnectSecs=10, agent='reasoning') def onPatch(self, p, fullGraph): if fullGraph:
--- a/service/reasoning/makefile Sat Apr 20 23:35:46 2019 -0700 +++ b/service/reasoning/makefile Sat Apr 20 23:36:30 2019 -0700 @@ -21,3 +21,7 @@ --net=host \ ${TAG} \ python /mnt/${JOB}.py -iro + +redeploy: build_image + supervisorctl restart $(JOB)_$(PORT) +
--- a/service/reasoning/reasoning.py Sat Apr 20 23:35:46 2019 -0700 +++ b/service/reasoning/reasoning.py Sat Apr 20 23:36:30 2019 -0700 @@ -24,7 +24,7 @@ from colorlog import ColoredFormatter from docopt import docopt from rdflib import Namespace, Literal, RDF, Graph -from twisted.internet import reactor, task +from twisted.internet import reactor, task, defer from twisted.internet.defer import inlineCallbacks import cyclone.web, cyclone.websocket @@ -285,6 +285,8 @@ secondary_log_colors={}, style='%' )) + defer.setDebugging(True) + if arg['-i']: import twisted.python.log