Mercurial > code > home > repos > homeauto
changeset 1090:373704a3ba0f
minor cleanups
Ignore-this: 5f932640b1dcc45bbc50d9bca53451e6
darcs-hash:d3194fd7ad4e1ec649c1bf100d2379281325cf1e
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 08 May 2016 03:01:24 -0700 |
parents | cb7fa2f30df9 |
children | 352ecf3c9aea |
files | service/reasoning/input/startup.n3 service/reasoning/reasoning.py |
diffstat | 2 files changed, 24 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/service/reasoning/input/startup.n3 Sun May 08 02:58:25 2016 -0700 +++ b/service/reasoning/input/startup.n3 Sun May 08 03:01:24 2016 -0700 @@ -1,19 +1,21 @@ @prefix : <http://projects.bigasterisk.com/room/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +# Note that turning off a source in here doesn't stop incoming oneshot +# requests (but it could, if we got continuous graphs such that +# oneshot was just a sequence of updates and not a reverse-direction +# request). <http://bang:9059/graph> is :source of :reasoning; rdfs:label "bang arduino" . <http://kitchen:9059/graph> is :source of :reasoning; rdfs:label "kitchen pi" . <http://living:9059/graph> is :source of :reasoning; rdfs:label "living room pi" . <http://slash:9059/graph> is :source of :reasoning; rdfs:label "slash arduino" . -<http://bed:9059/graph> is :source of :reasoning; rdfs:label "bed pi" . +<http://bed:9059/graph> is :source of :reasoning; rdfs:label "bed pi" . <http://brace6:9059/graph> is :source of :reasoning; rdfs:label "brace arduino" . <http://changing:9059/graph> is :source of :reasoning; rdfs:label "changing pi" . - -#<http://changing:8208/graph> is :source of :reasoning; rdfs:label "changing camera" . +<http://bang:9075/graph> is :source of :reasoning; rdfs:label "env" . <http://bang:9070/graph> is :source of :reasoning; rdfs:label "wifi usage" . -<http://bang:9075/graph> is :source of :reasoning; rdfs:label "env" . <http://bang:9099/graph> is :source of :reasoning; rdfs:label "trails" . <http://dash:9095/graph> is :source of :reasoning; rdfs:label "dash monitor" . @@ -21,8 +23,12 @@ <http://brace6:9095/graph> is :source of :reasoning; rdfs:label "brace monitor" . <http://brace6:9107/graph> is :source of :reasoning; rdfs:label "brace x idle" . <http://slash:9095/graph> is :source of :reasoning; rdfs:label "slash monitor" . -<http://slash:9107/graph> is :source of :reasoning; rdfs:label "slash x idle" . +<http://slash:9107/graph> is :source of :reasoning; rdfs:label "slash x idle" .# + + +# not built yet #<http://bang:9095/graph> is :source of :reasoning; rdfs:label "bang monitor" . +#<http://changing:8208/graph> is :source of :reasoning; rdfs:label "changing camera" . [ a :OneShotPost; :subject <http://bigasterisk.com/host/star/slideshow>; :predicate :postAction ] .
--- a/service/reasoning/reasoning.py Sun May 08 02:58:25 2016 -0700 +++ b/service/reasoning/reasoning.py Sun May 08 03:01:24 2016 -0700 @@ -90,11 +90,15 @@ evtiming.serviceLevel.timed('graphChanged') def graphChanged(self, inputGraph, oneShot=False, oneShotGraph=None): + """ + If we're getting called for a oneShot event, the oneShotGraph + statements are already in inputGraph.getGraph(). + """ log.info("----------------------") - log.info("graphChanged oneShot=%s", oneShot) + log.info("graphChanged:") if oneShot: for s in oneShotGraph: - log.debug("oneshot stmt %r", s) + log.debug(" oneshot stmt %r", s) t1 = time.time() oldInferred = self.inferred try: @@ -104,14 +108,15 @@ self.inferred += unquoteOutputStatements(self.inferred) - [self.inferred.add(s) for s in ruleStatStmts] + self.inferred += ruleStatStmts if oneShot: - # unclear where this should go, but the oneshot'd - # statements should be just as usable as inferred - # ones. - for s in oneShotGraph: - self.inferred.add(s) + # It's possible a oneShotGraph statement didn't + # trigger a rule to do something, but was itself the + # output statement. Probably we could just mix in the + # whole inputGraph here and not special-case the + # oneShotGraph. + self.inferred += oneShotGraph t2 = time.time() self.actions.putResults(self.inputGraph.getGraph(), self.inferred) @@ -136,7 +141,6 @@ return out - class Index(cyclone.web.RequestHandler): def get(self): print evtiming.serviceLevel.serviceJsonReport()