0

I am trying to retrieve the data from Neptune DB by using SPARQL queries. I connected to the EC2 instance which has same VPC as Neptune from local Jupyter Notebook. But the query is not retrieving any data and stdout is empty, I'm not sure where I am going wrong. Any help would be greatly appreciated. Please find the query below.

stdin, stdout, stderr = ssh.exec_command(
' curl https://.cluster-.us-east1.neptune.amazonaws.com:8182/sparql \-d "query=PREFIX mol: <http://www.semanticweb.org/25#>\
   SELECT * WHERE {?s ?p ?o } LIMIT 1" \ -H "Accept: text/csv"')

Thank you in Advance.

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
Meghana Kb
  • 43
  • 5
  • Do you get a response back if you attempt to access the status API endpoint on Neptune? `curl https://cluster-.us-east1.neptune.amazonaws.com:8182/status` If that doesn't work, it is likely a network misconfiguration (perhaps a security group that needs to allow access). – Taylor Riggan Jun 17 '21 at 20:21
  • @TaylorRiggan, yes thats correct. the status says failed to connect. I'm checking on the security group – Meghana Kb Jun 18 '21 at 20:03

1 Answers1

1

You maybe running into issues with cURL. cURL has issues with multiple line inputs (such as a SPARQL query). Best to use the following format:

curl 'https://cluster.cluster.us-east-2.neptune.amazonaws.com:8182/sparql' \
    -H "Accept: text/csv" \
    --data-urlencode query='
    PREFIX mol: <http://www.semanticweb.org/25#> 
    SELECT * WHERE { ?s ?p ?o } LIMIT 1'
Taylor Riggan
  • 1,963
  • 6
  • 12