Meghana Kb
Meghana Kb

Reputation: 63

Retrieving data from Neptune DB using SPARQL queries

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.

Upvotes: 0

Views: 541

Answers (1)

Taylor Riggan
Taylor Riggan

Reputation: 2769

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'

Upvotes: 1

Related Questions