view service/environment/rdfdoc.py @ 1460:dff065147f57 dependabot/pip/service/irRemote/requests-2.20.0

Bump requests from 2.18.4 to 2.20.0 in /service/irRemote Bumps [requests](https://github.com/requests/requests) from 2.18.4 to 2.20.0. - [Release notes](https://github.com/requests/requests/releases) - [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md) - [Commits](https://github.com/requests/requests/compare/v2.18.4...v2.20.0) Signed-off-by: dependabot[bot] <support@github.com>
author dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
date Sun, 03 Nov 2019 10:01:33 +0000
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))