796
|
1 #!bin/python
|
|
2
|
|
3 import os, sys
|
|
4 sys.path.append(".")
|
|
5 from twisted.internet import reactor
|
|
6 import cyclone.web, cyclone.httpclient, logging
|
|
7 from rdflib import Namespace, Literal
|
|
8 from light9 import rdfdb
|
|
9
|
|
10 if __name__ == "__main__":
|
|
11 logging.basicConfig(level=logging.DEBUG)
|
|
12 log = logging.getLogger()
|
|
13
|
|
14 port = 8052
|
|
15 g = rdfdb.SyncedGraph(port)
|
|
16
|
|
17 L9 = Namespace("http://light9.bigasterisk.com/")
|
|
18 def updateDemoValue():
|
|
19 v = list(g.objects(L9['demo'], L9['is']))
|
|
20 print "demo value is %r" % v
|
|
21
|
|
22 g.addHandler(updateDemoValue)
|
|
23
|
|
24 def adj():
|
|
25 g.patch(rdfdb.Patch(addQuads=[(L9['demo'], L9['is'], Literal(os.getpid()), L9['clientdemo'])],
|
|
26 delTriples=[]))
|
|
27 reactor.callLater(2, adj)
|
|
28
|
|
29 reactor.run()
|