【问题标题】:Retrieving data from Neptune DB using SPARQL queries使用 SPARQL 查询从 Neptune DB 检索数据
【发布时间】:2021-09-02 15:36:43
【问题描述】:

我正在尝试使用 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"')

在此先感谢您。

【问题讨论】:

  • 如果您尝试访问 Neptune 上的状态 API 端点,您会收到响应吗? curl https://cluster-.us-east1.neptune.amazonaws.com:8182/status 如果这不起作用,则可能是网络配置错误(可能是需要允许访问的安全组)。
  • @TaylorRiggan,是的,没错。状态说连接失败。我正在检查安全组

标签: sparql rdf amazon-neptune


【解决方案1】:

您可能会遇到 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'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-10
    • 1970-01-01
    • 2013-05-12
    • 1970-01-01
    相关资源
    最近更新 更多