Mercurial > code > home > repos > light9
diff bin/clientdemo @ 796:37d05bd17b10
rdfdb first pass
Ignore-this: 8d4935412412160aa53ccc0ab3e46d0e
author | drewp@bigasterisk.com |
---|---|
date | Fri, 13 Jul 2012 18:25:34 +0000 |
parents | |
children | 904913de4599 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/clientdemo Fri Jul 13 18:25:34 2012 +0000 @@ -0,0 +1,29 @@ +#!bin/python + +import os, sys +sys.path.append(".") +from twisted.internet import reactor +import cyclone.web, cyclone.httpclient, logging +from rdflib import Namespace, Literal +from light9 import rdfdb + +if __name__ == "__main__": + logging.basicConfig(level=logging.DEBUG) + log = logging.getLogger() + + port = 8052 + g = rdfdb.SyncedGraph(port) + + L9 = Namespace("http://light9.bigasterisk.com/") + def updateDemoValue(): + v = list(g.objects(L9['demo'], L9['is'])) + print "demo value is %r" % v + + g.addHandler(updateDemoValue) + + def adj(): + g.patch(rdfdb.Patch(addQuads=[(L9['demo'], L9['is'], Literal(os.getpid()), L9['clientdemo'])], + delTriples=[])) + reactor.callLater(2, adj) + + reactor.run()