WebVOWL_work
Details
src/app/js/sidebar.js 17(+17 -0)
diff --git a/src/app/js/sidebar.js b/src/app/js/sidebar.js
index 7ac0e93..e150659 100644
--- a/src/app/js/sidebar.js
+++ b/src/app/js/sidebar.js
@@ -231,6 +231,14 @@ module.exports = function ( graph ){
var attrs = getAttributes(property.attributes());
if ( attrs ) renderPair(panel, "Characteristics", attrs);
+ if ( property.instances && property.instances() > 0 ) {
+ renderPair(panel, "Instances", property.instances());
+ property.individuals().forEach(function ( assertion ){
+ var label = prefixedName(assertion.subject) + " → " + prefixedName(assertion.object);
+ renderPair(panel, "Individual", label);
+ });
+ }
+
renderCommentPairs(panel, property.comment());
renderAnnotationPairs(panel, property.annotations());
@@ -381,6 +389,15 @@ module.exports = function ( graph ){
}
var attrs2 = getAttributes(element.attributes());
if ( attrs2 ) renderPair(panel, "Characteristics", attrs2);
+
+ if ( element.instances && element.instances() > 0 ) {
+ renderPair(panel, "Instances", element.instances());
+ element.individuals().forEach(function ( assertion ){
+ var label = prefixedName(assertion.subject) + " → " + prefixedName(assertion.object);
+ renderPair(panel, "Individual", label);
+ });
+ }
+
renderCommentPairs(panel, element.comment());
renderAnnotationPairs(panel, element.annotations());
}
diff --git a/src/webvowl/js/elements/properties/BaseProperty.js b/src/webvowl/js/elements/properties/BaseProperty.js
index a7df310..7c52874 100644
--- a/src/webvowl/js/elements/properties/BaseProperty.js
+++ b/src/webvowl/js/elements/properties/BaseProperty.js
@@ -21,6 +21,8 @@ module.exports = (function (){
// Basic attributes
cardinality,
domain,
+ individuals = [],
+ instances = 0,
inverse,
link,
minCardinality,
@@ -88,6 +90,18 @@ module.exports = (function (){
cardinality = p;
return this;
};
+
+ this.individuals = function ( p ){
+ if ( !arguments.length ) return individuals;
+ individuals = p || [];
+ return this;
+ };
+
+ this.instances = function ( p ){
+ if ( !arguments.length ) return instances;
+ instances = p || 0;
+ return this;
+ };
this.cardinalityElement = function ( p ){
if ( !arguments.length ) return cardinalityElement;
@@ -325,8 +339,9 @@ module.exports = (function (){
textElement.addText(this.labelForCurrentLanguage(), "", suffixForFollowingEquivalents);
textElement.addEquivalents(equivalentsString);
textElement.addSubText(this.indicationString());
+ textElement.addInstanceCount(that.instances());
};
-
+
this.equivalentsString = function (){
var equivalentProperties = that.equivalents();
if ( !equivalentProperties ) {
@@ -695,8 +710,9 @@ module.exports = (function (){
textElement.addText(this.labelForCurrentLanguage(), "", suffixForFollowingEquivalents);
textElement.addEquivalents(equivalentsString);
textElement.addSubText(this.indicationString());
+ textElement.addInstanceCount(that.instances());
};
-
+
this.updateTextElement = function (){
textElement.updateAllTextElements();
};
src/webvowl/js/parser.js 10(+10 -0)
diff --git a/src/webvowl/js/parser.js b/src/webvowl/js/parser.js
index 7961c81..5cdf397 100644
--- a/src/webvowl/js/parser.js
+++ b/src/webvowl/js/parser.js
@@ -315,6 +315,16 @@ module.exports = function ( graph ){
var deduplicatedAttributes = d3.set(element.attributes.concat(property.attributes()));
property.attributes(deduplicatedAttributes.values());
}
+
+ if ( element.instances !== undefined ) {
+ property.instances(element.instances);
+ }
+ if ( element.individuals ) {
+ element.individuals.forEach(function ( assertion ){
+ property.individuals().push(assertion);
+ });
+ }
+
combinations.push(property);
} else {
console.error("Unknown element type: " + element.type);