2011-12-07 50 views
1

我正在玩Freebase,并取得了一些体面的成功,但却遇到了困难。我的MQL如下。我没有任何问题显示名称,拉丁名称等,这是我在我的基地创建的。我不知道如何显示不同基础的文章。使用jQuery显示Freebase中常见主题的数据

这里是jQuery的我使用的显示数据:

$('<div>',{text:this.name}).appendTo(document.body); 

非常感谢你, 托德

query : [ 
    { 
    "/common/topic/article": { 
     "guid": null, 
     "limit": 1, 
     "optional": true 
    }, 
    "/common/topic/image": { 
     "id": null, 
     "limit": 1, 
     "optional": true 
    }, 
    "id": null, 
    "larval_food": [ 
     { 
     "index": null, 
     "lang": "/lang/en", 
     "limit": 6, 
     "optional": true, 
     "sort": "index", 
     "type": "/type/text", 
     "value": null 
     } 
    ], 
    "latin_name": [ 
     { 
     "index": null, 
     "lang": "/lang/en", 
     "limit": 6, 
     "optional": true, 
     "sort": "index", 
     "type": "/type/text", 
     "value": null 
     } 
    ], 
    "limit": 60, 
    "name": null, 
    "s0:type": [ 
     { 
     "id": "/base/butterflies/butterfly", 
     "link": [ 
      { 
      "timestamp": [ 
       { 
       "optional": true, 
       "type": "/type/datetime", 
       "value": null 
       } 
      ], 
      "type": "/type/link" 
      } 
     ], 
     "type": "/type/type" 
     } 
    ], 
    "sort": "-s0:type.link.timestamp.value", 
    "type": "/base/butterflies/butterfly" 
    } 
] 
+0

如果答案无法解答你问的问题,你可以用你想要做什么的额外信息澄清问题? –

回答

1

变化

"type": "/base/butterflies/butterfly" 

到的事物的类型你实际上想包括。

另外,这看起来像是从Freebase.com视图页面之一导出的查询。它可以大大简化,一些东西,如排序,你可能想要完全删除。

,这里是你查询到简体(我也推荐使用标准的科学名称属性,而不是你自己发明“拉丁文名”属性):

[{ 
    "type": "/base/butterflies/butterfly", 
    "mid": null, 
    "name": null, 
    "/common/topic/article": [], 
    "/common/topic/image": ["mid":null,"optional":true], 
    "larval_food": [], 
    "latin_name": [], 
    "/biology/organism_classification/scientific_name" : [], 
    }] 

这里的查询的版本,它显示了所有生物类别(品种在这种情况下)有部落Danaini两个层次。它可以选择与您的基本数据(larval_food)装饰它,如果它存在:

[{ 
    "type": "/biology/organism_classification", 
    "higher_classification": [{ 
    "/biology/organism_classification/higher_classification": "Danaini" 
    }], 
    "mid": null, 
    "name": null, 
    "scientific_name": [], 
    "/common/topic/article": [], 
    "/common/topic/image": [{ 
    "mid":  null, 
    "optional": true 
    }], 
    "/base/butterflies/butterfly/larval_food": [], 
}] 

你可以在这里尝试一下:http://tinyurl.com/6wht7lx