1. Fix for people directly not attached to an organizations not showing up, if the organization happens to be higher up in the hierarchy where it has other sub-organizations beneath it.
2. Made changes to the front-end to reflect new content in temporal vis.
This commit is contained in:
parent
85789d5e02
commit
a9214be4a2
6 changed files with 107 additions and 52 deletions
|
@ -138,9 +138,8 @@ $(document).ready(function() {
|
||||||
labelToEntityRecord[val.label] = val;
|
labelToEntityRecord[val.label] = val;
|
||||||
});
|
});
|
||||||
|
|
||||||
getEntityVisMode(jsonData);
|
|
||||||
prepareTableForDataTablePagination(jsonData);
|
prepareTableForDataTablePagination(jsonData);
|
||||||
setEntityLevel();
|
setEntityLevel(getEntityVisMode(jsonData));
|
||||||
|
|
||||||
$(".disabled-checkbox-event-receiver").live("click", function () {
|
$(".disabled-checkbox-event-receiver").live("click", function () {
|
||||||
|
|
||||||
|
|
|
@ -1085,26 +1085,41 @@ function removeStopWords(val){
|
||||||
return typeStringWithoutStopWords.substring(1, typeStringWithoutStopWords.length);
|
return typeStringWithoutStopWords.substring(1, typeStringWithoutStopWords.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setEntityLevel(){
|
function setEntityLevel(entityLevel){
|
||||||
$('#entitylevelheading').text(' - ' + toCamelCase(entityLevel) + ' Level').css('font-style', 'italic');
|
//$('#entitylevelheading').text(' - ' + toCamelCase(entityLevel) + ' Level').css('font-style', 'italic');
|
||||||
$('#entityleveltext').text(' ' + entityLevel.toLowerCase()).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");
|
$('#headerText').css("color", "#2485ae");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEntityVisMode(jsonData){
|
function getEntityVisMode(jsonData){
|
||||||
|
|
||||||
|
var entityLevels = new Array();
|
||||||
|
|
||||||
$.each(jsonData, function(index, val) {
|
$.each(jsonData, function(index, val) {
|
||||||
if (val.visMode == "PERSON"){
|
if (val.visMode == "PERSON"){
|
||||||
entityLevel = "People";
|
entityLevels.push("People");
|
||||||
} else {
|
} else {
|
||||||
entityLevel = "Organizations";
|
entityLevels.push("Organizations");
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* To provide graceful degradation set entity level to a default error message.*/
|
var uniqueEntityLevels = $.unique(entityLevels);
|
||||||
entitylevel = "ENTITY LEVEL UNDEFINED ERROR";
|
|
||||||
|
/*
|
||||||
|
* 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){
|
function toCamelCase(string){
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
<div id="bottom">
|
<div id="bottom">
|
||||||
<h3><span id="comparisonParameter"></span></h3>
|
<h3><span id="comparisonParameter"></span></h3>
|
||||||
<p class="displayCounter">You have selected <span id="counter">0</span> of a maximum
|
<p class="displayCounter">You have selected <span id="counter">0</span> of a maximum
|
||||||
<span id="total">10</span> <span id="entityleveltext"> schools</span> to compare.
|
<span id="total">10</span> <span id="entityleveltext"> schools</span>.
|
||||||
<span id="legend-row-header">
|
<span id="legend-row-header">
|
||||||
<a class="clear-selected-entities temporalGraphLinks" title="Clear all selected entities.">Clear</a>
|
<a class="clear-selected-entities temporalGraphLinks" title="Clear all selected entities.">Clear</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -146,15 +146,18 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
|
||||||
if (subEntityLabelNode != null) {
|
if (subEntityLabelNode != null) {
|
||||||
subEntity.setIndividualLabel(subEntityLabelNode.toString());
|
subEntity.setIndividualLabel(subEntityLabelNode.toString());
|
||||||
}
|
}
|
||||||
// entity.addSubEntity(subEntity);
|
|
||||||
|
entity.addSubEntity(subEntity);
|
||||||
|
|
||||||
subEntity.addPublications(biboDocument);
|
subEntity.addPublications(biboDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
RDFNode personURLNode = solution.get(QueryFieldLabels.PERSON_URL);
|
RDFNode personURLNode = solution.get(QueryFieldLabels.PERSON_URL);
|
||||||
|
|
||||||
if(personURLNode != null){
|
if (personURLNode != null) {
|
||||||
SubEntity person ;
|
SubEntity person;
|
||||||
if(personURLToVO.containsKey(personURLNode.toString())) {
|
|
||||||
|
if (personURLToVO.containsKey(personURLNode.toString())) {
|
||||||
person = personURLToVO.get(personURLNode.toString());
|
person = personURLToVO.get(personURLNode.toString());
|
||||||
} else {
|
} else {
|
||||||
person = new SubEntity(personURLNode.toString());
|
person = new SubEntity(personURLNode.toString());
|
||||||
|
@ -166,7 +169,19 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
|
||||||
person.setIndividualLabel(personLabelNode.toString());
|
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);
|
person.addPublications(biboDocument);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -174,16 +189,19 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
|
||||||
entity.addPublications(biboDocument);
|
entity.addPublications(biboDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(subentityURLToVO.size() != 0){
|
/*
|
||||||
for(SubEntity subEntity : subentityURLToVO.values()){
|
if (subentityURLToVO.size() != 0) {
|
||||||
entity.addSubEntity(subEntity);
|
|
||||||
}
|
entity.addSubEntitities(subentityURLToVO.values());
|
||||||
} else if(subentityURLToVO.size() == 0 && personURLToVO.size() != 0){
|
|
||||||
for(SubEntity person : personURLToVO.values()){
|
} else if (subentityURLToVO.size() == 0 && personURLToVO.size() != 0) {
|
||||||
entity.addSubEntity(person);
|
|
||||||
}
|
entity.addSubEntitities(personURLToVO.values());
|
||||||
} else if (subentityURLToVO.size() == 0 && personURLToVO.size() == 0){
|
|
||||||
|
} else*/ if (subentityURLToVO.size() == 0 && personURLToVO.size() == 0) {
|
||||||
|
|
||||||
entity = new Entity(this.entityURI, "no-label");
|
entity = new Entity(this.entityURI, "no-label");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: return non-null value
|
//TODO: return non-null value
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
|
||||||
+ "}";
|
+ "}";
|
||||||
|
|
||||||
|
|
||||||
// System.out.println("\n\nEntity SubOrganizationTypes query is: "+ sparqlQuery);
|
System.out.println("\n\nEntity SubOrganizationTypes query is:\n "+ sparqlQuery);
|
||||||
log.debug("\nThe sparql query is :\n" + sparqlQuery);
|
log.debug("\nThe sparql query is :\n" + sparqlQuery);
|
||||||
|
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
|
@ -106,8 +106,9 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
|
||||||
|
|
||||||
private Map<String, Set<String>> createJavaValueObjects(ResultSet resultSet) {
|
private Map<String, Set<String>> createJavaValueObjects(ResultSet resultSet) {
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationLabelToTypes = new HashMap<String, Set<String>>();
|
/*Map<String, Set<String>> subOrganizationLabelToTypes = new HashMap<String, Set<String>>();
|
||||||
Map<String, Set<String>> personLabelToTypes = new HashMap<String, Set<String>>();
|
Map<String, Set<String>> personLabelToTypes = new HashMap<String, Set<String>>();*/
|
||||||
|
Map<String, Set<String>> subEntityLabelToTypes = new HashMap<String, Set<String>>();
|
||||||
|
|
||||||
while(resultSet.hasNext()){
|
while(resultSet.hasNext()){
|
||||||
|
|
||||||
|
@ -115,34 +116,50 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
|
||||||
|
|
||||||
RDFNode subOrganizationLabel = solution.get(QueryFieldLabels.SUBORGANIZATION_LABEL);
|
RDFNode subOrganizationLabel = solution.get(QueryFieldLabels.SUBORGANIZATION_LABEL);
|
||||||
|
|
||||||
if(subOrganizationLabel != null){
|
if (subOrganizationLabel != null) {
|
||||||
if(subOrganizationLabelToTypes.containsKey(subOrganizationLabel.toString())){
|
|
||||||
RDFNode subOrganizationType = solution.get(QueryFieldLabels.SUBORGANIZATION_TYPE_LABEL);
|
if (subEntityLabelToTypes.containsKey(subOrganizationLabel.toString())) {
|
||||||
if(subOrganizationType != null){
|
RDFNode subOrganizationType = solution
|
||||||
subOrganizationLabelToTypes.get(subOrganizationLabel.toString()).add(subOrganizationType.toString());
|
.get(QueryFieldLabels.SUBORGANIZATION_TYPE_LABEL);
|
||||||
|
if (subOrganizationType != null) {
|
||||||
|
subEntityLabelToTypes.get(
|
||||||
|
subOrganizationLabel.toString()).add(
|
||||||
|
subOrganizationType.toString());
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
RDFNode subOrganizationType = solution.get(QueryFieldLabels.SUBORGANIZATION_TYPE_LABEL);
|
RDFNode subOrganizationType = solution
|
||||||
if(subOrganizationType != null){
|
.get(QueryFieldLabels.SUBORGANIZATION_TYPE_LABEL);
|
||||||
subOrganizationLabelToTypes.put(subOrganizationLabel.toString(), new HashSet<String>());
|
if (subOrganizationType != null) {
|
||||||
subOrganizationLabelToTypes.get(subOrganizationLabel.toString()).add(subOrganizationType.toString());
|
subEntityLabelToTypes.put(
|
||||||
|
subOrganizationLabel.toString(),
|
||||||
|
new HashSet<String>());
|
||||||
|
subEntityLabelToTypes.get(
|
||||||
|
subOrganizationLabel.toString()).add(
|
||||||
|
subOrganizationType.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RDFNode personLabel = solution.get(QueryFieldLabels.PERSON_LABEL);
|
RDFNode personLabel = solution.get(QueryFieldLabels.PERSON_LABEL);
|
||||||
|
|
||||||
if(personLabel != null){
|
if (personLabel != null) {
|
||||||
if(personLabelToTypes.containsKey(personLabel.toString())){
|
if (subEntityLabelToTypes.containsKey(personLabel.toString())) {
|
||||||
RDFNode personType = solution.get(QueryFieldLabels.PERSON_TYPE_LABEL);
|
RDFNode personType = solution
|
||||||
if(personType != null && ! personType.toString().startsWith("http")){
|
.get(QueryFieldLabels.PERSON_TYPE_LABEL);
|
||||||
personLabelToTypes.get(personLabel.toString()).add(personType.toString());
|
if (personType != null
|
||||||
|
&& !personType.toString().startsWith("http")) {
|
||||||
|
subEntityLabelToTypes.get(personLabel.toString()).add(
|
||||||
|
personType.toString());
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
RDFNode personType = solution.get(QueryFieldLabels.PERSON_TYPE_LABEL);
|
RDFNode personType = solution
|
||||||
if(personType != null && ! personType.toString().startsWith("http")){
|
.get(QueryFieldLabels.PERSON_TYPE_LABEL);
|
||||||
personLabelToTypes.put(personLabel.toString(), new HashSet<String>());
|
if (personType != null
|
||||||
personLabelToTypes.get(personLabel.toString()).add(personType.toString());
|
&& !personType.toString().startsWith("http")) {
|
||||||
|
subEntityLabelToTypes.put(personLabel.toString(),
|
||||||
|
new HashSet<String>());
|
||||||
|
subEntityLabelToTypes.get(personLabel.toString()).add(
|
||||||
|
personType.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,10 +168,10 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
|
||||||
// System.out.println("\n\nSub Organization Label Types Size --> " + subOrganizationLabelToTypes.size());
|
// System.out.println("\n\nSub Organization Label Types Size --> " + subOrganizationLabelToTypes.size());
|
||||||
// System.out.println("\n\nPeople Label Types Size --> " + personLabelToTypes.size());
|
// System.out.println("\n\nPeople Label Types Size --> " + personLabelToTypes.size());
|
||||||
|
|
||||||
log.info("Sub Organization Label Types Size : " + subOrganizationLabelToTypes.size());
|
log.info("Sub Organization Label Types Size : " + subEntityLabelToTypes.size());
|
||||||
log.info("People Label Types Size : " + personLabelToTypes.size());
|
|
||||||
|
|
||||||
return (subOrganizationLabelToTypes.size() != 0 )? subOrganizationLabelToTypes : personLabelToTypes ;
|
return subEntityLabelToTypes;
|
||||||
|
//return (subOrganizationLabelToTypes.size() != 0 )? subOrganizationLabelToTypes : personLabelToTypes ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Set<String>> getQueryResult() throws MalformedQueryParametersException {
|
public Map<String, Set<String>> getQueryResult() throws MalformedQueryParametersException {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects;
|
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.valueobjects;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -49,6 +50,11 @@ public class Entity extends Individual{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addSubEntitities(Collection<SubEntity> subEntities) {
|
||||||
|
this.children.addAll(subEntities);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void addGrants(Grant grant) {
|
public void addGrants(Grant grant) {
|
||||||
this.grants.add(grant);
|
this.grants.add(grant);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue