搜尋輸出結果

  1. 總覽
  2. 結構定義輸出
  3. 進階輸出

總覽

除了取得實體 mid、關聯分數和顯示資料,協助人類瞭解查詢的相符項目外,您也可以透過輸出參數要求系統在結果中傳回特定實體結構化資料。與篩選器參數類似,這個參數是 S 運算式,其中包含可能巢狀的元架構述詞清單,或要擷取資料的路徑。結果格式為兩層巢狀清單,第一層以要求的原始述詞或路徑為鍵,第二層則以傳回的實際路徑為鍵。

例如:
找出名為「銀翼殺手」的實體,並傳回其貢獻者:

filter=(all name{phrase}:"Blade Runner")
&output=(contributor)

結構定義輸出

輸出參數可以巢狀結構形式存在,用來要求資料,這些資料與上層傳回資料的實體相關。在巢狀輸出清單中,第一個元素會將清單連結至前一個層級 (或原始相符實體),其他元素則與該層級傳回的實體有關。

例如:
找出美國總統,並傳回他們的出生日期和配偶的出生日期:

filter=(all type:/government/us_president)
&output=(/people/person/date_of_birth (/people/marriage/spouse /people/person/date_of_birth))

如果透過 lang 參數要求多種顯示語言,系統會傳回所有有資料的語言字串,並遵守要求中的語言順序。如要要求系統傳回所有已建立索引的語言資料,可以使用特殊的 d/all 語言代碼。

例如:
Find US Presidents and return their spouses' categories and profession, in italian, russian, japanese and english:

filter=(all type:/government/us_president)
&output=((/people/marriage/spouse category /people/person/profession))
&lang=it,ru,ja,en

進階輸出

輸出參數支援所有已建立索引的元架構述詞或路徑對應,以及下列額外關鍵字。

description、description:provenance

傳回 /common/topic/description 三元組中找到的文字,可能依據 provenance.process 欄位中找到的出處關鍵字進行篩選。

例如:
尋找美國總統,並依據來源傳回知識圖譜中的說明

filter=(all type:/government/us_president)
&output=(description)

在知識圖譜中找出美國總統,並以英文和日文傳回維基百科說明

filter=(all type:/government/us_president)
&output=(description:wikipedia)
&lang=d/en,d/ja

disambiguator、disambiguator:type、disambiguator:domain

傳回路徑中具有消歧屬性 (以 /freebase/property_hints/disambiguator 註解) 的值或實體,可能由類型或包含這些屬性的網域篩選。

例如:
尋找「銀翼殺手」,並從相符項目傳回消歧義資料

filter=(all name:"Blade Runner")
&output=(disambiguator)

尋找「銀翼殺手」,並從 /film/film 中的相符項目傳回消歧資料

filter=(all name:"Blade Runner")
&output=(disambiguator:/film/film)

geocode

傳回位置實體的地理編碼資料。

例如:
找出舊金山渡輪大廈 1000 英尺範圍內的餐廳,並傳回其地理編碼和菜色類型

filter=(all type:restaurant (within radius:1000ft lon:-122.39 lat:37.7955))
&output=(geocode practitioner_of)

key、key:namespace

傳回實體的鍵/ 或 ID,可依命名空間篩選。

例如:
找出舊金山渡輪大廈 1000 英尺範圍內的餐廳,並傳回 Google+ ID

filter=(all type:restaurant (within radius:1000ft lon:-122.39 lat:37.7955))
&output=(key:/authority/google/google_plus)

類型

如果資料可用,系統會傳回實體類型,並依顯著性排序。

例如:
找出「銀翼殺手」,並從相符項目傳回類型資料

filter=(all name:"Blade Runner")
&output=(type)

不相容、不相容:類型

單獨使用時,會傳回已知互不相容的實體類型。
與型別搭配使用時,會傳回這個型別是否已知與這個實體的任何型別不相容。
與篩選器參數中的型別搭配使用時,會傳回型別不相容的實體。

例如:
找出與 /people/person 不相容的類型例項,並傳回這些例項

filter=(all type:/people/person incompatible:/people/person)
&output=(incompatible)

all、all:type、all:domain

傳回實體的所有索引資料,可透過輸出參數傳回,並可能依類型或網域篩選。

例如:
尋找「san francisco」,並傳回可透過輸出參數存取的所有相關資料

filter=(all name{full}:"San Francisco" type:/location/citytown)
&output=(all)
&limit=1

例如:
尋找「san francisco」,並傳回可透過輸出參數存取的位置資訊網域中所有相關資料

filter=(all name{full}:"San Francisco" type:/location/citytown)
&output=(all:/location)
&limit=1