view lib/patchablegraph/browser_test.py @ 1544:33076ad439d1

fixes to TS and page build. remove some unused attempts at binding to <streamed-graph> Ignore-this: dc4cd74d21fef101b32da824bbf60a00 darcs-hash:46f8164157442fb22e93a3e2062ffbcd20b43350
author drewp <drewp@bigasterisk.com>
date Thu, 13 Feb 2020 10:17:54 -0800
parents 9733063421e1
children
line wrap: on
line source

"""
see how a browser talks to this PatchableGraph
"""

from rdflib import Namespace, Literal, ConjunctiveGraph, URIRef, RDF
from twisted.internet import reactor
import cyclone.web

from standardservice.logsetup import log, verboseLogging
from patchablegraph import PatchableGraph, CycloneGraphEventsHandler, CycloneGraphHandler

verboseLogging(True)

graph = PatchableGraph()
g = ConjunctiveGraph()
g.add((URIRef('http://example.com/s'),
       URIRef('http://example.com/p'),
       URIRef('http://example.com/o'),
       URIRef('http://example.com/g')))
graph.setToGraph(g)

class Application(cyclone.web.Application):
    def __init__(self):
        handlers = [
            (r'/graph', CycloneGraphHandler, {'masterGraph': graph}),
            (r'/graph/events', CycloneGraphEventsHandler,
             {'masterGraph': graph}),
        ]
        cyclone.web.Application.__init__(self, handlers)


reactor.listenTCP(8021, Application())
reactor.run()