2014-03-12 32 views
1

查看freebase的MID「/ m/02r4n63」。問題是如何獲得與此MID相關的所有屬性。
Freebase page這個MID。
我需要從此頁面提取導演,製片人,主演等所有屬性。通過MQL查詢獲取Freebase中特定MID的所有屬性

endpoint

{ 
    "*": null, 
    "type": "/film/film", 
    "id": "/m/02r4n63" 
} 

上述查詢的輸出嘗試這些疑問給出了相關的只有/film/film性質,並給出starring listnull

我嘗試這樣一個

[{ 
    "master_property": { 
     "name": null, 
     "id": null 
    }, 
    "source": { 
     "mid": "/m/02r4n63" 
    }, 
    "target": null, 
    "target_value": null, 
    "type": "/type/link" 
}] 

輸出上述查詢的遺漏了/film/starring屬性。

我也試過

{ 
    "id": "/m/01jrbb", 
    "/type/reflect/any_master": [{ 
     "id": null, 
     "link": { 
      "master_property": { 
       "id": null, 
       "name": null 
      }, 
      "target": null, 
      "target_value": null 
     } 
    }], 
    "/type/reflect/any_value": [{ 
     "link": { 
      "master_property": { 
       "id": null, 
       "name": null 
      }, 
      "target": null, 
      "target_value": null 
     } 
    }], 
    "/type/reflect/any_reverse": [{ 
     "id": null, 
     "link": { 
      "master_property": { 
       "reverse_property": { 
        "id": null, 
        "key": null, 
        "name": null 
       } 
      } 
     } 
    }] 
} 

但同樣也錯過了屬性,如Description

我想涵蓋所有的屬性。 我已經試過topic search API。這是我想要的輸出。但我希望通過MQL查詢,因爲我也需要屬性的名稱。

幫助受到高度讚賞。

回答

0

的主題API是獲得有關給定主題的所有信息的最佳方式:

https://www.googleapis.com/freebase/v1/topic/m/02r4n63

可以使用獲得的屬性的名稱MQL如:

{ 
    "name": null, 
    "id": "/film/film/starring" 
} 

這將返回「表演」。當然,這些大多數都是你以前見過的屬性,所以你可能想要緩存它們或者只是預先填充一個靜態列表。

如果您想要「主演」,您可以將返回的關鍵字分開並使用最後一個斜槓(/)分隔的段。

+0

marris:謝謝你的回答。按鍵返回爲「/ film/film/starring」。我想要的是這些屬性的名稱,例如「starring」作爲鍵的名稱而不是「/ film/film/starring」 – Gunjan

+0

我試過這個「昂貴的查詢就像'」*「:[{[{}]}]」It將無法正常工作 – Gunjan

+1

Topic API確實是這樣做的正確方法。如果您需要屬性的標籤/名稱,則可以單獨預取或取出並緩存它們。 –

相關問題