Mercurial > code > home > repos > homeauto
view service/reasoning/rdflibtrig.py @ 235:5ad229334a88
rdflib can parse trig now
Ignore-this: ad1feb1d88249f509d2906b6cdbe62c6
author | drewp@bigasterisk.com |
---|---|
date | Mon, 01 Feb 2016 02:15:23 -0800 |
parents | 745eff67ad40 |
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