comparison service/mqtt_to_rdf/mqtt_to_rdf.py @ 1642:78024b27f9ec

serve graph/config
author drewp@bigasterisk.com
date Fri, 17 Sep 2021 11:01:06 -0700
parents 1c36ad1eb8b3
children c04b5303eb08
comparison
equal deleted inserted replaced
1641:5403c6343fa4 1642:78024b27f9ec
3 """ 3 """
4 import glob 4 import glob
5 import json 5 import json
6 import logging 6 import logging
7 import os 7 import os
8
9 from rdfdb.patch import Patch
8 10
9 from mqtt_message import graphFromMessage 11 from mqtt_message import graphFromMessage
10 import os 12 import os
11 import time 13 import time
12 from dataclasses import dataclass 14 from dataclasses import dataclass
394 debugPageData=debugPageData, 396 debugPageData=debugPageData,
395 influxExport=influxExport, 397 influxExport=influxExport,
396 inference=inference)) 398 inference=inference))
397 log.info(f'set up {len(srcs)} sources') 399 log.info(f'set up {len(srcs)} sources')
398 400
401 peg = PatchableGraph()
402 peg.patch(Patch(addQuads=[(s,p,o,URIRef('/config')) for s,p,o in expandedConfig]))
403
399 port = 10018 404 port = 10018
400 reactor.listenTCP(port, 405 reactor.listenTCP(port,
401 cyclone.web.Application([ 406 cyclone.web.Application([
402 (r"/()", cyclone.web.StaticFileHandler, { 407 (r"/()", cyclone.web.StaticFileHandler, {
403 "path": ".", 408 "path": ".",
404 "default_filename": "index.html" 409 "default_filename": "index.html"
405 }), 410 }),
406 (r"/build/(bundle.js)", cyclone.web.StaticFileHandler, { 411 (r"/build/(bundle.js)", cyclone.web.StaticFileHandler, {
407 "path": "build" 412 "path": "build"
413 }),
414 (r"/graph/config", CycloneGraphHandler, {
415 'masterGraph': peg,
408 }), 416 }),
409 (r"/graph/mqtt", CycloneGraphHandler, { 417 (r"/graph/mqtt", CycloneGraphHandler, {
410 'masterGraph': masterGraph 418 'masterGraph': masterGraph
411 }), 419 }),
412 (r"/graph/mqtt/events", CycloneGraphEventsHandler, { 420 (r"/graph/mqtt/events", CycloneGraphEventsHandler, {