Mercurial > code > home > repos > homeauto
view service/reasoning/rdflibtrig.py @ 1042:aabb6ef60042
reindent
Ignore-this: e1d8671c92ea28fe8a176d88262e6523
darcs-hash:7c7caabe23b7b2703d9b007401332f59998fdf5b
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Mon, 01 Feb 2016 02:34:26 -0800 |
parents | 2fa7daf06f34 |
children | 0c306e76d8c5 |
line wrap: on
line source
import re, time import restkit from rdflib.parser import StringInputSource from rdflib import ConjunctiveGraph def addTrig(graph, url, timeout=2): t1 = time.time() response = restkit.request(url, timeout=timeout) if response.status_int != 200: raise ValueError("status %s from %s" % (response.status, url)) trig = response.body_string() fetchTime = time.time() - t1 g = ConjunctiveGraph() g.parse(StringInputSource(trig), format='trig') graph.addN(g.quads()) return fetchTime