Mercurial > code > home > repos > homeauto
view service/environment/rdfdoc.py @ 989:065fc9e07c10
piNode allow nt graphs as the body of a PUT /output
Ignore-this: 248ba89b8b1c130d86cd068c344238ba
darcs-hash:20150618084507-312f9-14b98f83f5b3fc2b94b01de4fdbcbb44b34f1c8c
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Thu, 18 Jun 2015 01:45:07 -0700 |
parents | 98311a863d7e |
children |
line wrap: on
line source
# to be shared somewhere import json, cyclone.web from cycloneerr import PrettyErrorHandler from rdflib import Graph, RDFS, URIRef graph = Graph() graph.parse("docs.n3", format="n3") # maybe the web page could just query sesame over http and we drop this server class Doc(PrettyErrorHandler, cyclone.web.RequestHandler): def get(self): uri = URIRef(self.get_argument('uri')) ret = {} comment = graph.value(uri, RDFS.comment) if comment is not None: ret['comment'] = comment self.set_header("Content-type", "application/json") self.write(json.dumps(ret))