使用Freebase MQL的非唯一查询读取google api [英] Non unique query with Freebase MQL read google api

查看:136
本文介绍了使用Freebase MQL的非唯一查询读取google api的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来我只能用新的freebase MQL读取api完成独特的查询(即在查询中包含一个实体id):



以下搜索id和type:

  https://www.googleapis.com/freebase/v1/mqlread?query= {name :null,id:/ en / bob_dylan,type:/ people / person} 

并成功返回:

  {
结果:{
type: / people / person,
id:/ en / bob_dylan,
name:Bob Dylan
}
}

以下仅包含类型的搜索:

  https://www.googleapis.com/freebase/v1/mqlread?query= {name:null,type:/ people / person} 

  https:// www。 googleapis.com/freebase/v1/mqlread?query={\"name\":[],\"type\":\"/people/person} 

并返回以下错误:

  {
error:{
错误:[
{
domain:global,
reason:badRequest,
message:唯一查询最多只能有一个结果。得到100


code:400,
message:唯一查询最多只能有一个结果。得到100
}
}

我希望它返回一个列表人的姓名

解决方案

您必须在[]中包装您的查询,如以下示例所示:

  https://www.googleapis.com/freebase/v1/mqlread?query= [{name:[],type:/人/人}] 


It seems I am only able to do unique queries (i.e. including an entity id in the query) with the new freebase MQL read api:

The following searches on id and type:

https://www.googleapis.com/freebase/v1/mqlread?query={"name":null,"id":"/en/bob_dylan","type":"/people/person"}

and successfully returns:

{
"result": {
"type": "/people/person", 
"id": "/en/bob_dylan", 
"name": "Bob Dylan"
}
}

The following searches with type only:

https://www.googleapis.com/freebase/v1/mqlread?query={"name":null,"type":"/people/person"}

or

https://www.googleapis.com/freebase/v1/mqlread?query={"name":[],"type":"/people/person"}

and returns the following error:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "badRequest",
    "message": "Unique query may have at most one result. Got 100"
   }
  ],
  "code": 400,
  "message": "Unique query may have at most one result. Got 100"
 }
}

I expected it to return a list of people's names

解决方案

You have to wrap your query in [ ], as in the following example:

https://www.googleapis.com/freebase/v1/mqlread?query=[{"name":[],"type":"/people/person"}]

这篇关于使用Freebase MQL的非唯一查询读取google api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆