Mercurial > code > home > repos > homeauto
view lib/patchablegraph/browser_test.py @ 1512:1e9cfec1be78
don't require first arg on PatchedGraph.serialize
Ignore-this: bc695823e03dbd012e03efa4e40b6aca
darcs-hash:1dbf9271b5ca55c78987c474ef223af9d5b811d2
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Mon, 03 Feb 2020 23:46:29 -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()