view lib/patchablegraph/browser_test.py @ 1562:c2ed44ed1e3c dependabot/pip/service/collector/twisted-19.7.0

Bump twisted from 19.2.0 to 19.7.0 in /service/collector Bumps [twisted](https://github.com/twisted/twisted) from 19.2.0 to 19.7.0. - [Release notes](https://github.com/twisted/twisted/releases) - [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst) - [Commits](https://github.com/twisted/twisted/compare/twisted-19.2.0...twisted-19.7.0) Signed-off-by: dependabot[bot] <support@github.com>
author dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
date Fri, 14 Feb 2020 10:01:26 +0000
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()