2012-10-22 166 views
1

freebase用户!freebase死亡年份

我想要得到这个结果:

  • 谁在2011年死于谁在2011年

死亡的美国人

  • 列表我使用Python代码简单的所有的人的名单查询:

    import freebase 
    r = freebase.mqlreaditer({"/people/deceased_person/date_of_death":'2011', "name":None}) 
    for i in r: 
        print i 
    

    但输出给我20个名字。将结果与本文相比(http://en.wikipedia.org/wiki/Category:2011_deaths) - 5,612个名字,明显存在一些错误。

    任何想法如何得到正确的结果?

  • 回答

    1

    ,你写的查询:

    { 
        "name": null, 
        "/people/deceased_person/date_of_death": "2011" 
    }​ 
    

    这只能找到人谁的死亡日期被记录在游离碱为“2011”。你究竟想要查询是谁的人或以后2011年1月1日但在此之前死于1月1日,2012年该查询看起来是这样的:

    { 
        "id": null, 
        "name": null, 
        "type": "/people/deceased_person", 
        "date_of_death": null, 
        "date_of_death>=": "2011", 
        "date_of_death<": "2012" 
    }​ 
    

    您可以进一步细化查询仅搜索美国人喜欢这样的:

    { 
        "id": null, 
        "name": null, 
        "type": "/people/deceased_person", 
        "date_of_death": null, 
        "date_of_death>=": "2011", 
        "date_of_death<": "2012", 
        "/people/person/nationality": { 
        "id": "/en/united_states" 
        } 
    }​ 
    

    注意,因为国籍/人/人,而不是/人/ deceased_person(声明的类型)的一部分,我需要使用完整的属性ID,而date_of_death可以使用缩短的ID。