sparql - 使用 SPARQL 查询从 Neptune DB 检索数据
问题描述
我正在尝试使用 SPARQL 查询从 Neptune DB 中检索数据。我从本地 Jupyter Notebook 连接到与 Neptune 具有相同 VPC 的 EC2 实例。但是查询没有检索任何数据并且标准输出为空,我不确定我哪里出错了。任何帮助将不胜感激。请在下面找到查询。
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"')
先感谢您。
解决方案
您可能会遇到 cURL 的问题。cURL 存在多行输入问题(例如 SPARQL 查询)。最好使用以下格式:
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'
推荐阅读
- python - 使用 word2vec 作为 tensorflow 输入的 LSTM 可变句子长度
- sql - 如何在 SQL 中连接 5 个表并仅显示 2 行数据
- java - java是否支持“软”接口?
- angular - Angular 4 代理配置文件没有重定向到提到的目标,而是重定向到 localhost:4200
- android - VideoView 内存泄漏?
- jenkins - Jenkins SCM 轮询未轮询正确的分支
- node.js - 使用 nodejs 将聊天机器人从自定义网站切换到 Zendesk 消息
- node.js - 如何覆盖默认环回模型 API 路径
- apache-kafka - Spring KafkaEmbedded - 消费消息的问题
- vba - 您可以中断 vba 代码以进行工作表选择吗?