I am trying to query the db already present on the stardog server using python.Below is the code: -
import urllib.request as req
headers = {
'Accept': 'text/turtle, application/rdf+xml, '
'application/n-triples, application/trig,'
' application/n-quads, text/n3, application/trix, '
'application/ld+json, application/sparql-results+xml,'
' application/sparql-results+json, application/x-binary-rdf-results-table, '
'text/boolean, text/csv, text/tsv, '
'text/tab-separated-values'
}
request = req.Request('http://localhost:5820/mytest111/query?query=select%20*%20where%20{%3Fs%20%3Fp%20%3Fo}%20LIMIT%2010',headers=headers)
print(request)
response_body = req.urlopen(request).read()
print(response_body)
The stardog is already running in the background.I get an error "[WinError 10061] No connection could be made because the target machine actively refused it>". The entire error log is below:-
Traceback (most recent call last):
File "C:\Users\kartik\Anaconda3\lib\urllib\request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "C:\Users\kartik\Anaconda3\lib\http\client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\kartik\Anaconda3\lib\http\client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\kartik\Anaconda3\lib\http\client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\kartik\Anaconda3\lib\http\client.py", line 1026, in _send_output
self.send(msg)
File "C:\Users\kartik\Anaconda3\lib\http\client.py", line 964, in send
self.connect()
File "C:\Users\kartik\Anaconda3\lib\http\client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Users\kartik\Anaconda3\lib\socket.py", line 724, in create_connection
raise err
File "C:\Users\kartik\Anaconda3\lib\socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/kartik/PycharmProjects/TDBCreate/Stardog.py", line 39, in
response_body = req.urlopen(request).read()
File "C:\Users\kartik\Anaconda3\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\kartik\Anaconda3\lib\urllib\request.py", line 526, in open
response = self._open(req, data)
File "C:\Users\kartik\Anaconda3\lib\urllib\request.py", line 544, in _open
'_open', req)
File "C:\Users\kartik\Anaconda3\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Users\kartik\Anaconda3\lib\urllib\request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "C:\Users\kartik\Anaconda3\lib\urllib\request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>
Process finished with exit code 1