comparison lib/patchablegraph/browser_test.py @ 710:94610b5263e4

add browser_test server for playing with /graph resource Ignore-this: 6112c234b93e0fb99ffe918a022e5a49
author drewp@bigasterisk.com
date Mon, 03 Feb 2020 23:45:15 -0800
parents
children
comparison
equal deleted inserted replaced
709:95556cacb6e1 710:94610b5263e4
1 """
2 see how a browser talks to this PatchableGraph
3 """
4
5 from rdflib import Namespace, Literal, ConjunctiveGraph, URIRef, RDF
6 from twisted.internet import reactor
7 import cyclone.web
8
9 from standardservice.logsetup import log, verboseLogging
10 from patchablegraph import PatchableGraph, CycloneGraphEventsHandler, CycloneGraphHandler
11
12 verboseLogging(True)
13
14 graph = PatchableGraph()
15 g = ConjunctiveGraph()
16 g.add((URIRef('http://example.com/s'),
17 URIRef('http://example.com/p'),
18 URIRef('http://example.com/o'),
19 URIRef('http://example.com/g')))
20 graph.setToGraph(g)
21
22 class Application(cyclone.web.Application):
23 def __init__(self):
24 handlers = [
25 (r'/graph', CycloneGraphHandler, {'masterGraph': graph}),
26 (r'/graph/events', CycloneGraphEventsHandler,
27 {'masterGraph': graph}),
28 ]
29 cyclone.web.Application.__init__(self, handlers)
30
31
32 reactor.listenTCP(8021, Application())
33 reactor.run()