var LV = LV || {};
LV.property = [
["名称", "http://xmlns.com/foaf/0.1/firstName"],
["住所", "http://schema.org/address"],
["緯度", "http://www.w3.org/2003/01/geo/wgs84_pos#lat"],
["経度", "http://www.w3.org/2003/01/geo/wgs84_pos#long"],
]
window.onload = function() {
$("#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 = [];
$.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] = objList.toString();
}
});
});
$('#data_list').dataTable().fnAddData(dataList);
});
});
});
}
function stringToUri (p, workId) {
var arr = [];
$.each (p, function(){
if(this[1].indexOf("http") != 0){
arr.push("http://linkdata.org/property/" + workId + "#" + encodeURIComponent(this[1]));
} else {
arr.push(this[1]);
}
})
return arr;
}
function setColName(arr) {
$.each(LV.property, function(){
var col = {};
col.sTitle = this[0];
arr.push(col);
})
return arr;
}