DDBC logo

Web Data-Provider Services

Query for Date entity

The query string for Date Authority data may contain only one Date Authority ID, or may consist of a pair of values.

URI format:

  1. Query for a single date (also called a when query) http://authority.dila.edu.tw/webwidget/getAuthorityData.php?type=time&when=<datecode>&format=<format>&jsoncallback=<string>
  2. Query for a time period (also called a from-to query) http://authority.dila.edu.tw/webwidget/getAuthorityData.php?type=time&from=<datecode>&to=<datecode>&format=<format>&jsoncallback=<string>

Specification:

Argument Value(s) Description
type "time" Specifies the query type
format "s"
"d"
"j"
Specifies the format in which id value of the when/from/to argument is given.
  • "s" means <datecode> values are ISO-8601 Dates (e.g. +0200-10-01)
  • "d" means <datecode> values are specified in DDBC Authority ID format
  • "j" indicates <datecode> values are given as Julian Day Numbers
when/from/to <datecode> Specifies the Date or Time Period to be returned.
jsoncallback <string> Required by third-party JavaScript libraries (e.g. EXT Js) to perform ajax functions. The value of jsoncallback has no effect on query processing, but will be attached to the beginning of the returned json string.

Examples:

  1. When Query:

    http://authority.dila.edu.tw/webwidget/getAuthorityData.php?type=time&when=5314240&format=d&jsoncallback=abc123

    Json return:

    					abc123({
        "W": {
            "rows": "3",
            "data1": {
                "authorityID": "5314240",
                "JD": "1802675",
                "ceDate": "+0223-06-16",
                "dynasty": "孫吳",
                "emperor": "大帝",
                "reignYear": "黃武",
                "yearNumber": "2",
                "yearGanzhi": "癸卯",
                "month": " 五",
                "dayNumber": "1",
                "dayGanzhi": "戊子"
            },
            "data2": {
                "dateCode": "5314240",
                "JD": "1802675",
                "ceDate": "+0223-06-16",
                "dynasty": "曹魏",
                "emperor": "文帝",
                "reignYear": "黃初",
                "yearNumber": "4",
                "yearGanzhi": "癸卯",
                "month": " 五",
                "dayNumber": "1",
                "dayGanzhi": "戊子"
            },
            "data3": {
                "dateCode": "5314240",
                "JD": "1802675",
                "ceDate": "+0223-06-16",
                "dynasty": "蜀漢",
                "emperor": "後主",
                "reignYear": "建興",
                "yearNumber": "1",
                "yearGanzhi": "癸卯",
                "month": " 五",
                "dayNumber": "1",
                "dayGanzhi": "戊子"
            }
        }
    })					
  2. From-To Query:

    http://authority.dila.edu.tw/webwidget/getAuthorityData.php?type=time&from=2302675&to=2302911&format=j&jsoncallback=abc123

    Json return:

    					{
        "F": {
            "rows": "1",
            "data1": {
                "authorityID": "5814240",
                "JD": "2302675",
                "ceDate": "+1592-05-29",
                "dynasty": " 明",
                "emperor": "神宗",
                "reignYear": "萬曆",
                "yearNumber": "20",
                "yearGanzhi": "壬辰",
                "month": "四",
                "dayNumber": "19",
                "dayGanzhi": "戊申"
            }
        },
        "T": {
            "rows": "1",
            "data1": {
                "authorityID": "5814476",
                "JD": "2302911",
                "ceDate": "+1593-01-20",
                "dynasty": " 明",
                "emperor": "神宗",
                "reignYear": "萬曆",
                "yearNumber": "20",
                "yearGanzhi": "壬辰",
                "month": "十二",
                "dayNumber": "18",
                "dayGanzhi": "甲辰"
            }
        }
    }					

Fields in Json string:

Field Name Description
F/T/W Result of From/To/When
rows The number of rows in result set
authorityID Authority ID of the Date entity
JD Julian Day Number
ceDate Date in the Western calendar (Common-Era)
dynasty Name of the Chinese Dynasty at that Date
emperor Name of the Chinese Emperor on that Date
reignYear Name of the Reign Year
yearNumber Year number of the Reign
yearGanzhi Sexagenary number of the year
month Name of the Chinese month
dayNumber Day number of the given month
dayGanzhi Sexagenary number of the day

JavaScript example for processing json string:

			function print_ddbcAuth_date(jsoncallback) { // 'jsoncallback' is the string returned by the data-service
	var html = '';
	html += '<table>';
	if (jsoncallback.W) {
		html += '<tr>';
		html += '<td>';
		html += 'AuthorityID: '+jsoncallback.W.data1.authorityID+'<br />';
		html += 'JD: '+jsoncallback.W.data1.JD+'<br />'
		html += '('+jsoncallback.W.data1.ceDate+')';
		html += '</td>';
		for (obj in jsoncallback.W) {
			if (obj != "rows") {
				html += '<td>';
				html += jsoncallback.W[obj].dynasty+jsoncallback.W[obj].emperor+'<br />';
				html += jsoncallback.W[obj].reignYear+jsoncallback.W[obj].yearNumber+'年('+jsoncallback.W[obj].yearGanzhi+')<br />';
				html += jsoncallback.W[obj].month+'月'+jsoncallback.W[obj].dayNumber+'日('+jsoncallback.W[obj].dayGanzhi+')';
				html += '</td>';
			}
		}
		html += '</tr>';
	}
	html += '</table>';
}