简体   繁体   English

使用 SPARQL 查询从 Neptune DB 检索数据

[英]Retrieving data from Neptune DB using SPARQL queries

I am trying to retrieve the data from Neptune DB by using SPARQL queries.我正在尝试使用 SPARQL 查询从 Neptune DB 检索数据。 I connected to the EC2 instance which has same VPC as Neptune from local Jupyter Notebook.我从本地 Jupyter Notebook 连接到与 Neptune 具有相同 VPC 的 EC2 实例。 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 的问题。 cURL has issues with multiple line inputs (such as a SPARQL query). cURL 存在多行输入问题(例如 SPARQL 查询)。 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'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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