Google Knowledge Graph API使用情况

问题描述 投票:2回答:1

我想澄清一下如何使用Google知识图API来获取有关实体的更多具体信息,例如人的身高或生日。

例如,该文档提供了以下对Taylor Swift的搜索:

https://kgsearch.googleapis.com/v1/entities:search?query=taylor+swift&key=API_KEY&limit=1&indent=True

此请求返回一些基本信息,例如描述,名称,类型和ID。但是,文档遗憾地没有解释如何查询该人的特定属性(即使Person schema肯定包含该信息)。

我已经尝试将“查询”值更改为“taylor + swift + birthday”,但这会返回完全不相关的内容。我也尝试通过返回的“id”(上面的例子中的/ m / 0dl567)进行搜索,但这并没有提供任何额外的信息。

关于如何以这种方式使用API​​的一些指导将非常感谢!但是,如果不可能做到这一点,最好的替代方案是什么?

谢谢!

google-api freebase google-search-api google-knowledge-graph
1个回答
1
投票

根据Knowledge Graph Search API reference,高度或DOB等信息不包括在回复中。

目前最可靠的此类信息来源是维基数据。使用Wikidata Query Service,您可以使用给定的Freebase ID或Google Knowledge Graph ID查询实体所需的数据:

SELECT ?item ?itemLabel ?birthdate
WHERE 
{
  ?item wdt:P646 "/m/0dl567".
  ?item wdt:P569 ?birthdate .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
© www.soinside.com 2019 - 2024. All rights reserved.