如何将 Freebase 结果限制为那些有图像的人
How to limit Freebase results to those who have images
我知道 Freebase 即将淘汰,但在 Google 知识图谱发布之前,我需要一种方法来搜索 Freebase,但只有 return 个包含图像的结果。
我知道我可以在结果集中检查 'property' 节点中的“/common/topic/image”,但是为了正确分页,我需要通过 API 调用来实现,而不是之后通过服务器端代码。
有办法实现吗?
图片响应示例:
[result] => Array
(
[0] => Array
(
[mid] => /m/0f2jr1
[id] => /en/daughtry
[name] => Daughtry
[notable] => Array
(
[name] => Post-grunge Artist
[id] => /m/05jg58
)
[lang] => en
[score] => 44.129833
[output] => Array
(
[property] => Array
(
[/common/topic/image] => Array
(
[0] => Array
(
[mid] => /m/03t3mnz
[name] => Daughtry Live in NYC 12-5-07
)
)
)
)
)
)
没有图像,'property' 数组就是空的。
谢谢
您发布的查询根本不起作用(由于拼写错误),但您需要做的是将 filter
参数与 has
运算符一起使用。操作员未在文档中列出的事实使其比正常情况下更难弄清楚。 :-)
https://www.googleapis.com/freebase/v1/search/?query=daughtry&filter=(all has:/common/topic/image)
这里有一个开发人员的小应用程序,您可以使用它来试验 API:
http://freebase-search.freebaseapps.com/?query=daughtry&filter=(all has:/common/topic/image)&output=(property)
另请注意,默认情况下会包含 notable
,因此您无需提出要求,而且人们没有 created_by
属性,因此您甚至可能希望限定搜索条件进一步。
例如,如果您只想要带有图片的相册,您可以使用如下内容:
http://freebase-search.freebaseapps.com/?query=daughtry&filter=(all type:/music/album has:/common/topic image)&output=(created_by property)
我知道 Freebase 即将淘汰,但在 Google 知识图谱发布之前,我需要一种方法来搜索 Freebase,但只有 return 个包含图像的结果。
我知道我可以在结果集中检查 'property' 节点中的“/common/topic/image”,但是为了正确分页,我需要通过 API 调用来实现,而不是之后通过服务器端代码。
有办法实现吗?
图片响应示例:
[result] => Array
(
[0] => Array
(
[mid] => /m/0f2jr1
[id] => /en/daughtry
[name] => Daughtry
[notable] => Array
(
[name] => Post-grunge Artist
[id] => /m/05jg58
)
[lang] => en
[score] => 44.129833
[output] => Array
(
[property] => Array
(
[/common/topic/image] => Array
(
[0] => Array
(
[mid] => /m/03t3mnz
[name] => Daughtry Live in NYC 12-5-07
)
)
)
)
)
)
没有图像,'property' 数组就是空的。
谢谢
您发布的查询根本不起作用(由于拼写错误),但您需要做的是将 filter
参数与 has
运算符一起使用。操作员未在文档中列出的事实使其比正常情况下更难弄清楚。 :-)
https://www.googleapis.com/freebase/v1/search/?query=daughtry&filter=(all has:/common/topic/image)
这里有一个开发人员的小应用程序,您可以使用它来试验 API:
http://freebase-search.freebaseapps.com/?query=daughtry&filter=(all has:/common/topic/image)&output=(property)
另请注意,默认情况下会包含 notable
,因此您无需提出要求,而且人们没有 created_by
属性,因此您甚至可能希望限定搜索条件进一步。
例如,如果您只想要带有图片的相册,您可以使用如下内容:
http://freebase-search.freebaseapps.com/?query=daughtry&filter=(all type:/music/album has:/common/topic image)&output=(created_by property)