Minor changes to allow zero values to appear on Temporal Graphs (matches old behaviour)
This commit is contained in:
parent
3605888ad3
commit
2235abed00
3 changed files with 37 additions and 19 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.temporalgraph;
|
package edu.cornell.mannlib.vitro.webapp.visualization.temporalgraph;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -157,13 +158,13 @@ public class TemporalGrantVisualizationRequestHandler implements
|
||||||
Set<String> orgGrants = new HashSet<String>();
|
Set<String> orgGrants = new HashSet<String>();
|
||||||
Set<String> orgGrantsPeople = new HashSet<String>();
|
Set<String> orgGrantsPeople = new HashSet<String>();
|
||||||
|
|
||||||
Map<String, Set<String>> subOrgPublicationsMap = new HashMap<String, Set<String>>();
|
Map<String, Set<String>> subOrgGrantsMap = new HashMap<String, Set<String>>();
|
||||||
|
|
||||||
OrgUtils.getObjectMappingsForOrgAnSubOrgs(
|
OrgUtils.getObjectMappingsForOrgAnSubOrgs(
|
||||||
subjectEntityURI,
|
subjectEntityURI,
|
||||||
orgGrants,
|
orgGrants,
|
||||||
orgGrantsPeople,
|
orgGrantsPeople,
|
||||||
subOrgPublicationsMap,
|
subOrgGrantsMap,
|
||||||
subOrgMap,
|
subOrgMap,
|
||||||
organisationToPeopleMap,
|
organisationToPeopleMap,
|
||||||
personToGrantMap
|
personToGrantMap
|
||||||
|
@ -183,15 +184,19 @@ public class TemporalGrantVisualizationRequestHandler implements
|
||||||
Set subEntitiesJson = new HashSet();
|
Set subEntitiesJson = new HashSet();
|
||||||
|
|
||||||
// For each suborganisation
|
// For each suborganisation
|
||||||
for (String subOrg : subOrgPublicationsMap.keySet()) {
|
for (String subOrg : subOrgGrantsMap.keySet()) {
|
||||||
JsonObject entityJson = new JsonObject(orgLabelMap.get(subOrg));
|
JsonObject entityJson = new JsonObject(orgLabelMap.get(subOrg));
|
||||||
|
|
||||||
List<List<Integer>> yearPubCounts = CounterUtils.getObjectCountByYear(subOrgPublicationsMap.get(subOrg), grantToYearMap);
|
if (subOrgGrantsMap.containsKey(subOrg)) {
|
||||||
|
List<List<Integer>> yearPubCounts = CounterUtils.getObjectCountByYear(subOrgGrantsMap.get(subOrg), grantToYearMap);
|
||||||
|
entityJson.setYearToActivityCount(yearPubCounts);
|
||||||
|
} else {
|
||||||
|
entityJson.setYearToActivityCount(new ArrayList<List<Integer>>());
|
||||||
|
}
|
||||||
|
|
||||||
String type = orgMostSpecificLabelMap.get(subOrg);
|
String type = orgMostSpecificLabelMap.get(subOrg);
|
||||||
|
|
||||||
entityJson.setYearToActivityCount(yearPubCounts);
|
|
||||||
entityJson.setOrganizationTypes(Arrays.asList(type == null ? "Organization" : type));
|
entityJson.setOrganizationTypes(Arrays.asList(type == null ? "Organization" : type));
|
||||||
|
|
||||||
entityJson.setEntityURI(subOrg);
|
entityJson.setEntityURI(subOrg);
|
||||||
entityJson.setVisMode("ORGANIZATION");
|
entityJson.setVisMode("ORGANIZATION");
|
||||||
|
|
||||||
|
@ -202,12 +207,16 @@ public class TemporalGrantVisualizationRequestHandler implements
|
||||||
for (String person : orgGrantsPeople) {
|
for (String person : orgGrantsPeople) {
|
||||||
JsonObject entityJson = new JsonObject(personLabelMap.get(person));
|
JsonObject entityJson = new JsonObject(personLabelMap.get(person));
|
||||||
|
|
||||||
List<List<Integer>> yearPubCounts = CounterUtils.getObjectCountByYear(personToGrantMap.get(person), grantToYearMap);
|
if (personToGrantMap.containsKey(person)) {
|
||||||
|
List<List<Integer>> yearPubCounts = CounterUtils.getObjectCountByYear(personToGrantMap.get(person), grantToYearMap);
|
||||||
|
entityJson.setYearToActivityCount(yearPubCounts);
|
||||||
|
} else {
|
||||||
|
entityJson.setYearToActivityCount(new ArrayList<List<Integer>>());
|
||||||
|
}
|
||||||
|
|
||||||
String type = personMostSpecificLabelMap.get(person);
|
String type = personMostSpecificLabelMap.get(person);
|
||||||
|
|
||||||
entityJson.setYearToActivityCount(yearPubCounts);
|
|
||||||
entityJson.setOrganizationTypes(Arrays.asList(type == null ? "Person" : type));
|
entityJson.setOrganizationTypes(Arrays.asList(type == null ? "Person" : type));
|
||||||
|
|
||||||
entityJson.setEntityURI(person);
|
entityJson.setEntityURI(person);
|
||||||
entityJson.setVisMode("PERSON");
|
entityJson.setVisMode("PERSON");
|
||||||
|
|
||||||
|
@ -234,11 +243,11 @@ public class TemporalGrantVisualizationRequestHandler implements
|
||||||
|
|
||||||
csvFileContent.append("Entity Name, Grant Count, Entity Type\n");
|
csvFileContent.append("Entity Name, Grant Count, Entity Type\n");
|
||||||
|
|
||||||
for (String subOrg : subOrgPublicationsMap.keySet()) {
|
for (String subOrg : subOrgGrantsMap.keySet()) {
|
||||||
csvFileContent.append(StringEscapeUtils.escapeCsv(orgLabelMap.get(subOrg)));
|
csvFileContent.append(StringEscapeUtils.escapeCsv(orgLabelMap.get(subOrg)));
|
||||||
csvFileContent.append(", ");
|
csvFileContent.append(", ");
|
||||||
|
|
||||||
csvFileContent.append(subOrgPublicationsMap.get(subOrg).size());
|
csvFileContent.append(subOrgGrantsMap.get(subOrg).size());
|
||||||
csvFileContent.append(", ");
|
csvFileContent.append(", ");
|
||||||
|
|
||||||
csvFileContent.append("Organization");
|
csvFileContent.append("Organization");
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.temporalgraph;
|
package edu.cornell.mannlib.vitro.webapp.visualization.temporalgraph;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -126,12 +127,16 @@ public class TemporalPublicationVisualizationRequestHandler implements
|
||||||
for (String subOrg : subOrgPublicationsMap.keySet()) {
|
for (String subOrg : subOrgPublicationsMap.keySet()) {
|
||||||
JsonObject entityJson = new JsonObject(orgLabelMap.get(subOrg));
|
JsonObject entityJson = new JsonObject(orgLabelMap.get(subOrg));
|
||||||
|
|
||||||
List<List<Integer>> yearPubCounts = CounterUtils.getObjectCountByYear(subOrgPublicationsMap.get(subOrg), publicationToYearMap);
|
if (subOrgPublicationsMap.containsKey(subOrg)) {
|
||||||
|
List<List<Integer>> yearPubCounts = CounterUtils.getObjectCountByYear(subOrgPublicationsMap.get(subOrg), publicationToYearMap);
|
||||||
|
entityJson.setYearToActivityCount(yearPubCounts);
|
||||||
|
} else {
|
||||||
|
entityJson.setYearToActivityCount(new ArrayList<List<Integer>>());
|
||||||
|
}
|
||||||
|
|
||||||
String type = orgMostSpecificLabelMap.get(subOrg);
|
String type = orgMostSpecificLabelMap.get(subOrg);
|
||||||
|
|
||||||
entityJson.setYearToActivityCount(yearPubCounts);
|
|
||||||
entityJson.setOrganizationTypes(Arrays.asList(type == null ? "Organization" : type));
|
entityJson.setOrganizationTypes(Arrays.asList(type == null ? "Organization" : type));
|
||||||
|
|
||||||
entityJson.setEntityURI(subOrg);
|
entityJson.setEntityURI(subOrg);
|
||||||
entityJson.setVisMode("ORGANIZATION");
|
entityJson.setVisMode("ORGANIZATION");
|
||||||
|
|
||||||
|
@ -142,12 +147,16 @@ public class TemporalPublicationVisualizationRequestHandler implements
|
||||||
for (String person : orgPublicationsPeople) {
|
for (String person : orgPublicationsPeople) {
|
||||||
JsonObject entityJson = new JsonObject(personLabelMap.get(person));
|
JsonObject entityJson = new JsonObject(personLabelMap.get(person));
|
||||||
|
|
||||||
List<List<Integer>> yearPubCounts = CounterUtils.getObjectCountByYear(personToPublicationMap.get(person), publicationToYearMap);
|
if (personToPublicationMap.containsKey(person)) {
|
||||||
|
List<List<Integer>> yearPubCounts = CounterUtils.getObjectCountByYear(personToPublicationMap.get(person), publicationToYearMap);
|
||||||
|
entityJson.setYearToActivityCount(yearPubCounts);
|
||||||
|
} else {
|
||||||
|
entityJson.setYearToActivityCount(new ArrayList<List<Integer>>());
|
||||||
|
}
|
||||||
|
|
||||||
String type = personMostSpecificLabelMap.get(person);
|
String type = personMostSpecificLabelMap.get(person);
|
||||||
|
|
||||||
entityJson.setYearToActivityCount(yearPubCounts);
|
|
||||||
entityJson.setOrganizationTypes(Arrays.asList(type == null ? "Person" : type));
|
entityJson.setOrganizationTypes(Arrays.asList(type == null ? "Person" : type));
|
||||||
|
|
||||||
entityJson.setEntityURI(person);
|
entityJson.setEntityURI(person);
|
||||||
entityJson.setVisMode("PERSON");
|
entityJson.setVisMode("PERSON");
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,8 @@ public class OrgUtils {
|
||||||
Set<String> people = organisationToPeopleMap.get(orgUri);
|
Set<String> people = organisationToPeopleMap.get(orgUri);
|
||||||
if (people != null) {
|
if (people != null) {
|
||||||
for (String person : people) {
|
for (String person : people) {
|
||||||
if (personToObjectMap.containsKey(person)) {
|
if (orgObjectsIncludesPeople.add(person)) {
|
||||||
if (orgObjectsIncludesPeople.add(person)) {
|
if (personToObjectMap.containsKey(person)) {
|
||||||
orgObjects.addAll(personToObjectMap.get(person));
|
orgObjects.addAll(personToObjectMap.get(person));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue