Small fix to having no collaborations in co-author and co-investigator networks.
This commit is contained in:
parent
6e173e5815
commit
f397d53ba2
7 changed files with 50 additions and 49 deletions
|
@ -246,15 +246,6 @@ $(document).ready(function(){
|
||||||
<div class="sub_headings"><h2><a href="${egoVivoProfileURL}" title="${i18n().author_name}"><span id="ego_label"></span></a><br />${i18n().co_author_network} </h2></div>
|
<div class="sub_headings"><h2><a href="${egoVivoProfileURL}" title="${i18n().author_name}"><span id="ego_label"></span></a><br />${i18n().co_author_network} </h2></div>
|
||||||
<#if (numOfCoAuthorShips?? && numOfCoAuthorShips > 0) || (numOfAuthors?? && numOfAuthors > 0) >
|
<#if (numOfCoAuthorShips?? && numOfCoAuthorShips > 0) || (numOfAuthors?? && numOfAuthors > 0) >
|
||||||
<div class = "graphml-file-link">(<a href="${egoCoAuthorshipNetworkDataFileURL}" title="GraphML ${i18n().file}">GraphML ${i18n().file}</a>)</div>
|
<div class = "graphml-file-link">(<a href="${egoCoAuthorshipNetworkDataFileURL}" title="GraphML ${i18n().file}">GraphML ${i18n().file}</a>)</div>
|
||||||
<#else>
|
|
||||||
|
|
||||||
<#if numOfAuthors?? && numOfAuthors <= 0 >
|
|
||||||
<#assign authorsText = "multi-author" />
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
<div id="no_coauthorships">${i18n().currently_no_papers_for(authorsText!)}
|
|
||||||
<a href="${egoVivoProfileURL}" title="${i18n().co_authorship}"><span id="no_coauthorships_person" class="author_name">${i18n().this_author}</span></a> ${i18n().in_the_vivo_db}
|
|
||||||
</div>
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<div class = "toggle_visualization">
|
<div class = "toggle_visualization">
|
||||||
|
|
|
@ -254,23 +254,8 @@ $(document).ready(function(){
|
||||||
|
|
||||||
<#if (numOfCoInvestigations?? && numOfCoInvestigations > 0) || (numOfInvestigators?? && numOfInvestigators > 0) >
|
<#if (numOfCoInvestigations?? && numOfCoInvestigations > 0) || (numOfInvestigators?? && numOfInvestigators > 0) >
|
||||||
<div class = "graphml-file-link"><a href="${egoCoInvestigationNetworkDataFileURL}" title="${i18n().co_investigator}">(GraphML ${i18n().file_capitalized})</a></div>
|
<div class = "graphml-file-link"><a href="${egoCoInvestigationNetworkDataFileURL}" title="${i18n().co_investigator}">(GraphML ${i18n().file_capitalized})</a></div>
|
||||||
<#else>
|
|
||||||
|
|
||||||
<#if numOfInvestigators?? && numOfInvestigators <= 0 >
|
|
||||||
<#assign investigatorsText = "multi-investigator" />
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<span id="no_coinvestigations">${i18n().currently_no_grants_for(investigatorsText!)}
|
|
||||||
<a href="${egoVivoProfileURL}" title="${i18n().investigator_name}"><span id="no_coinvestigations_person" class="investigator_name">${i18n().this_investigator}</span></a> ${i18n().in_the_vivo_db}
|
|
||||||
</span>
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
<#else>
|
|
||||||
|
|
||||||
<span id="no_coinvestigations">${i18n().no_grants_for}
|
|
||||||
<a href="${egoVivoProfileURL}" title="${i18n().co_investigator}"><span id="no_coinvestigations_person" class="investigator_name">${i18n().this_investigator}</span></a> ${i18n().in_the_vivo_db}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<div class = "toggle_visualization">
|
<div class = "toggle_visualization">
|
||||||
|
@ -290,6 +275,14 @@ $(document).ready(function(){
|
||||||
<div id="bodyPannel">
|
<div id="bodyPannel">
|
||||||
<div id="chord" style="float: right;"></div>
|
<div id="chord" style="float: right;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<#else>
|
||||||
|
<#if numOfInvestigators?? && numOfInvestigators <= 0 >
|
||||||
|
<#assign investigatorsText = "multi-investigator" />
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<span id="no_coinvestigations">${i18n().currently_no_grants_for(investigatorsText!)}
|
||||||
|
<a href="${egoVivoProfileURL}" title="${i18n().investigator_name}"><span id="no_coinvestigations_person" class="investigator_name">${i18n().this_investigator}</span></a> ${i18n().in_the_vivo_db}
|
||||||
|
</span>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,12 @@ import com.hp.hpl.jena.query.QueryExecution;
|
||||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
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.RDFService;
|
||||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
|
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.ResultSetConsumer;
|
import edu.cornell.mannlib.vitro.webapp.rdfservice.ResultSetConsumer;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.utilities.VisualizationCaches;
|
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.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.jena.iri.IRI;
|
import org.apache.jena.iri.IRI;
|
||||||
|
@ -60,13 +62,15 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
||||||
|
|
||||||
private RDFService rdfService;
|
private RDFService rdfService;
|
||||||
|
|
||||||
|
private VitroRequest vitroRequest;
|
||||||
|
|
||||||
private Log log;
|
private Log log;
|
||||||
|
|
||||||
public CoAuthorshipQueryRunner(String egoURI,
|
public CoAuthorshipQueryRunner(String egoURI, VitroRequest vreq, Log log) {
|
||||||
RDFService rdfService, Log log) {
|
|
||||||
|
|
||||||
this.egoURI = egoURI;
|
this.egoURI = egoURI;
|
||||||
this.rdfService = rdfService;
|
this.rdfService = vreq.getRDFService();
|
||||||
|
this.vitroRequest = vreq;
|
||||||
this.log = log;
|
this.log = log;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -541,6 +545,10 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (consumer.egoNode == null) {
|
||||||
|
consumer.egoNode = makeEgoNode();
|
||||||
|
}
|
||||||
|
|
||||||
data = consumer.getCollaborationData();
|
data = consumer.getCollaborationData();
|
||||||
if (cacheTime != null) {
|
if (cacheTime != null) {
|
||||||
data.setBuiltFromCacheTime(cacheTime);
|
data.setBuiltFromCacheTime(cacheTime);
|
||||||
|
@ -561,6 +569,13 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Collaborator makeEgoNode() {
|
||||||
|
Collaborator collab = new Collaborator(egoURI, new UniqueIDGenerator());
|
||||||
|
collab.setCollaboratorName(UtilityFunctions.getIndividualLabelFromDAO(vitroRequest, egoURI));
|
||||||
|
|
||||||
|
return collab;
|
||||||
|
}
|
||||||
|
|
||||||
private synchronized void expireCache() {
|
private synchronized void expireCache() {
|
||||||
for (String key : collaborationDataCache.keySet()) {
|
for (String key : collaborationDataCache.keySet()) {
|
||||||
CollaborationDataCacheEntry entry = collaborationDataCache.get(key);
|
CollaborationDataCacheEntry entry = collaborationDataCache.get(key);
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
|
||||||
.VIS_MODE_KEY);
|
.VIS_MODE_KEY);
|
||||||
|
|
||||||
CoAuthorshipQueryRunner queryManager =
|
CoAuthorshipQueryRunner queryManager =
|
||||||
new CoAuthorshipQueryRunner(egoURI, vitroRequest.getRDFService(), log);
|
new CoAuthorshipQueryRunner(egoURI, vitroRequest, log);
|
||||||
|
|
||||||
CollaborationData authorNodesAndEdges =
|
CollaborationData authorNodesAndEdges =
|
||||||
queryManager.getQueryResult();
|
queryManager.getQueryResult();
|
||||||
|
|
|
@ -12,9 +12,11 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
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.RDFService;
|
||||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
|
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.ResultSetConsumer;
|
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.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -50,6 +52,7 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
private String egoURI;
|
private String egoURI;
|
||||||
|
|
||||||
private RDFService rdfService;
|
private RDFService rdfService;
|
||||||
|
private VitroRequest vitroRequest;
|
||||||
|
|
||||||
private Log log = LogFactory.getLog(CoPIGrantCountQueryRunner.class.getName());
|
private Log log = LogFactory.getLog(CoPIGrantCountQueryRunner.class.getName());
|
||||||
|
|
||||||
|
@ -78,11 +81,11 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
+ "}";
|
+ "}";
|
||||||
|
|
||||||
|
|
||||||
public CoPIGrantCountQueryRunner(String egoURI,
|
public CoPIGrantCountQueryRunner(String egoURI, VitroRequest vreq, Log log) {
|
||||||
RDFService rdfService, Log log) {
|
|
||||||
|
|
||||||
this.egoURI = egoURI;
|
this.egoURI = egoURI;
|
||||||
this.rdfService = rdfService;
|
this.rdfService = vreq.getRDFService();
|
||||||
|
this.vitroRequest = vreq;
|
||||||
// this.log = log;
|
// this.log = log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,6 +286,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
try {
|
try {
|
||||||
QueryResultConsumer consumer = new QueryResultConsumer();
|
QueryResultConsumer consumer = new QueryResultConsumer();
|
||||||
rdfService.sparqlSelectQuery(generateEgoCoPIquery(this.egoURI), consumer);
|
rdfService.sparqlSelectQuery(generateEgoCoPIquery(this.egoURI), consumer);
|
||||||
|
if (consumer.egoNode == null) {
|
||||||
|
consumer.egoNode = makeEgoNode();
|
||||||
|
}
|
||||||
data = consumer.getData();
|
data = consumer.getData();
|
||||||
} catch (RDFServiceException e) {
|
} catch (RDFServiceException e) {
|
||||||
log.error("Unable to execute query", e);
|
log.error("Unable to execute query", e);
|
||||||
|
@ -306,6 +312,13 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Collaborator makeEgoNode() {
|
||||||
|
Collaborator collab = new Collaborator(egoURI, new UniqueIDGenerator());
|
||||||
|
collab.setCollaboratorName(UtilityFunctions.getIndividualLabelFromDAO(vitroRequest, egoURI));
|
||||||
|
|
||||||
|
return collab;
|
||||||
|
}
|
||||||
|
|
||||||
private synchronized void expireCache() {
|
private synchronized void expireCache() {
|
||||||
for (String key : collaborationDataCache.keySet()) {
|
for (String key : collaborationDataCache.keySet()) {
|
||||||
CollaborationDataCacheEntry entry = collaborationDataCache.get(key);
|
CollaborationDataCacheEntry entry = collaborationDataCache.get(key);
|
||||||
|
@ -656,6 +669,7 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** END QUERY RESULT CONSUMER **/
|
/** END QUERY RESULT CONSUMER **/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class CoPIGrantCountRequestHandler implements VisualizationRequestHandler
|
||||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||||
|
|
||||||
QueryRunner<CollaborationData> queryManager =
|
QueryRunner<CollaborationData> queryManager =
|
||||||
new CoPIGrantCountQueryRunner(egoURI, vitroRequest.getRDFService(), log);
|
new CoPIGrantCountQueryRunner(egoURI, vitroRequest, log);
|
||||||
|
|
||||||
CollaborationData investigatorNodesAndEdges = queryManager.getQueryResult();
|
CollaborationData investigatorNodesAndEdges = queryManager.getQueryResult();
|
||||||
|
|
||||||
|
|
|
@ -105,19 +105,10 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
String visMode) throws MalformedQueryParametersException {
|
String visMode) throws MalformedQueryParametersException {
|
||||||
|
|
||||||
if (VisualizationFrameworkConstants.COPI_VIS_MODE.equalsIgnoreCase(visMode)) {
|
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();
|
CoInvestigationData coPIData = coPIQueryManager.getQueryResult();
|
||||||
|
|
||||||
/*
|
|
||||||
* grants over time sparkline
|
|
||||||
*/
|
|
||||||
SubEntity person = new SubEntity(egoURI,
|
|
||||||
UtilityFunctions
|
|
||||||
.getIndividualLabelFromDAO(vitroRequest, egoURI));
|
|
||||||
|
|
||||||
// Map<String, Activity> grantsToURI = SelectOnModelUtilities.getGrantsForPerson(vitroRequest.getRDFService(), person, false);
|
|
||||||
|
|
||||||
Map<String, Activity> grantsToURI = coPIData.getGrants();
|
Map<String, Activity> grantsToURI = coPIData.getGrants();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -136,8 +127,7 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
yearToGrantCount,
|
yearToGrantCount,
|
||||||
log);
|
log);
|
||||||
|
|
||||||
SparklineData grantSparklineVO = personGrantCountVisCodeGenerator
|
SparklineData grantSparklineVO = personGrantCountVisCodeGenerator.getValueObjectContainer();
|
||||||
.getValueObjectContainer();
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -151,9 +141,7 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
UtilityFunctions.getActivityYearToCollaborators(coPIData),
|
UtilityFunctions.getActivityYearToCollaborators(coPIData),
|
||||||
log);
|
log);
|
||||||
|
|
||||||
SparklineData uniqueCopisSparklineVO = uniqueCopisVisCodeGenerator
|
SparklineData uniqueCopisSparklineVO = uniqueCopisVisCodeGenerator.getValueObjectContainer();
|
||||||
.getValueObjectContainer();
|
|
||||||
|
|
||||||
|
|
||||||
return prepareCoPIStandaloneResponse(
|
return prepareCoPIStandaloneResponse(
|
||||||
egoURI,
|
egoURI,
|
||||||
|
@ -165,7 +153,7 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
CoAuthorshipQueryRunner coAuthorshipQueryManager =
|
CoAuthorshipQueryRunner coAuthorshipQueryManager =
|
||||||
new CoAuthorshipQueryRunner(egoURI, vitroRequest.getRDFService(), log);
|
new CoAuthorshipQueryRunner(egoURI, vitroRequest, log);
|
||||||
|
|
||||||
CoAuthorshipData coAuthorshipData = coAuthorshipQueryManager.getQueryResult();
|
CoAuthorshipData coAuthorshipData = coAuthorshipQueryManager.getQueryResult();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue