Adding triplets to 4store

here url_add is a link that contains rdf triplets that I want to store in 4store.but, if I pass url_add as an argument it generates a Relative URIerror.

so I can only pass url_add as an argument.

response = store.add_from_uri ('url_add')

Traceback (last call last):

File "", line 1, in

File "/usr/local/lib/python2.7/dist-packages/django_gstudio-0.3.dev-py2.7.egg/gstudio/testing1.py", line 152, at

response = store.add_from_uri('url_add')

      

File "/usr/local/lib/python2.7/dist-packages/django_gstudio-0.3.dev-py2.7.egg/gstudio/HTTP4Store/HTTP4Store.py", line 74, in add_from_uri

r_obj = self.rh.GET(uri, headers=headers)

      

File "/usr/local/lib/python2.7/dist-packages/django_gstudio-0.3.dev-py2.7.egg/gstudio/HTTP4Store/utils.py", line 53, in GET

return self._request("%s" % (path), method="GET", headers=headers)

      

File "/usr/local/lib/python2.7/dist-packages/django_gstudio-0.3.dev-py2.7.egg/gstudio/HTTP4Store/utils.py" line 92 in _request

resp, content = self.h.request(path, method, headers=headers, body=data)

      

File "/usr/lib/python2.7/dist-packages/httplib2/ init .py", line 1297, in the request (schema, permissions, request_uri, defrag_uri) = urlnorm (uri)

File "/usr/lib/python2.7/dist-packages/httplib2/ init .py", line 204, in urlnorm raise RelativeURIError ("Only absolute URIs are allowed. Uri =% s"% uri)

RelativeURIError: Only absolute URIs are allowed. uri = url_add

+3


source to share


1 answer


What is the value of your URL

This is an exception because you are passing in a relative url instead of an absolute one (you probably have something like "../../directory/filename.rdf"



If your url is an HTTP url (http: //host/filename.rdf) and dereferenceable , you can also use the LOAD directive as part of the SPARQL update. So it just means preempting a SPARQL query (just like you are doing a SPARQL query using 4store) using the following expression:

LOAD <http://host/filename.rdf>
INTO GRAPH <http://optional-name-of-graph>

      

+2


source







All Articles