简体   繁体   中英

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.

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM