Mercurial > code > home > repos > homeauto
comparison service/environment/rdfdoc.py @ 136:2200d6530a5d
testing rdfs:comment display on enironment's graph viewer
Ignore-this: d25c57b80a1dc4180b348d64f1546cd6
author | drewp@bigasterisk.com |
---|---|
date | Sun, 13 Oct 2013 12:03:26 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
135:88e7dd767550 | 136:2200d6530a5d |
---|---|
1 # to be shared somewhere | |
2 import json, cyclone.web | |
3 from cycloneerr import PrettyErrorHandler | |
4 from rdflib import Graph, RDFS, URIRef | |
5 | |
6 graph = Graph() | |
7 graph.parse("docs.n3", format="n3") | |
8 | |
9 # maybe the web page could just query sesame over http and we drop this server | |
10 class Doc(PrettyErrorHandler, cyclone.web.RequestHandler): | |
11 def get(self): | |
12 uri = URIRef(self.get_argument('uri')) | |
13 | |
14 ret = {} | |
15 comment = graph.value(uri, RDFS.comment) | |
16 if comment is not None: | |
17 ret['comment'] = comment | |
18 | |
19 self.set_header("Content-type", "application/json") | |
20 self.write(json.dumps(ret)) |