且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获取给定Wikidata ID的语句列表?

更新时间:2023-01-10 08:38:25

所需信息在查询中,但难以解码.例如,这:

The information you want is in your query, except it's hard to decode. For example, this:

"P246": [
          {
            "id": "q568$E47B8CE7-C91D-484A-9DA4-6153F132997D",
            "mainsnak": {
              "snaktype": "value",
              "property": "P246",
              "datatype": "string",
              "datavalue": {
                "value": "Li",
                "type": "string"
              }
            },
            "type": "statement",
            "rank": "normal",
            "references": …
          }
        ]

表示元素符号"(属性P246 )为李".因此,您需要从查询中读取所有属性,然后为找到的每个属性找出名称.

means that the "element symbol" (property P246) is "Li". So, you will need to read all the properties from your query and then find out the name for each of the properties you found.

仅获取语句,也可以使用action=wbgetclaims,但格式与上面相同.

To get just the statements, you could also use action=wbgetclaims, but it's in the same format as above.