Mercurial > code > home > repos > homeauto
view service/reasoning/rdflibtrig.py @ 1040:2fa7daf06f34
rdflib can parse trig now
Ignore-this: ad1feb1d88249f509d2906b6cdbe62c6
darcs-hash:c141fa6a86e7d395c4c80facc9ed7fcadcf40b29
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Mon, 01 Feb 2016 02:15:23 -0800 |
parents | 3bb18b7d21df |
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