2011-12-07 23 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