1. Improved logic in data response for temporal graphs.
2. Fixed a performance problem with co-investigator network visualization.
This commit is contained in:
parent
88929f9cad
commit
40245b1a91
8 changed files with 269 additions and 467 deletions
|
@ -1,253 +0,0 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.persongrantcount;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
import com.hp.hpl.jena.iri.IRI;
|
|
||||||
import com.hp.hpl.jena.iri.IRIFactory;
|
|
||||||
import com.hp.hpl.jena.iri.Violation;
|
|
||||||
import com.hp.hpl.jena.query.Dataset;
|
|
||||||
import com.hp.hpl.jena.query.Query;
|
|
||||||
import com.hp.hpl.jena.query.QueryExecution;
|
|
||||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
|
||||||
import com.hp.hpl.jena.query.QueryFactory;
|
|
||||||
import com.hp.hpl.jena.query.QuerySolution;
|
|
||||||
import com.hp.hpl.jena.query.ResultSet;
|
|
||||||
import com.hp.hpl.jena.query.Syntax;
|
|
||||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Individual;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This query runner is used to execute Sparql query that will fetch all the grants for an
|
|
||||||
* individual.
|
|
||||||
* @author bkoniden
|
|
||||||
* Deepak Konidena
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PersonGrantCountQueryRunner implements QueryRunner<Set<Activity>> {
|
|
||||||
|
|
||||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
|
||||||
|
|
||||||
private String personURI;
|
|
||||||
private Dataset dataset;
|
|
||||||
private Individual principalInvestigator;
|
|
||||||
|
|
||||||
public Individual getPrincipalInvestigator() {
|
|
||||||
return principalInvestigator;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Log log;
|
|
||||||
|
|
||||||
private static final String SPARQL_QUERY_COMMON_SELECT_CLAUSE = ""
|
|
||||||
+ " SELECT (str(?PILabel) as ?PILabelLit) "
|
|
||||||
+ " (str(?Grant) as ?grantLit)"
|
|
||||||
+ " (str(?GrantLabel) as ?grantLabelLit)"
|
|
||||||
+ " (str(?startDateTimeValue) as ?grantStartDateLit) "
|
|
||||||
+ " (str(?endDateTimeValue) as ?grantEndDateLit) "
|
|
||||||
+ " (str(?startDateTimeValueForGrant) as ?grantStartDateForGrantLit) "
|
|
||||||
+ " (str(?endDateTimeValueForGrant) as ?grantEndDateForGrantLit) ";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final String SPARQL_QUERY_COMMON_OPTIONAL_BLOCK_FOR_ROLE_DATE_TIME = ""
|
|
||||||
+ "OPTIONAL {"
|
|
||||||
+ " ?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
|
||||||
+ "?dateTimeIntervalValue core:start ?startDate . "
|
|
||||||
+ "?startDate core:dateTime ?startDateTimeValue . "
|
|
||||||
+ "OPTIONAL {"
|
|
||||||
+ "?dateTimeIntervalValue core:end ?endDate . "
|
|
||||||
+ "?endDate core:dateTime ?endDateTimeValue . "
|
|
||||||
+ "}"
|
|
||||||
+ "} . ";
|
|
||||||
|
|
||||||
private static final String SPARQL_QUERY_COMMON_OPTIONAL_BLOCK_FOR_GRANT_DATE_TIME = ""
|
|
||||||
+ "OPTIONAL {"
|
|
||||||
+ " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
|
||||||
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
|
||||||
+ "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
|
|
||||||
+ "OPTIONAL {"
|
|
||||||
+ "?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
|
|
||||||
+ "?endDateForGrant core:dateTime ?endDateTimeValueForGrant . "
|
|
||||||
+ "}"
|
|
||||||
+ "}";
|
|
||||||
|
|
||||||
|
|
||||||
public PersonGrantCountQueryRunner(String personURI, Dataset dataset, Log log) {
|
|
||||||
|
|
||||||
this.personURI = personURI;
|
|
||||||
this.dataset = dataset;
|
|
||||||
this.log = log;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Set<Activity> createJavaValueObjects(ResultSet resultSet) {
|
|
||||||
Set<Activity> grants = new HashSet<Activity>();
|
|
||||||
|
|
||||||
while (resultSet.hasNext()) {
|
|
||||||
QuerySolution solution = resultSet.nextSolution();
|
|
||||||
|
|
||||||
Activity grant = new Activity(solution.get(QueryFieldLabels.GRANT_URL).toString());
|
|
||||||
|
|
||||||
RDFNode grantLabelNode = solution.get(QueryFieldLabels.GRANT_LABEL);
|
|
||||||
if (grantLabelNode != null) {
|
|
||||||
grant.setIndividualLabel(grantLabelNode.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
RDFNode grantStartDateNode = solution.get(QueryFieldLabels.ROLE_START_DATE);
|
|
||||||
if (grantStartDateNode != null) {
|
|
||||||
grant.setActivityDate(grantStartDateNode.toString());
|
|
||||||
} else {
|
|
||||||
grantStartDateNode = solution.get(QueryFieldLabels.GRANT_START_DATE);
|
|
||||||
if (grantStartDateNode != null) {
|
|
||||||
grant.setActivityDate(grantStartDateNode.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: verify grant end date is used or not.
|
|
||||||
/*
|
|
||||||
RDFNode grantEndDateNode = solution.get(QueryFieldLabels.ROLE_END_DATE);
|
|
||||||
if(grantEndDateNode != null){
|
|
||||||
grant.setGrantEndDate(grantEndDateNode.toString());
|
|
||||||
}else {
|
|
||||||
grantEndDateNode = solution.get(QueryFieldLabels.GRANT_END_DATE);
|
|
||||||
if(grantEndDateNode != null){
|
|
||||||
grant.setGrantEndDate(grantEndDateNode.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Since we are getting grant count for just one PI at a time we need
|
|
||||||
* to create only one "Individual" instance. We test against the null for "PI" to
|
|
||||||
* make sure that it has not already been instantiated.
|
|
||||||
* */
|
|
||||||
RDFNode investigatorURINode = solution.get(QueryFieldLabels.PI_URL);
|
|
||||||
if (investigatorURINode != null && principalInvestigator == null) {
|
|
||||||
principalInvestigator = new Individual(investigatorURINode.toString());
|
|
||||||
RDFNode investigatorLabelNode = solution.get(QueryFieldLabels.PI_LABEL);
|
|
||||||
if (investigatorLabelNode != null) {
|
|
||||||
principalInvestigator.setIndividualLabel(investigatorLabelNode.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grants.add(grant);
|
|
||||||
}
|
|
||||||
return grants;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ResultSet executeQuery(String queryURI, Dataset dataset) {
|
|
||||||
|
|
||||||
QueryExecution queryExecution = null;
|
|
||||||
|
|
||||||
Query query = QueryFactory.create(getSparqlQuery(queryURI), SYNTAX);
|
|
||||||
queryExecution = QueryExecutionFactory.create(query, dataset);
|
|
||||||
|
|
||||||
return queryExecution.execSelect();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String getSparqlQuery(String queryURI) {
|
|
||||||
|
|
||||||
String sparqlQuery = QueryConstants.getSparqlPrefixQuery()
|
|
||||||
|
|
||||||
+ SPARQL_QUERY_COMMON_SELECT_CLAUSE
|
|
||||||
|
|
||||||
+ "(str(<" + queryURI + ">) as ?PILit) "
|
|
||||||
|
|
||||||
+ "WHERE "
|
|
||||||
+ "{ "
|
|
||||||
+ "<" + queryURI + "> rdfs:label ?PILabel . "
|
|
||||||
+ "{ "
|
|
||||||
|
|
||||||
+ "<" + queryURI + "> core:hasCo-PrincipalInvestigatorRole ?Role . "
|
|
||||||
|
|
||||||
+ "?Role core:roleIn ?Grant . "
|
|
||||||
|
|
||||||
+ "?Grant rdfs:label ?GrantLabel . "
|
|
||||||
|
|
||||||
+ SPARQL_QUERY_COMMON_OPTIONAL_BLOCK_FOR_ROLE_DATE_TIME
|
|
||||||
|
|
||||||
+ SPARQL_QUERY_COMMON_OPTIONAL_BLOCK_FOR_GRANT_DATE_TIME
|
|
||||||
|
|
||||||
+ "} "
|
|
||||||
|
|
||||||
+ "UNION "
|
|
||||||
|
|
||||||
+ "{ "
|
|
||||||
|
|
||||||
+ "<" + queryURI + "> core:hasPrincipalInvestigatorRole ?Role . "
|
|
||||||
|
|
||||||
+ "?Role core:roleIn ?Grant . "
|
|
||||||
|
|
||||||
+ "?Grant rdfs:label ?GrantLabel . "
|
|
||||||
|
|
||||||
+ SPARQL_QUERY_COMMON_OPTIONAL_BLOCK_FOR_ROLE_DATE_TIME
|
|
||||||
|
|
||||||
+ SPARQL_QUERY_COMMON_OPTIONAL_BLOCK_FOR_GRANT_DATE_TIME
|
|
||||||
|
|
||||||
|
|
||||||
+ "} "
|
|
||||||
|
|
||||||
+ "UNION "
|
|
||||||
|
|
||||||
+ "{ "
|
|
||||||
|
|
||||||
+ "<" + queryURI + "> core:hasInvestigatorRole ?Role . "
|
|
||||||
|
|
||||||
+ "?Role core:roleIn ?Grant . "
|
|
||||||
|
|
||||||
+ "?Grant rdfs:label ?GrantLabel . "
|
|
||||||
|
|
||||||
+ SPARQL_QUERY_COMMON_OPTIONAL_BLOCK_FOR_ROLE_DATE_TIME
|
|
||||||
|
|
||||||
+ SPARQL_QUERY_COMMON_OPTIONAL_BLOCK_FOR_GRANT_DATE_TIME
|
|
||||||
|
|
||||||
|
|
||||||
+ "} "
|
|
||||||
|
|
||||||
+ "} ";
|
|
||||||
|
|
||||||
log.debug("SPARQL query for person grant count -> \n" + sparqlQuery);
|
|
||||||
//System.out.println("SPARQL query for person grant count -> \n"+ sparqlQuery);
|
|
||||||
|
|
||||||
return sparqlQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Activity> getQueryResult() throws MalformedQueryParametersException {
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(this.personURI)) {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To test the validity of the URI submitted
|
|
||||||
*/
|
|
||||||
IRIFactory iriFactory = IRIFactory.jenaImplementation();
|
|
||||||
IRI iri = iriFactory.create(this.personURI);
|
|
||||||
|
|
||||||
if (iri.hasViolation(false)) {
|
|
||||||
String errorMsg = ((Violation) iri.violations(false).next()).getShortMessage();
|
|
||||||
log.error("Grant Count vis Query " + errorMsg);
|
|
||||||
throw new MalformedQueryParametersException(
|
|
||||||
"URI provided for an individual is malformed.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new MalformedQueryParametersException("URL parameter is either null or empty.");
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultSet resultSet = executeQuery(this.personURI, this.dataset);
|
|
||||||
|
|
||||||
return createJavaValueObjects(resultSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,10 +5,8 @@ package edu.cornell.mannlib.vitro.webapp.visualization.persongrantcount;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import com.hp.hpl.jena.query.Dataset;
|
import com.hp.hpl.jena.query.Dataset;
|
||||||
|
@ -21,9 +19,9 @@ import edu.cornell.mannlib.vitro.webapp.controller.visualization.DataVisualizati
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationFrameworkConstants;
|
import edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationFrameworkConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Individual;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SparklineData;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SparklineData;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SubEntity;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.SelectOnModelUtilities;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.VisualizationRequestHandler;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.VisualizationRequestHandler;
|
||||||
|
|
||||||
|
@ -53,23 +51,21 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
||||||
String personURI = vitroRequest
|
String personURI = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||||
|
|
||||||
QueryRunner<Set<Activity>> queryManager =
|
SubEntity person = new SubEntity(
|
||||||
new PersonGrantCountQueryRunner(personURI, dataset, log);
|
personURI,
|
||||||
|
UtilityFunctions.getIndividualLabelFromDAO(vitroRequest, personURI));
|
||||||
|
|
||||||
|
Map<String, Activity> grantsToURI = SelectOnModelUtilities.getGrantsForPerson(dataset, person, false);
|
||||||
|
|
||||||
Set<Activity> piGrants = queryManager.getQueryResult();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a map from the year to number of grants. Use the Grant's
|
* Create a map from the year to number of grants. Use the Grant's
|
||||||
* parsedGrantYear to populate the data.
|
* parsedGrantYear to populate the data.
|
||||||
* */
|
* */
|
||||||
Map<String, Integer> yearToGrantCount =
|
Map<String, Integer> yearToGrantCount =
|
||||||
UtilityFunctions.getYearToActivityCount(piGrants);
|
UtilityFunctions.getYearToActivityCount(grantsToURI.values());
|
||||||
|
|
||||||
Individual investigator = ((PersonGrantCountQueryRunner) queryManager)
|
return prepareDataResponse(person,
|
||||||
.getPrincipalInvestigator();
|
|
||||||
|
|
||||||
return prepareDataResponse(investigator,
|
|
||||||
piGrants,
|
|
||||||
yearToGrantCount);
|
yearToGrantCount);
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,17 +92,18 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
||||||
String visContainer = vitroRequest
|
String visContainer = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.VIS_CONTAINER_KEY);
|
.getParameter(VisualizationFrameworkConstants.VIS_CONTAINER_KEY);
|
||||||
|
|
||||||
QueryRunner<Set<Activity>> queryManager =
|
SubEntity person = new SubEntity(
|
||||||
new PersonGrantCountQueryRunner(personURI, dataset, log);
|
personURI,
|
||||||
|
UtilityFunctions.getIndividualLabelFromDAO(vitroRequest, personURI));
|
||||||
|
|
||||||
Set<Activity> piGrants = queryManager.getQueryResult();
|
Map<String, Activity> grantsToURI = SelectOnModelUtilities.getGrantsForPerson(dataset, person, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a map from the year to number of grants. Use the Grant's
|
* Create a map from the year to number of grants. Use the Grant's
|
||||||
* parsedGrantYear to populate the data.
|
* parsedGrantYear to populate the data.
|
||||||
* */
|
* */
|
||||||
Map<String, Integer> yearToGrantCount =
|
Map<String, Integer> yearToGrantCount =
|
||||||
UtilityFunctions.getYearToActivityCount(piGrants);
|
UtilityFunctions.getYearToActivityCount(grantsToURI.values());
|
||||||
|
|
||||||
|
|
||||||
boolean shouldVIVOrenderVis = yearToGrantCount.size() > 0 ? true : false;
|
boolean shouldVIVOrenderVis = yearToGrantCount.size() > 0 ? true : false;
|
||||||
|
@ -146,17 +143,18 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
||||||
String visContainer = vitroRequest
|
String visContainer = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.VIS_CONTAINER_KEY);
|
.getParameter(VisualizationFrameworkConstants.VIS_CONTAINER_KEY);
|
||||||
|
|
||||||
QueryRunner<Set<Activity>> queryManager =
|
SubEntity person = new SubEntity(
|
||||||
new PersonGrantCountQueryRunner(personURI, dataset, log);
|
personURI,
|
||||||
|
UtilityFunctions.getIndividualLabelFromDAO(vitroRequest, personURI));
|
||||||
|
|
||||||
Set<Activity> piGrants = queryManager.getQueryResult();
|
Map<String, Activity> grantsToURI = SelectOnModelUtilities.getGrantsForPerson(dataset, person, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a map from the year to number of grants. Use the Grant's
|
* Create a map from the year to number of grants. Use the Grant's
|
||||||
* parsedGrantYear to populate the data.
|
* parsedGrantYear to populate the data.
|
||||||
* */
|
* */
|
||||||
Map<String, Integer> yearToGrantCount =
|
Map<String, Integer> yearToGrantCount =
|
||||||
UtilityFunctions.getYearToActivityCount(piGrants);
|
UtilityFunctions.getYearToActivityCount(grantsToURI.values());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Computations required to generate HTML for the sparkline & related context.
|
* Computations required to generate HTML for the sparkline & related context.
|
||||||
|
@ -195,32 +193,14 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
||||||
* Provides response when csv file containing the grant count over the years
|
* Provides response when csv file containing the grant count over the years
|
||||||
* is requested.
|
* is requested.
|
||||||
* @param investigator
|
* @param investigator
|
||||||
* @param piGrants
|
|
||||||
* @param yearToGrantCount
|
* @param yearToGrantCount
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String, String> prepareDataResponse(
|
private Map<String, String> prepareDataResponse(
|
||||||
Individual investigator,
|
SubEntity investigator,
|
||||||
Set<Activity> piGrants,
|
|
||||||
Map<String, Integer> yearToGrantCount) {
|
Map<String, Integer> yearToGrantCount) {
|
||||||
|
|
||||||
|
String piName = investigator.getIndividualLabel();
|
||||||
String piName = null;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To protect against cases where there are no PI grants associated with the
|
|
||||||
* individual.
|
|
||||||
* */
|
|
||||||
if (piGrants.size() > 0) {
|
|
||||||
piName = investigator.getIndividualLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To make sure that null/empty records for PI names do not cause any mischief.
|
|
||||||
* */
|
|
||||||
if (StringUtils.isBlank(piName)) {
|
|
||||||
piName = "no-principal-investigator";
|
|
||||||
}
|
|
||||||
|
|
||||||
String outputFileName = UtilityFunctions.slugify(piName)
|
String outputFileName = UtilityFunctions.slugify(piName)
|
||||||
+ "_grants-per-year" + ".csv";
|
+ "_grants-per-year" + ".csv";
|
||||||
|
|
|
@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.visualization.personlevel;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -23,14 +22,14 @@ import edu.cornell.mannlib.vitro.webapp.visualization.coprincipalinvestigator.Co
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.coprincipalinvestigator.CoPIGrantCountQueryRunner;
|
import edu.cornell.mannlib.vitro.webapp.visualization.coprincipalinvestigator.CoPIGrantCountQueryRunner;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.coprincipalinvestigator.CoPIVisCodeGenerator;
|
import edu.cornell.mannlib.vitro.webapp.visualization.coprincipalinvestigator.CoPIVisCodeGenerator;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.persongrantcount.PersonGrantCountQueryRunner;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.persongrantcount.PersonGrantCountVisCodeGenerator;
|
import edu.cornell.mannlib.vitro.webapp.visualization.persongrantcount.PersonGrantCountVisCodeGenerator;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.personpubcount.PersonPublicationCountQueryRunner;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.personpubcount.PersonPublicationCountVisCodeGenerator;
|
import edu.cornell.mannlib.vitro.webapp.visualization.personpubcount.PersonPublicationCountVisCodeGenerator;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SparklineData;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SparklineData;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SubEntity;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.SelectOnModelUtilities;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UtilityFunctions;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.VisualizationRequestHandler;
|
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.VisualizationRequestHandler;
|
||||||
|
|
||||||
|
@ -102,6 +101,8 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
|
|
||||||
if (VisualizationFrameworkConstants.COPI_VIS_MODE.equalsIgnoreCase(visMode)) {
|
if (VisualizationFrameworkConstants.COPI_VIS_MODE.equalsIgnoreCase(visMode)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ModelConstructor constructQueryRunner =
|
ModelConstructor constructQueryRunner =
|
||||||
new CoPIGrantCountConstructQueryRunner(egoURI, dataset, log);
|
new CoPIGrantCountConstructQueryRunner(egoURI, dataset, log);
|
||||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||||
|
@ -109,23 +110,24 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
QueryRunner<CollaborationData> coPIQueryManager =
|
QueryRunner<CollaborationData> coPIQueryManager =
|
||||||
new CoPIGrantCountQueryRunner(egoURI, constructedModel, log);
|
new CoPIGrantCountQueryRunner(egoURI, constructedModel, log);
|
||||||
|
|
||||||
QueryRunner<Set<Activity>> grantQueryManager =
|
|
||||||
new PersonGrantCountQueryRunner(egoURI, dataset, log);
|
|
||||||
|
|
||||||
CollaborationData coPIData = coPIQueryManager.getQueryResult();
|
CollaborationData coPIData = coPIQueryManager.getQueryResult();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* grants over time sparkline
|
* grants over time sparkline
|
||||||
*/
|
*/
|
||||||
|
SubEntity person = new SubEntity(egoURI,
|
||||||
|
UtilityFunctions
|
||||||
|
.getIndividualLabelFromDAO(vitroRequest, egoURI));
|
||||||
|
|
||||||
Set<Activity> piGrants = grantQueryManager.getQueryResult();
|
Map<String, Activity> grantsToURI = SelectOnModelUtilities.getGrantsForPerson(dataset, person, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a map from the year to number of grants. Use the Grant's
|
* Create a map from the year to number of grants. Use the Grant's
|
||||||
* parsedGrantYear to populate the data.
|
* parsedGrantYear to populate the data.
|
||||||
* */
|
* */
|
||||||
Map<String, Integer> yearToGrantCount =
|
Map<String, Integer> yearToGrantCount =
|
||||||
UtilityFunctions.getYearToActivityCount(piGrants);
|
UtilityFunctions.getYearToActivityCount(grantsToURI.values());
|
||||||
|
|
||||||
|
|
||||||
PersonGrantCountVisCodeGenerator personGrantCountVisCodeGenerator =
|
PersonGrantCountVisCodeGenerator personGrantCountVisCodeGenerator =
|
||||||
new PersonGrantCountVisCodeGenerator(
|
new PersonGrantCountVisCodeGenerator(
|
||||||
|
@ -166,9 +168,6 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
QueryRunner<CollaborationData> coAuthorshipQueryManager =
|
QueryRunner<CollaborationData> coAuthorshipQueryManager =
|
||||||
new CoAuthorshipQueryRunner(egoURI, dataset, log);
|
new CoAuthorshipQueryRunner(egoURI, dataset, log);
|
||||||
|
|
||||||
QueryRunner<Set<Activity>> publicationQueryManager =
|
|
||||||
new PersonPublicationCountQueryRunner(egoURI, dataset, log);
|
|
||||||
|
|
||||||
CollaborationData coAuthorshipData = coAuthorshipQueryManager.getQueryResult();
|
CollaborationData coAuthorshipData = coAuthorshipQueryManager.getQueryResult();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -176,14 +175,18 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
||||||
* sparklines. This will prepare all the data for the sparklines & other requested
|
* sparklines. This will prepare all the data for the sparklines & other requested
|
||||||
* files.
|
* files.
|
||||||
* */
|
* */
|
||||||
Set<Activity> authorDocuments = publicationQueryManager.getQueryResult();
|
SubEntity person = new SubEntity(egoURI,
|
||||||
|
UtilityFunctions
|
||||||
|
.getIndividualLabelFromDAO(vitroRequest, egoURI));
|
||||||
|
|
||||||
|
Map<String, Activity> publicationsToURI = SelectOnModelUtilities.getPublicationsForPerson(dataset, person, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a map from the year to number of publications. Use the BiboDocument's
|
* Create a map from the year to number of publications. Use the BiboDocument's
|
||||||
* parsedPublicationYear to populate the data.
|
* parsedPublicationYear to populate the data.
|
||||||
* */
|
* */
|
||||||
Map<String, Integer> yearToPublicationCount =
|
Map<String, Integer> yearToPublicationCount =
|
||||||
UtilityFunctions.getYearToActivityCount(authorDocuments);
|
UtilityFunctions.getYearToActivityCount(publicationsToURI.values());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Computations required to generate HTML for the sparklines & related context.
|
* Computations required to generate HTML for the sparklines & related context.
|
||||||
|
|
|
@ -4,8 +4,8 @@ package edu.cornell.mannlib.vitro.webapp.visualization.personpubcount;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
|
@ -87,6 +87,8 @@ public class TemporalGrantVisualizationRequestHandler implements
|
||||||
String entityURI = vitroRequest
|
String entityURI = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||||
|
|
||||||
|
VisConstants.DataVisMode currentDataMode = VisConstants.DataVisMode.CSV;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This will provide the data in json format mainly used for standalone temporal vis.
|
* This will provide the data in json format mainly used for standalone temporal vis.
|
||||||
* */
|
* */
|
||||||
|
@ -94,39 +96,27 @@ public class TemporalGrantVisualizationRequestHandler implements
|
||||||
.equalsIgnoreCase(vitroRequest
|
.equalsIgnoreCase(vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(entityURI)) {
|
currentDataMode = VisConstants.DataVisMode.JSON;
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
if (StringUtils.isBlank(entityURI)) {
|
||||||
vitroRequest,
|
|
||||||
log,
|
|
||||||
dataset,
|
|
||||||
entityURI,
|
|
||||||
VisConstants.DataVisMode.JSON);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
entityURI = OrganizationUtilityFunctions
|
||||||
vitroRequest,
|
|
||||||
log,
|
|
||||||
dataset,
|
|
||||||
OrganizationUtilityFunctions
|
|
||||||
.getStaffProvidedOrComputedHighestLevelOrganization(
|
.getStaffProvidedOrComputedHighestLevelOrganization(
|
||||||
log,
|
log,
|
||||||
dataset,
|
dataset,
|
||||||
vitroRequest),
|
vitroRequest);
|
||||||
VisConstants.DataVisMode.JSON);
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* This provides csv download files for the content in the tables.
|
|
||||||
* */
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
return getSubjectEntityAndGenerateDataResponse(
|
||||||
vitroRequest,
|
vitroRequest,
|
||||||
log,
|
log,
|
||||||
dataset,
|
dataset,
|
||||||
entityURI,
|
entityURI,
|
||||||
VisConstants.DataVisMode.CSV);
|
currentDataMode);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> prepareDataErrorResponse() {
|
private Map<String, String> prepareDataErrorResponse() {
|
||||||
|
|
|
@ -76,11 +76,6 @@ public class TemporalPublicationVisualizationRequestHandler implements
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// System.out.println("current models in the system are");
|
|
||||||
// for (Map.Entry<String, Model> entry : ConstructedModelTracker.getAllModels().entrySet()) {
|
|
||||||
// System.out.println(entry.getKey() + " -> " + entry.getValue().size());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
return prepareStandaloneMarkupResponse(vitroRequest, entityURI);
|
return prepareStandaloneMarkupResponse(vitroRequest, entityURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,6 +199,8 @@ public class TemporalPublicationVisualizationRequestHandler implements
|
||||||
String entityURI = vitroRequest
|
String entityURI = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||||
|
|
||||||
|
VisConstants.DataVisMode currentDataMode = VisConstants.DataVisMode.CSV;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This will provide the data in json format mainly used for standalone tmeporal vis.
|
* This will provide the data in json format mainly used for standalone tmeporal vis.
|
||||||
* */
|
* */
|
||||||
|
@ -211,41 +208,26 @@ public class TemporalPublicationVisualizationRequestHandler implements
|
||||||
.equalsIgnoreCase(vitroRequest.getParameter(
|
.equalsIgnoreCase(vitroRequest.getParameter(
|
||||||
VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(entityURI)) {
|
currentDataMode = VisConstants.DataVisMode.JSON;
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
if (StringUtils.isBlank(entityURI)) {
|
||||||
vitroRequest,
|
|
||||||
log,
|
|
||||||
dataset,
|
|
||||||
entityURI,
|
|
||||||
VisConstants.DataVisMode.JSON);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
entityURI = OrganizationUtilityFunctions
|
||||||
vitroRequest,
|
|
||||||
log,
|
|
||||||
dataset,
|
|
||||||
OrganizationUtilityFunctions
|
|
||||||
.getStaffProvidedOrComputedHighestLevelOrganization(
|
.getStaffProvidedOrComputedHighestLevelOrganization(
|
||||||
log,
|
log,
|
||||||
dataset,
|
dataset,
|
||||||
vitroRequest),
|
vitroRequest);
|
||||||
VisConstants.DataVisMode.JSON);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
}
|
||||||
/*
|
|
||||||
* This provides csv download files for the content in the tables.
|
|
||||||
* */
|
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
return getSubjectEntityAndGenerateDataResponse(
|
||||||
vitroRequest,
|
vitroRequest,
|
||||||
log,
|
log,
|
||||||
dataset,
|
dataset,
|
||||||
entityURI,
|
entityURI,
|
||||||
VisConstants.DataVisMode.CSV);
|
currentDataMode);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.Organizat
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToPublicationsForSubOrganizationsModelConstructor;
|
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToPublicationsForSubOrganizationsModelConstructor;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToGrantsModelConstructor;
|
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToGrantsModelConstructor;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToPublicationsModelConstructor;
|
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToPublicationsModelConstructor;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PersonToGrantsModelConstructor;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PersonToPublicationsModelConstructor;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.SubOrganizationWithinModelConstructor;
|
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.SubOrganizationWithinModelConstructor;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Entity;
|
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Entity;
|
||||||
|
@ -419,7 +421,8 @@ public class SelectOnModelUtilities {
|
||||||
|
|
||||||
private static void getPublicationForEntity(
|
private static void getPublicationForEntity(
|
||||||
ResultSet queryResult,
|
ResultSet queryResult,
|
||||||
SubEntity subEntity, Map<String, Activity> allDocumentURIToVOs) {
|
SubEntity subEntity,
|
||||||
|
Map<String, Activity> allDocumentURIToVOs) {
|
||||||
|
|
||||||
Set<Activity> currentEntityPublications = new HashSet<Activity>();
|
Set<Activity> currentEntityPublications = new HashSet<Activity>();
|
||||||
|
|
||||||
|
@ -685,6 +688,21 @@ public class SelectOnModelUtilities {
|
||||||
dataset);
|
dataset);
|
||||||
|
|
||||||
for (SubEntity person : people) {
|
for (SubEntity person : people) {
|
||||||
|
updateGrantsForPerson(person, allGrantURIToVOs, peopleGrantsModel);
|
||||||
|
}
|
||||||
|
return allGrantURIToVOs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method side-effects person and the central grants map.
|
||||||
|
* @param person
|
||||||
|
* @param allGrantURIToVOs
|
||||||
|
* @param personGrantsModel
|
||||||
|
* @throws MalformedQueryParametersException
|
||||||
|
*/
|
||||||
|
private static void updateGrantsForPerson(SubEntity person,
|
||||||
|
Map<String, Activity> allGrantURIToVOs, Model personGrantsModel)
|
||||||
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>();
|
Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>();
|
||||||
fieldLabelToOutputFieldLabel.put("grant", QueryFieldLabels.GRANT_URL);
|
fieldLabelToOutputFieldLabel.put("grant", QueryFieldLabels.GRANT_URL);
|
||||||
|
@ -725,21 +743,83 @@ public class SelectOnModelUtilities {
|
||||||
"",
|
"",
|
||||||
whereClause,
|
whereClause,
|
||||||
"",
|
"",
|
||||||
peopleGrantsModel);
|
personGrantsModel);
|
||||||
|
|
||||||
getGrantForEntity(personGrantsQuery.getQueryResult(), person, allGrantURIToVOs);
|
getGrantForEntity(personGrantsQuery.getQueryResult(), person, allGrantURIToVOs);
|
||||||
|
|
||||||
String lastCachedAtForEntity = getLastCachedAtDateTimeForEntityInModel(
|
String lastCachedAtForEntity = getLastCachedAtDateTimeForEntityInModel(
|
||||||
person,
|
person,
|
||||||
peopleGrantsModel);
|
personGrantsModel);
|
||||||
|
|
||||||
person.setLastCachedAtDateTime(lastCachedAtForEntity);
|
person.setLastCachedAtDateTime(lastCachedAtForEntity);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<String, Activity> getGrantsForPerson(
|
||||||
|
Dataset dataset, SubEntity person, boolean doCache)
|
||||||
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
|
Map<String, Activity> allGrantURIToVOs = new HashMap<String, Activity>();
|
||||||
|
|
||||||
|
Model personGrantsModel = null;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we dont want to cache the results then create the model directly without
|
||||||
|
* using the ModelConstructorUtilities. Use case is the co-pi ego-centric
|
||||||
|
* visualization.
|
||||||
|
* */
|
||||||
|
if (doCache) {
|
||||||
|
personGrantsModel = ModelConstructorUtilities
|
||||||
|
.getOrConstructModel(
|
||||||
|
person.getIndividualURI(),
|
||||||
|
PersonToGrantsModelConstructor.MODEL_TYPE,
|
||||||
|
dataset);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
ModelConstructor model = new PersonToGrantsModelConstructor(person.getIndividualURI(), dataset);
|
||||||
|
personGrantsModel = model.getConstructedModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateGrantsForPerson(person, allGrantURIToVOs, personGrantsModel);
|
||||||
|
|
||||||
|
|
||||||
return allGrantURIToVOs;
|
return allGrantURIToVOs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Map<String, Activity> getPublicationsForPerson(
|
||||||
|
Dataset dataset, SubEntity person, boolean doCache)
|
||||||
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
|
Map<String, Activity> allPublicationURIToVOs = new HashMap<String, Activity>();
|
||||||
|
|
||||||
|
Model personPublicationsModel = null;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we dont want to cache the results then create the model directly without
|
||||||
|
* using the ModelConstructorUtilities. Use case is the co-author ego-centric
|
||||||
|
* visualization.
|
||||||
|
* */
|
||||||
|
if (doCache) {
|
||||||
|
personPublicationsModel = ModelConstructorUtilities
|
||||||
|
.getOrConstructModel(
|
||||||
|
person.getIndividualURI(),
|
||||||
|
PersonToPublicationsModelConstructor.MODEL_TYPE,
|
||||||
|
dataset);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
ModelConstructor model = new PersonToPublicationsModelConstructor(person.getIndividualURI(), dataset);
|
||||||
|
personPublicationsModel = model.getConstructedModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updatePublicationsForPerson(person, allPublicationURIToVOs, personPublicationsModel);
|
||||||
|
|
||||||
|
return allPublicationURIToVOs;
|
||||||
|
}
|
||||||
|
|
||||||
public static Map<String, Activity> getPublicationsForAssociatedPeople(
|
public static Map<String, Activity> getPublicationsForAssociatedPeople(
|
||||||
Dataset dataset, Collection<SubEntity> people)
|
Dataset dataset, Collection<SubEntity> people)
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
@ -753,7 +833,24 @@ public class SelectOnModelUtilities {
|
||||||
|
|
||||||
for (SubEntity person : people) {
|
for (SubEntity person : people) {
|
||||||
|
|
||||||
// System.out.println("getting publications for " + person.getIndividualLabel());
|
updatePublicationsForPerson(person, allDocumentURIToVOs,
|
||||||
|
peoplePublicationsModel);
|
||||||
|
|
||||||
|
}
|
||||||
|
return allDocumentURIToVOs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method side-effects the person and the central documents map.
|
||||||
|
* @param person
|
||||||
|
* @param allDocumentURIToVOs
|
||||||
|
* @param peoplePublicationsModel
|
||||||
|
* @throws MalformedQueryParametersException
|
||||||
|
*/
|
||||||
|
private static void updatePublicationsForPerson(SubEntity person,
|
||||||
|
Map<String, Activity> allDocumentURIToVOs,
|
||||||
|
Model peoplePublicationsModel)
|
||||||
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>();
|
Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>();
|
||||||
fieldLabelToOutputFieldLabel.put("document", QueryFieldLabels.DOCUMENT_URL);
|
fieldLabelToOutputFieldLabel.put("document", QueryFieldLabels.DOCUMENT_URL);
|
||||||
|
@ -783,9 +880,6 @@ public class SelectOnModelUtilities {
|
||||||
peoplePublicationsModel);
|
peoplePublicationsModel);
|
||||||
|
|
||||||
person.setLastCachedAtDateTime(lastCachedAtForEntity);
|
person.setLastCachedAtDateTime(lastCachedAtForEntity);
|
||||||
|
|
||||||
}
|
|
||||||
return allDocumentURIToVOs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, Activity> getPublicationsWithJournalForAssociatedPeople(
|
public static Map<String, Activity> getPublicationsWithJournalForAssociatedPeople(
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
|
package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -68,6 +69,11 @@ public class UtilityFunctions {
|
||||||
return yearToActivityCount;
|
return yearToActivityCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<String, Integer> getYearToActivityCount(
|
||||||
|
Collection<Activity> activities) {
|
||||||
|
return getYearToActivityCount(new HashSet<Activity>(activities));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is used to return a mapping between activity year & all the collaborators
|
* This method is used to return a mapping between activity year & all the collaborators
|
||||||
* that published with ego in that year.
|
* that published with ego in that year.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue