diff --git a/productMods/templates/freemarker/visualization/personlevel/coAuthorPersonLevelD3.ftl b/productMods/templates/freemarker/visualization/personlevel/coAuthorPersonLevelD3.ftl
index 1caa441d3..7024f0528 100644
--- a/productMods/templates/freemarker/visualization/personlevel/coAuthorPersonLevelD3.ftl
+++ b/productMods/templates/freemarker/visualization/personlevel/coAuthorPersonLevelD3.ftl
@@ -246,15 +246,6 @@ $(document).ready(function(){
diff --git a/productMods/templates/freemarker/visualization/personlevel/coPIPersonLevelD3.ftl b/productMods/templates/freemarker/visualization/personlevel/coPIPersonLevelD3.ftl
index c10bb28b4..312207b4f 100644
--- a/productMods/templates/freemarker/visualization/personlevel/coPIPersonLevelD3.ftl
+++ b/productMods/templates/freemarker/visualization/personlevel/coPIPersonLevelD3.ftl
@@ -254,23 +254,8 @@ $(document).ready(function(){
<#if (numOfCoInvestigations?? && numOfCoInvestigations > 0) || (numOfInvestigators?? && numOfInvestigators > 0) >
- <#else>
-
- <#if numOfInvestigators?? && numOfInvestigators <= 0 >
- <#assign investigatorsText = "multi-investigator" />
- #if>
-
-
${i18n().currently_no_grants_for(investigatorsText!)}
- ${i18n().this_investigator} ${i18n().in_the_vivo_db}
-
#if>
- <#else>
-
-
${i18n().no_grants_for}
- ${i18n().this_investigator} ${i18n().in_the_vivo_db}
-
-
#if>
@@ -290,6 +275,14 @@ $(document).ready(function(){
+ <#else>
+ <#if numOfInvestigators?? && numOfInvestigators <= 0 >
+ <#assign investigatorsText = "multi-investigator" />
+ #if>
+
+
${i18n().currently_no_grants_for(investigatorsText!)}
+ ${i18n().this_investigator} ${i18n().in_the_vivo_db}
+
#if>
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipQueryRunner.java
index 3bc10c651..ca9e3fe9c 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipQueryRunner.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipQueryRunner.java
@@ -16,10 +16,12 @@
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
import edu.cornell.mannlib.vitro.webapp.rdfservice.ResultSetConsumer;
import edu.cornell.mannlib.vitro.webapp.visualization.utilities.VisualizationCaches;
+import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.jena.iri.IRI;
@@ -59,14 +61,16 @@ public class CoAuthorshipQueryRunner implements QueryRunner
{
private String egoURI;
private RDFService rdfService;
+
+ private VitroRequest vitroRequest;
private Log log;
- public CoAuthorshipQueryRunner(String egoURI,
- RDFService rdfService, Log log) {
+ public CoAuthorshipQueryRunner(String egoURI, VitroRequest vreq, Log log) {
this.egoURI = egoURI;
- this.rdfService = rdfService;
+ this.rdfService = vreq.getRDFService();
+ this.vitroRequest = vreq;
this.log = log;
}
@@ -541,6 +545,10 @@ private synchronized CoAuthorshipData getQueryResultAndCache()
}
}
+ if (consumer.egoNode == null) {
+ consumer.egoNode = makeEgoNode();
+ }
+
data = consumer.getCollaborationData();
if (cacheTime != null) {
data.setBuiltFromCacheTime(cacheTime);
@@ -561,6 +569,13 @@ private synchronized CoAuthorshipData getQueryResultAndCache()
return data;
}
+ private Collaborator makeEgoNode() {
+ Collaborator collab = new Collaborator(egoURI, new UniqueIDGenerator());
+ collab.setCollaboratorName(UtilityFunctions.getIndividualLabelFromDAO(vitroRequest, egoURI));
+
+ return collab;
+ }
+
private synchronized void expireCache() {
for (String key : collaborationDataCache.keySet()) {
CollaborationDataCacheEntry entry = collaborationDataCache.get(key);
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipRequestHandler.java
index a938ba81b..032fe2800 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipRequestHandler.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/CoAuthorshipRequestHandler.java
@@ -65,7 +65,7 @@ public Map generateDataVisualization(
.VIS_MODE_KEY);
CoAuthorshipQueryRunner queryManager =
- new CoAuthorshipQueryRunner(egoURI, vitroRequest.getRDFService(), log);
+ new CoAuthorshipQueryRunner(egoURI, vitroRequest, log);
CollaborationData authorNodesAndEdges =
queryManager.getQueryResult();
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountQueryRunner.java
index 4c2d9d7c5..07dd3f025 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountQueryRunner.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountQueryRunner.java
@@ -12,9 +12,11 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
import edu.cornell.mannlib.vitro.webapp.rdfservice.ResultSetConsumer;
+import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -50,6 +52,7 @@ public class CoPIGrantCountQueryRunner implements QueryRunner
private String egoURI;
private RDFService rdfService;
+ private VitroRequest vitroRequest;
private Log log = LogFactory.getLog(CoPIGrantCountQueryRunner.class.getName());
@@ -78,11 +81,11 @@ public class CoPIGrantCountQueryRunner implements QueryRunner
+ "}";
- public CoPIGrantCountQueryRunner(String egoURI,
- RDFService rdfService, Log log) {
+ public CoPIGrantCountQueryRunner(String egoURI, VitroRequest vreq, Log log) {
this.egoURI = egoURI;
- this.rdfService = rdfService;
+ this.rdfService = vreq.getRDFService();
+ this.vitroRequest = vreq;
// this.log = log;
}
@@ -283,6 +286,9 @@ private synchronized CoInvestigationData getQueryResultAndCache()
try {
QueryResultConsumer consumer = new QueryResultConsumer();
rdfService.sparqlSelectQuery(generateEgoCoPIquery(this.egoURI), consumer);
+ if (consumer.egoNode == null) {
+ consumer.egoNode = makeEgoNode();
+ }
data = consumer.getData();
} catch (RDFServiceException e) {
log.error("Unable to execute query", e);
@@ -306,6 +312,13 @@ private synchronized CoInvestigationData getQueryResultAndCache()
return data;
}
+ private Collaborator makeEgoNode() {
+ Collaborator collab = new Collaborator(egoURI, new UniqueIDGenerator());
+ collab.setCollaboratorName(UtilityFunctions.getIndividualLabelFromDAO(vitroRequest, egoURI));
+
+ return collab;
+ }
+
private synchronized void expireCache() {
for (String key : collaborationDataCache.keySet()) {
CollaborationDataCacheEntry entry = collaborationDataCache.get(key);
@@ -656,6 +669,7 @@ private String getEdgeUniqueIdentifier(int nodeID1, int nodeID2) {
}
}
+
/** END QUERY RESULT CONSUMER **/
}
}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountRequestHandler.java
index 4804a0098..46b030884 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountRequestHandler.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountRequestHandler.java
@@ -58,7 +58,7 @@ public Map generateDataVisualization(
Model constructedModel = constructQueryRunner.getConstructedModel();
QueryRunner queryManager =
- new CoPIGrantCountQueryRunner(egoURI, vitroRequest.getRDFService(), log);
+ new CoPIGrantCountQueryRunner(egoURI, vitroRequest, log);
CollaborationData investigatorNodesAndEdges = queryManager.getQueryResult();
diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/personlevel/PersonLevelRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/personlevel/PersonLevelRequestHandler.java
index 289d9f650..273d25fc6 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/visualization/personlevel/PersonLevelRequestHandler.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/personlevel/PersonLevelRequestHandler.java
@@ -105,19 +105,10 @@ private ResponseValues generateStandardVisualizationForPersonLevelVis(
String visMode) throws MalformedQueryParametersException {
if (VisualizationFrameworkConstants.COPI_VIS_MODE.equalsIgnoreCase(visMode)) {
- CoPIGrantCountQueryRunner coPIQueryManager = new CoPIGrantCountQueryRunner(egoURI, vitroRequest.getRDFService(), log);
+ CoPIGrantCountQueryRunner coPIQueryManager = new CoPIGrantCountQueryRunner(egoURI, vitroRequest, log);
CoInvestigationData coPIData = coPIQueryManager.getQueryResult();
- /*
- * grants over time sparkline
- */
- SubEntity person = new SubEntity(egoURI,
- UtilityFunctions
- .getIndividualLabelFromDAO(vitroRequest, egoURI));
-
-// Map grantsToURI = SelectOnModelUtilities.getGrantsForPerson(vitroRequest.getRDFService(), person, false);
-
Map grantsToURI = coPIData.getGrants();
/*
@@ -136,8 +127,7 @@ private ResponseValues generateStandardVisualizationForPersonLevelVis(
yearToGrantCount,
log);
- SparklineData grantSparklineVO = personGrantCountVisCodeGenerator
- .getValueObjectContainer();
+ SparklineData grantSparklineVO = personGrantCountVisCodeGenerator.getValueObjectContainer();
/*
@@ -151,10 +141,8 @@ private ResponseValues generateStandardVisualizationForPersonLevelVis(
UtilityFunctions.getActivityYearToCollaborators(coPIData),
log);
- SparklineData uniqueCopisSparklineVO = uniqueCopisVisCodeGenerator
- .getValueObjectContainer();
-
-
+ SparklineData uniqueCopisSparklineVO = uniqueCopisVisCodeGenerator.getValueObjectContainer();
+
return prepareCoPIStandaloneResponse(
egoURI,
grantSparklineVO,
@@ -165,7 +153,7 @@ private ResponseValues generateStandardVisualizationForPersonLevelVis(
} else {
CoAuthorshipQueryRunner coAuthorshipQueryManager =
- new CoAuthorshipQueryRunner(egoURI, vitroRequest.getRDFService(), log);
+ new CoAuthorshipQueryRunner(egoURI, vitroRequest, log);
CoAuthorshipData coAuthorshipData = coAuthorshipQueryManager.getQueryResult();