window.onload = function() {
all_data = new Array();
tmp_a_data = new Array();
$.each(LinkData.getWorks(), function(workKey, workValue) {
$.each(LinkData.getFiles(workValue), function(fileKey, fileValue) {
$.each(LinkData.getSubjects(workValue,fileValue),function(subjKey,subjValue) {
var tmp_data = {}
tmp_data["id"] = subjValue;
$.each(LinkData.getProperties(workValue, fileValue), function(propKey, propValue) {
$.each(LinkData.getObjects(workValue, fileValue, subjValue, propValue), function(objKey, objValue) {
if(propValue == "http://www.w3.org/2000/01/rdf-schema#label"){
tmp_data["label"] = objValue;
} else if(propValue == "http://xmlns.com/foaf/0.1/homepage"){
tmp_data["homepage"] = objValue;
} else if(propValue == "http://purl.org/dc/terms/isPartOf"){
tmp_data["ispartof"] = objValue;
} else if(propValue == "http://linkdata.org/property/rdf1s574i#tel"){
tmp_data["tel"] = objValue;
} else if(propValue == "http://linkdata.org/property/rdf1s574i#fax"){
tmp_data["fax"] = objValue;
} else if(propValue == "http://linkdata.org/property/rdf1s574i#mail"){
tmp_data["mail"] = objValue;
}
});
});
tmp_a_data.push(tmp_data);
});
});
});
all_data = tmp_a_data;
$(".selectkyoku").append("<option value='-1' selected='selected'>部署を選択してください。</option>");
for (var i in all_data){
var parent_c = "http://dbpedia.org/resource/Yokohama";
if (all_data[i].ispartof === parent_c){
$(".selectkyoku").append("<option value='"+ all_data[i].id +"'>" + all_data[i].label + "</option>");
}
}
$(".selectkyoku").change(function() {
$(".selectbu").empty();
$(".selectka").empty();
$("#result").empty();
var sectionKyokuKey = $("option:selected", $(this)).val();
if (sectionKyokuKey == -1) {
return;
}
$(".selectbu").append("<option value='-1' selected='selected'>部を選択してください。</option>");
for (var i in all_data){
var parent_c_c = sectionKyokuKey;
if (all_data[i].ispartof === parent_c_c){
$(".selectbu").append("<option value='"+ all_data[i].id +"'>" + all_data[i].label + "</option>");
}
}
});
$(".selectbu").change(function() {
$(".selectka").empty();
$("#result").empty();
var sectionBuKey = $("option:selected", $(this)).val();
if (sectionBuKey == -1) {
return;
}
$(".selectka").append("<option value='-1' selected='selected'>課を選択してください。</option>");
for (var i in all_data){
var parent_c_c_c = sectionBuKey;
if (all_data[i].ispartof === parent_c_c_c){
$(".selectka").append("<option value='"+ all_data[i].id +"'>" + all_data[i].label + "</option>");
}
}
});
$(".selectka").change(function() {
$("#result").empty();
var sectionKaKey = $("option:selected", $(this)).val();
if (sectionKaKey == -1) {
return;
}
$("#result").append("<div style='padding-left:30px;'>詳細データ</div>");
for (var i in all_data){
var detail_c = sectionKaKey;
if (all_data[i].id === detail_c){
$("#result").append("<div style='padding-left:30px;'>TEL:" + all_data[i].tel + "</div>");
$("#result").append("<div style='padding-left:30px;'>FAX:" + all_data[i].fax + "</div>");
$("#result").append("<div style='padding-left:30px;'>Mail:" + all_data[i].mail + "</div>");
$("#result").append("<div style='padding-left:30px;'>HP:" + all_data[i].homepage + "</div>");
}
}
});
}