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/", line 152, at

response = store.add_from_uri('url_add')


File "/usr/local/lib/python2.7/dist-packages/", line 74, in add_from_uri

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


File "/usr/local/lib/python2.7/dist-packages/", line 53, in GET

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


File "/usr/local/lib/python2.7/dist-packages/" 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


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>




All Articles