var LV = LV || {};
LV.title = "札幌市内主要観光地の対訳データベース";
LV.property = [
["ID", "0"],
["タイトル(日本語)", "title_ja"],
["タイトル(英語)", "title_en"],
["タイトル(中文簡体)", "title_zh-CN"],
["タイトル(中文繁体)", "title_zh-TW"],
["タイトル(ハングル)", "title_ko"],
["画像", "http://schema.org/image"]
]
window.onload = function() {
$("#result").append("<h1>" + LV.title + "</h1>");
$("#result").append("<table class='display' id='data_list'></table>" );
var colList=[];
$('#data_list').dataTable({
"aoColumns": setColName(colList),
"asSorting": [[0,"desc"]],
"bJQueryUI": true,
"bAutoWidth": false,
"bJQueryUI": true,
"columnDefs": [{
"defaultContent": "-",
"targets": "_all"
}],
"language": {
"emptyTable" : "データが登録されていません。",
"info" : "_TOTAL_ 件中 _START_ 件から _END_ 件までを表示",
"infoEmpty" : "",
"infoFiltered" : "(_MAX_ 件からの絞り込み表示)",
"infoPostFix" : "",
"thousands" : ",",
"lengthMenu" : "1ページあたりの表示件数: _MENU_",
"loadingRecords" : "ロード中",
"processing" : "処理中...",
"search" : "検索:",
"zeroRecords" : "該当するデータが見つかりませんでした。",
"paginate" : {
"first" : "先頭",
"previous" : "前へ",
"next" : "次へ",
"last" : "末尾"
}
}
});
$.each(LinkData.getWorks(), function(workKey, workValue) {
var propList = stringToUri(LV.property, workValue);
$.each(LinkData.getFiles(workValue), function(fileKey, fileValue) {
$.each(LinkData.getSubjects(workValue, fileValue), function(subjKey, subjValue) {
var dataList = [];
var sharp = decodeURIComponent(subjValue).split("#");
var slash = sharp[sharp.length-1].split("/");
var id = slash[slash.length-1];
dataList[0] = id;
$.each( LinkData.getProperties(workValue, fileValue), function(propKey, propValue) {
$.each (propList, function(i, propUri){
if (propUri == propValue) {
var objList = [];
$.each( LinkData.getObjects(workValue, fileValue, subjValue, propValue), function(objkey, objValue) {
objList.push(objValue);
});
dataList[i+1] = addHtml(objList.toString());
}
});
});
$('#data_list').dataTable().fnAddData(dataList);
});
});
});
}
function stringToUri (p, workId) {
var arr = [];
$.each (p, function(){
if(this[1] != 0) {
if(this[1].indexOf("http") != 0){
arr.push("http://linkdata.org/property/" + workId + "#" + encodeURIComponent(this[1]));
} else {
arr.push(this[1]);
}
}
})
return arr;