How to let machine parse RDF to construct the HTTP request?

39 views
Skip to first unread message

shen...@gmail.com

unread,
Apr 14, 2016, 10:23:49 AM4/14/16
to rdflib-dev
Dear all, I have some question about 

semantic web .Hope you can give me some help.

I use EYE reasoner output like this:
@prefix ex: <http://example.org/image#>.
@prefix http: <http://www.w3.org/2011/http#>.
@prefix dbpedia: <http://dbpedia.org/resource/>.

<myphoto.jpg> a <http://dbpedia.org/resource/Image>. 
_:sk0 http:methodName "POST". 
_:sk0 http:requestURI "/images/". 
_:sk0 http:body <myphoto.jpg>. 
_:sk0 http:resp _:sk1. 
_:sk1 http:body <myphoto.jpg>. 
I want my machine to parse this output to construct the HTTP request. 

 it's an HTTP POST request to /images/. it's body is myphoto.jpg

The response to this request is a representation of myphoto.jpg

I use RDFlib to read .n3 file output like this:

 
(rdflib.term.BNode('f933eede341d345b580e3c40505a2b4d0b1'),
 rdflib.term.Literal(u'POST'))


(rdflib.term.URIRef(u'file:///home/pi/myphoto.jpg'),
 rdflib.term.URIRef(u'http://dbpedia.org/resource/Image'))


(rdflib.term.BNode('f933eede341d345b580e3c40505a2b4d0b1'),
 rdflib.term.URIRef(u'http://www.w3.org/2011/http#resp'),
 rdflib.term.BNode('f933eede341d345b580e3c40505a2b4d0b2'))


(rdflib.term.BNode('f933eede341d345b580e3c40505a2b4d0b1'),
 rdflib.term.Literal(u'/images/'))


(rdflib.term.BNode('f933eede341d345b580e3c40505a2b4d0b1'),
 rdflib.term.URIRef(u'http://www.w3.org/2011/http#body'),
 rdflib.term.URIRef(u'file:///home/pi/myphoto.jpg'))


(rdflib.term.BNode('f933eede341d345b580e3c40505a2b4d0b2'),
 rdflib.term.URIRef(u'http://www.w3.org/2011/http#body'),
 rdflib.term.URIRef(u'file:///home/pi/myphoto.jpg'))

how to let machine execute this output to construct the HTTP request? 

hope you can give some help and instruction.

Thank you for help you can provide.
sheng
Reply all
Reply to author
Forward
0 new messages