「取得 Authority 資料」:修訂間差異

出自DILA Wiki
imported>Winxd
imported>Winxd
行 89: 行 89:


=== 執行範例 ===
=== 執行範例 ===
http://authority.ddbc.edu.tw/getAuthorityDataMM.php?type=place&id=CN610112Z05AA&jsoncallback=abc123
1.from-to:
<table width="477" border="1">
http://authority.ddbc.edu.tw/getAuthorityDataMM.php?from=5314240&to=5314476&jsoncallback=abc123&type=time
  <tr>
2.when:
   <td width="56" align="center">人名</td>
http://authority.ddbc.edu.tw/getAuthorityDataMM.php?when=5314240&jsoncallback=abc123&type=time
   <td width="405"></td>
  </tr>
  <tr>
   <td align="center">地名</td>
   <td></td>
  </tr>
  <tr>
   <td align="center">時間</td>
   <td>只接受d開頭的標記,如d331241335258</td>
  </tr>
</table>
<br>


<br><br>
=== 執行結果 ===
id和jsoncallback這兩個參數都必須給定,且id的格式須符合上面的說明。
 
1.from-to:
<syntaxhighlight lang="XML">
abc123({
   "F": {
     "result": "3",
     "data1": {
       "dateCode": "5314240",
       "adYear": "+0223-06-16",
       "Dynasty": "孫吳",
       "Emperor": "大帝",
       "reignYear": "黃武",
       "Year": "2",
       "yearGanzhi": "癸卯",
       "Month": " 五",
       "Day": "1",
       "monthGanzhi": "戊子"
     },
     "data2": {
       "dateCode": "5314240",
       "adYear": "+0223-06-16",
       "Dynasty": "曹魏",
       "Emperor": "文帝",
       "reignYear": "黃初",
       "Year": "4",
       "yearGanzhi": "癸卯",
       "Month": " 五",
       "Day": "1",
       "monthGanzhi": "戊子"
     },
     "data3": {
       "dateCode": "5314240",
       "adYear": "+0223-06-16",
       "Dynasty": "蜀漢",
       "Emperor": "後主",
       "reignYear": "建興",
       "Year": "1",
       "yearGanzhi": "癸卯",
       "Month": " 五",
       "Day": "1",
       "monthGanzhi": "戊子"
     }
   },
   "T": {
     "result": "3",
     "data1": {
       "dateCode": "5314476",
       "adYear": "+0224-02-07",
       "Dynasty": "孫吳",
       "Emperor": "大帝",
       "reignYear": "黃武",
       "Year": "3",
       "yearGanzhi": "甲辰",
       "Month": " 正",
       "Day": "1",
       "monthGanzhi": "甲申"
     },
     "data2": {
       "dateCode": "5314476",
       "adYear": "+0224-02-07",
       "Dynasty": "曹魏",
       "Emperor": "文帝",
       "reignYear": "黃初",
       "Year": "4",
       "yearGanzhi": "癸卯",
       "Month": "十二",
       "Day": "30",
       "monthGanzhi": "甲申"
     },
     "data3": {
       "dateCode": "5314476",
       "adYear": "+0224-02-07",
       "Dynasty": "蜀漢",
       "Emperor": "後主",
       "reignYear": "建興",
       "Year": "1",
       "yearGanzhi": "癸卯",
       "Month": "十二",
       "Day": "30",
       "monthGanzhi": "甲申"
     }
   }
})
</syntaxhighlight>
 
2.when:
<syntaxhighlight lang="XML">
abc123({
   "W": {
     "result": "3",
     "data1": {
       "dateCode": "5314240",
       "adYear": "+0223-06-16",
       "Dynasty": "孫吳",
       "Emperor": "大帝",
       "reignYear": "黃武",
       "Year": "2",
       "yearGanzhi": "癸卯",
       "Month": " 五",
       "Day": "1",
       "monthGanzhi": "戊子"
     },
     "data2": {
       "dateCode": "5314240",
       "adYear": "+0223-06-16",
       "Dynasty": "曹魏",
       "Emperor": "文帝",
       "reignYear": "黃初",
       "Year": "4",
       "yearGanzhi": "癸卯",
       "Month": " 五",
       "Day": "1",
       "monthGanzhi": "戊子"
     },
     "data3": {
       "dateCode": "5314240",
       "adYear": "+0223-06-16",
       "Dynasty": "蜀漢",
       "Emperor": "後主",
       "reignYear": "建興",
       "Year": "1",
       "yearGanzhi": "癸卯",
       "Month": " 五",
       "Day": "1",
       "monthGanzhi": "戊子"
     }
   }
})
</syntaxhighlight>


=== 使用範例 ===
=== 使用範例 ===

於 2008年12月12日 (五) 11:18 的修訂

前言

由於各個專案可能有取得Authority資料的需求,因此這邊提供取得Authority的人名、地名、時間之方法,已方便各專案使用。

程式位置

http://elib.ddbc.edu.tw/authority/getAuthorityData.php

取得人名資料

需要餵給程式的參數

1.type:必須指定成「person」。
2.id:就是你想要取得人名資料的唯一碼,可接受7碼的Pno(ex-A000004)和5碼的人名PrjNo(ex-B0006)。
3.jsoncallback:隨機產生的參數。

執行範例

http://authority.ddbc.edu.tw/getAuthorityData.php?type=person&id=A000294&jsoncallback=abc123

執行結果

abc123({
    "data1": {
        "Name": "玄奘",
        "Pno": "A000294",
        "Project_No": "B0325",
        "Dynasty": "唐 ",
        "Class": "譯經",
        "Names": " 唐三藏;大遍覺;大乘天"
    }
})

欄位說明

1.Project_No:專案碼,即此筆人名資料的專案編號。
2.Class:分類。
3.Note:註解。
4.Year:生卒年。
5.Dynasty:朝代。
6.Names:別名。


取得地名資料

需要餵給程式的參數

1.type:必須指定成「place」。
2.id:地名資料的唯一碼,可接受13碼以上的地名編碼(ex-CN232723Z01AA)或地名的PrjNo(ex-Z0106105)。
3.jsoncallback:隨機產生的參數。

執行範例

http://authority.ddbc.edu.tw/getAuthorityDataMM.php?type=place&id=CN610112Z05AA&jsoncallback=abc123

執行結果

abc123({
    "data1": {
        "Name": "長安",
        "Dynasty": "西漢",
        "Code": "CN610112Z05AA",
        "XY": "34.3194, 108.8835",
        "County": "西漢_司隸部",
        "Pname": " 陝西省- 西安市-   未央區"
    }
})

欄位說明

1.Code:地名編碼,地名的唯一碼。
2.Pname:行政區。
3.XY:座標。
4.Dynasty:朝代。
5.County:County。
6.Note:註解。
7.Names:別名。

取得時間資料

需要餵給程式的參數

  • type:必須指定成「time」。
  • from-to、when:時間的參數值為7碼的datecode(如:5314476)。
    • 由於標記可能是一個時期或一個時間,因此這邊分成兩種形式,如果標記是「時期」,需要給的參數就是fromto
    • 如果標記是一個「時間」,參數就給when
  • jsoncallback:隨機產生的參數。

執行範例

1.from-to: http://authority.ddbc.edu.tw/getAuthorityDataMM.php?from=5314240&to=5314476&jsoncallback=abc123&type=time 2.when: http://authority.ddbc.edu.tw/getAuthorityDataMM.php?when=5314240&jsoncallback=abc123&type=time

執行結果

1.from-to:

abc123({
    "F": {
        "result": "3",
        "data1": {
            "dateCode": "5314240",
            "adYear": "+0223-06-16",
            "Dynasty": "孫吳",
            "Emperor": "大帝",
            "reignYear": "黃武",
            "Year": "2",
            "yearGanzhi": "癸卯",
            "Month": " 五",
            "Day": "1",
            "monthGanzhi": "戊子"
        },
        "data2": {
            "dateCode": "5314240",
            "adYear": "+0223-06-16",
            "Dynasty": "曹魏",
            "Emperor": "文帝",
            "reignYear": "黃初",
            "Year": "4",
            "yearGanzhi": "癸卯",
            "Month": " 五",
            "Day": "1",
            "monthGanzhi": "戊子"
        },
        "data3": {
            "dateCode": "5314240",
            "adYear": "+0223-06-16",
            "Dynasty": "蜀漢",
            "Emperor": "後主",
            "reignYear": "建興",
            "Year": "1",
            "yearGanzhi": "癸卯",
            "Month": " 五",
            "Day": "1",
            "monthGanzhi": "戊子"
        }
    },
    "T": {
        "result": "3",
        "data1": {
            "dateCode": "5314476",
            "adYear": "+0224-02-07",
            "Dynasty": "孫吳",
            "Emperor": "大帝",
            "reignYear": "黃武",
            "Year": "3",
            "yearGanzhi": "甲辰",
            "Month": " 正",
            "Day": "1",
            "monthGanzhi": "甲申"
        },
        "data2": {
            "dateCode": "5314476",
            "adYear": "+0224-02-07",
            "Dynasty": "曹魏",
            "Emperor": "文帝",
            "reignYear": "黃初",
            "Year": "4",
            "yearGanzhi": "癸卯",
            "Month": "十二",
            "Day": "30",
            "monthGanzhi": "甲申"
        },
        "data3": {
            "dateCode": "5314476",
            "adYear": "+0224-02-07",
            "Dynasty": "蜀漢",
            "Emperor": "後主",
            "reignYear": "建興",
            "Year": "1",
            "yearGanzhi": "癸卯",
            "Month": "十二",
            "Day": "30",
            "monthGanzhi": "甲申"
        }
    }
})

2.when:

abc123({
    "W": {
        "result": "3",
        "data1": {
            "dateCode": "5314240",
            "adYear": "+0223-06-16",
            "Dynasty": "孫吳",
            "Emperor": "大帝",
            "reignYear": "黃武",
            "Year": "2",
            "yearGanzhi": "癸卯",
            "Month": " 五",
            "Day": "1",
            "monthGanzhi": "戊子"
        },
        "data2": {
            "dateCode": "5314240",
            "adYear": "+0223-06-16",
            "Dynasty": "曹魏",
            "Emperor": "文帝",
            "reignYear": "黃初",
            "Year": "4",
            "yearGanzhi": "癸卯",
            "Month": " 五",
            "Day": "1",
            "monthGanzhi": "戊子"
        },
        "data3": {
            "dateCode": "5314240",
            "adYear": "+0223-06-16",
            "Dynasty": "蜀漢",
            "Emperor": "後主",
            "reignYear": "建興",
            "Year": "1",
            "yearGanzhi": "癸卯",
            "Month": " 五",
            "Day": "1",
            "monthGanzhi": "戊子"
        }
    }
})

使用範例

http://authority.ddbc.edu.tw/getAuthorityData.php?id=T13005441&jsoncallback=jsoncallback12345

回傳資料

程式的回傳資料為json格式,開發人員可讀取此json結果來顯示Authority的內容。



時間欄位說明

  • 時間回傳值會有包含排版資訊(因為有並行年代的問題),因此開發人員使用dateFrom和dateTo時直接print這兩個變數即可,無須再進行排版。

1.dateFrom:起始日期。
2.dateTo:結束日期。