【问题标题】:Freebase "Key cursor is a reserved word"Freebase“键光标是保留字”
【发布时间】:2011-11-05 02:27:49
【问题描述】:

跟随 Freebase docs on Envelope Parameters,运行

{
  "cursor":true,
  "query":[{
    "type":"/music/album",
    "artist":"The Police",
    "name":null,
    "limit":10
  }]
}​

results in error"Key cursor is a reserved word"@Domenic notes

怎么了?


编辑 1

所以this query without a cursor worksthis one doesn't 因为cursor was a variable name not a string enclosed in quotes

作为用户,输入损坏版本的"cursor" 是有意义的,因为the read parameter type table 同时具有query"cursor" 作为type: string,如果将query 括在引号中作为@ 则会出错987654335@

但是,即使将 "cursor" 括在引号中仍然不起作用:它会为每个查询生成相同的数据。

【问题讨论】:

  • 您提供的链接指向查询编辑器中此查询的工作版本。您是在查询编辑器中还是通过直接调用 APIO 得到了这个错误?
  • 两者都具有完全相同的查询,在发布时都没有工作。很高兴知道文档是正确的,并且它现在正在工作。如果再次发生,我会截屏。
  • Re: 编辑 1 - 第一个请求应该只是 mqlread?cursor=&query=[{...}]。这将在结果中返回一个查询值,然后您的下一个请求将类似于 mqlread?cursor=eNo10UlqAzEQBdALCVxz1e...&query=[{...}]

标签: paging freebase mql


【解决方案1】:

看起来这可能是查询编辑器太聪明并为我们修复问题的另一种情况。如果您将上面的查询复制并粘贴到查询编辑器中并按运行,您将收到您报告的此错误:

{
  "code":          "/api/status/error",
      "messages": [{
    "code":    "/api/status/error/mql/type",
    "info": {
      "expected_type": "/type/object",
      "property":      "cursor"
    },
    "message": "Key cursor is a reserved word",
    "path":    "",
    "query": {
      "cursor":       true,
      "error_inside": ".",
      "query": [{
        "artist": "The Police",
        "limit":  10,
        "name":   null,
        "type":   "/music/album"
      }]
    }
  }],
  "status":        "200 OK",
  "transaction_id": "cache;cache03.p01.sjc1:8101;2011-11-04T17:42:13Z;0057"
}

但是,如果您单击该查询的永久链接,它会将其更改为该查询并自动将 cursor 属性设置为 true。

[{
  "type":   "/music/album",
  "artist": "The Police",
  "name":   null,
  "limit":  10
}]​

发生这种情况是因为 MQL 读取服务希望查询嵌套在 query envelope 中,但查询编辑器只接受您提供的查询并自动将其包装在适合您的查询信封中。

在新版本的MQL read service 中,我们取消了查询信封​​,现在 cursor 只是 HTTP GET 请求上的一个参数。

【讨论】:

  • 查询编辑器:完全正确。显然我的扫描阅读能力需要提高。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-01-24
  • 2014-07-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-13
  • 1970-01-01
相关资源
最近更新 更多