# HG changeset patch # User drewp # Date 1555828590 25200 # Node ID ee5698ef64dd96492c829a08e9dd021946e80eb6 # Parent 1ddd1f0577498ebae49a79b85d1bf6af89df39b6 add separate :matchPredicate support. some build and log edits. Ignore-this: acdab8c2859e5f8622b491228d0c74dd darcs-hash:564fab06788fee02dbb69e33c087085313fc24e1 diff -r 1ddd1f057749 -r ee5698ef64dd service/reasoning/actions.py --- 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)) diff -r 1ddd1f057749 -r ee5698ef64dd service/reasoning/inputgraph.py --- 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: diff -r 1ddd1f057749 -r ee5698ef64dd service/reasoning/makefile --- 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) + diff -r 1ddd1f057749 -r ee5698ef64dd service/reasoning/reasoning.py --- 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