diff service/reasoning/reasoning.py @ 235:5ad229334a88

rdflib can parse trig now Ignore-this: ad1feb1d88249f509d2906b6cdbe62c6
author drewp@bigasterisk.com
date Mon, 01 Feb 2016 02:15:23 -0800
parents 47682350e6f2
children 0c306e76d8c5
line wrap: on
line diff
--- a/service/reasoning/reasoning.py	Sat Jan 30 06:45:55 2016 -0800
+++ b/service/reasoning/reasoning.py	Mon Feb 01 02:15:23 2016 -0800
@@ -24,7 +24,8 @@
 from rdflib.parser import StringInputSource
 from cyclone.httpclient import fetch
 import cyclone.web, cyclone.websocket
-from inference import addTrig, infer
+from inference import infer
+from rdflibtrig import addTrig
 from graphop import graphEqual
 from docopt import docopt
 
@@ -169,7 +170,6 @@
         self.inputGraph = InputGraph([], self.graphChanged)
         self.inputGraph.updateFileData()
 
-
     def readRules(self):
         self.rulesN3 = open('rules.n3').read() # for web display
         self.ruleStore = N3RuleStore()
@@ -559,11 +559,26 @@
     
     r = Reasoning()
     if arg['-v']:
+        from colorlog import ColoredFormatter
+        log.handlers[0].setFormatter(ColoredFormatter("%(log_color)s%(levelname)-8s%(reset)s %(white)s%(message)s",
+        datefmt=None,
+        reset=True,
+        log_colors={
+                'DEBUG':    'cyan',
+                'INFO':     'green',
+                'WARNING':  'yellow',
+                'ERROR':    'red',
+                'CRITICAL': 'red,bg_white',
+        },
+        secondary_log_colors={},
+        style='%'
+))
+
         import twisted.python.log
         twisted.python.log.startLogging(sys.stdout)
         log.setLevel(logging.DEBUG)
         outlog.setLevel(logging.DEBUG)
 
     task.LoopingCall(r.poll).start(1.0)
-    reactor.listenTCP(9071, Application(r))
+    reactor.listenTCP(9071, Application(r), interface='::')
     reactor.run()