diff --git a/productMods/js/visualization/entitycomparison/gui-event-manager.js b/productMods/js/visualization/entitycomparison/gui-event-manager.js
index 7b8659be..938b41e1 100644
--- a/productMods/js/visualization/entitycomparison/gui-event-manager.js
+++ b/productMods/js/visualization/entitycomparison/gui-event-manager.js
@@ -138,9 +138,8 @@ $(document).ready(function() {
labelToEntityRecord[val.label] = val;
});
- getEntityVisMode(jsonData);
prepareTableForDataTablePagination(jsonData);
- setEntityLevel();
+ setEntityLevel(getEntityVisMode(jsonData));
$(".disabled-checkbox-event-receiver").live("click", function () {
diff --git a/productMods/js/visualization/entitycomparison/util.js b/productMods/js/visualization/entitycomparison/util.js
index 578e9a1d..3d40f4c7 100644
--- a/productMods/js/visualization/entitycomparison/util.js
+++ b/productMods/js/visualization/entitycomparison/util.js
@@ -1085,26 +1085,41 @@ function removeStopWords(val){
return typeStringWithoutStopWords.substring(1, typeStringWithoutStopWords.length);
}
-function setEntityLevel(){
- $('#entitylevelheading').text(' - ' + toCamelCase(entityLevel) + ' Level').css('font-style', 'italic');
+function setEntityLevel(entityLevel){
+ //$('#entitylevelheading').text(' - ' + toCamelCase(entityLevel) + ' Level').css('font-style', 'italic');
$('#entityleveltext').text(' ' + entityLevel.toLowerCase()).css('font-style', 'italic');
- $('#entityHeader').text(toCamelCase(entityLevel)).css('font-weight', 'bold');
+ $('#entityHeader').text(entityLevel).css('font-weight', 'bold');
$('#headerText').css("color", "#2485ae");
}
function getEntityVisMode(jsonData){
+ var entityLevels = new Array();
+
$.each(jsonData, function(index, val) {
if (val.visMode == "PERSON"){
- entityLevel = "People";
+ entityLevels.push("People");
} else {
- entityLevel = "Organizations";
+ entityLevels.push("Organizations");
}
- return;
});
- /* To provide graceful degradation set entity level to a default error message.*/
- entitylevel = "ENTITY LEVEL UNDEFINED ERROR";
+ var uniqueEntityLevels = $.unique(entityLevels);
+
+ /*
+ * This case is when organizations & people are mixed because both are directly attached
+ * to the parent organization.
+ * */
+ if (uniqueEntityLevels.length > 1) {
+ entityLevel = "Organizations & People";
+ } else if (uniqueEntityLevels.length === 1) {
+ entityLevel = uniqueEntityLevels[0];
+ } else {
+ /* To provide graceful degradation set entity level to a default error message.*/
+ entitylevel = "ENTITY LEVEL UNDEFINED ERROR";
+ }
+
+ return entityLevel;
}
function toCamelCase(string){
diff --git a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonBody.ftl b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonBody.ftl
index e7b95d1a..122483a1 100644
--- a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonBody.ftl
+++ b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonBody.ftl
@@ -76,7 +76,7 @@
You have selected 0 of a maximum
- 10 schools to compare.
+ 10 schools.
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountQueryRunner.java
index 502fb4ae..53359e3d 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountQueryRunner.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntityPublicationCountQueryRunner.java
@@ -146,15 +146,18 @@ public class EntityPublicationCountQueryRunner implements QueryRunner {
if (subEntityLabelNode != null) {
subEntity.setIndividualLabel(subEntityLabelNode.toString());
}
- // entity.addSubEntity(subEntity);
+
+ entity.addSubEntity(subEntity);
+
subEntity.addPublications(biboDocument);
}
RDFNode personURLNode = solution.get(QueryFieldLabels.PERSON_URL);
- if(personURLNode != null){
- SubEntity person ;
- if(personURLToVO.containsKey(personURLNode.toString())) {
+ if (personURLNode != null) {
+ SubEntity person;
+
+ if (personURLToVO.containsKey(personURLNode.toString())) {
person = personURLToVO.get(personURLNode.toString());
} else {
person = new SubEntity(personURLNode.toString());
@@ -166,7 +169,19 @@ public class EntityPublicationCountQueryRunner implements QueryRunner {
person.setIndividualLabel(personLabelNode.toString());
}
-// entity.addSubEntity(person);
+ /*
+ * This makes sure that either,
+ * 1. the parent organization is a department-like organization with no organizations
+ * beneath it, or
+ * 2. the parent organizations has both sub-organizations and people directly
+ * attached to that organizations e.g. president of a university.
+ * */
+ if (subEntityURLNode == null) {
+
+ entity.addSubEntity(person);
+
+ }
+
person.addPublications(biboDocument);
}
@@ -174,16 +189,19 @@ public class EntityPublicationCountQueryRunner implements QueryRunner {
entity.addPublications(biboDocument);
}
- if(subentityURLToVO.size() != 0){
- for(SubEntity subEntity : subentityURLToVO.values()){
- entity.addSubEntity(subEntity);
- }
- } else if(subentityURLToVO.size() == 0 && personURLToVO.size() != 0){
- for(SubEntity person : personURLToVO.values()){
- entity.addSubEntity(person);
- }
- } else if (subentityURLToVO.size() == 0 && personURLToVO.size() == 0){
+ /*
+ if (subentityURLToVO.size() != 0) {
+
+ entity.addSubEntitities(subentityURLToVO.values());
+
+ } else if (subentityURLToVO.size() == 0 && personURLToVO.size() != 0) {
+
+ entity.addSubEntitities(personURLToVO.values());
+
+ } else*/ if (subentityURLToVO.size() == 0 && personURLToVO.size() == 0) {
+
entity = new Entity(this.entityURI, "no-label");
+
}
//TODO: return non-null value
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntitySubOrganizationTypesQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntitySubOrganizationTypesQueryRunner.java
index d7a7f3db..c22f0fe6 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntitySubOrganizationTypesQueryRunner.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/entitycomparison/EntitySubOrganizationTypesQueryRunner.java
@@ -97,7 +97,7 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner