Mercurial > code > home > repos > homeauto
view service/reasoning/oneShot @ 59:7ec777c93d51
rm accident
Ignore-this: 38e80acabecd09443833e1f9408fea8b
author | drewp@bigasterisk.com |
---|---|
date | Sun, 10 Feb 2013 02:27:03 -0800 |
parents | 0448fbd96a31 |
children | 745eff67ad40 |
line wrap: on
line source
#!/usr/bin/python """ send a statement to the reasoning server for one update cycle. Args are s/p/o in n3 notation, with many prefixes predefined here. """ import sys, restkit s, p, o = sys.argv[1:] prefixes = { 'room' : 'http://projects.bigasterisk.com/room/', } def expand(term): if ':' not in term: return term left, right = term.split(':', 1) if left in prefixes: return '<%s%s>' % (prefixes[left], right) return term stmt = '%s %s %s .' % (expand(s), expand(p), expand(o)) print "Sending: %s" % stmt reasoning = restkit.Resource("http://bang:9071/") reasoning.post("oneShot", headers={"content-type": "text/n3"}, payload=stmt)