WebVOWL_work
Changes
src/app/js/sidebar.js 35(+23 -12)
Details
src/app/js/sidebar.js 35(+23 -12)
diff --git a/src/app/js/sidebar.js b/src/app/js/sidebar.js
index cce15d9..93b8936 100644
--- a/src/app/js/sidebar.js
+++ b/src/app/js/sidebar.js
@@ -85,13 +85,14 @@ module.exports = function ( graph ){
renderPair(panel, "Description", description);
var other = ontologyInfo.other || {};
- for ( var key in other ) {
- if ( other.hasOwnProperty(key) ) {
- var entries = other[key];
- if ( !entries ) continue;
- entries.forEach(function ( ann ){
+ for ( var otherKey in other ) {
+ if ( other.hasOwnProperty(otherKey) ) {
+ var otherEntries = other[otherKey];
+ if ( !otherEntries ) continue;
+ var otherLabel = prefixedName(otherKey);
+ otherEntries.forEach(function ( ann ){
if ( !ann ) return;
- renderPair(panel, prefixedName(ann.identifier), ann.value, ann.type === "iri" ? ann.value : undefined);
+ renderPair(panel, otherLabel, ann.value, ann.type === "iri" ? ann.value : undefined);
});
}
}
@@ -125,7 +126,6 @@ module.exports = function ( graph ){
var languageSelection = d3.select("#language")
.on("change", function (){
graph.language(d3.event.target.value);
- updateGraphInformation();
sidebar.updateSelectionInformation(lastSelectedElement);
});
@@ -221,8 +221,7 @@ module.exports = function ( graph ){
var attrs = getAttributes(property.attributes());
if ( attrs ) renderPair(panel, "Characteristics", attrs);
- renderPair(panel, "rdfs:comment", property.commentForCurrentLanguage());
- renderPair(panel, "rdfs:label", property.descriptionForCurrentLanguage());
+ renderCommentPairs(panel, property.comment());
renderAnnotationPairs(panel, property.annotations());
}
@@ -249,15 +248,28 @@ module.exports = function ( graph ){
return iri;
}
+ function renderCommentPairs( panel, comment ){
+ if ( !comment ) return;
+ if ( typeof comment === "string" ) {
+ renderPair(panel, "rdfs:comment", comment);
+ return;
+ }
+ for ( var lang in comment ) {
+ if ( comment.hasOwnProperty(lang) && comment[lang] ) {
+ renderPair(panel, "rdfs:comment", comment[lang]);
+ }
+ }
+ }
+
function renderAnnotationPairs( panel, annotationObject ){
annotationObject = annotationObject || {};
for ( var key in annotationObject ) {
if ( annotationObject.hasOwnProperty(key) ) {
var entries = annotationObject[key];
if ( !entries ) continue;
+ var label = prefixedName(key);
entries.forEach(function ( ann ){
if ( !ann ) return;
- var label = prefixedName(ann.identifier);
renderPair(panel, label, ann.value, ann.type === "iri" ? ann.value : undefined);
});
}
@@ -293,8 +305,7 @@ module.exports = function ( graph ){
var attrs = getAttributes(node.attributes());
if ( attrs ) renderPair(panel, "Characteristics", attrs);
- renderPair(panel, "rdfs:comment", node.commentForCurrentLanguage());
- renderPair(panel, "rdfs:label", node.descriptionForCurrentLanguage());
+ renderCommentPairs(panel, node.comment());
renderAnnotationPairs(panel, node.annotations());
}