1. Added scimap icon.
2. Made chanegs to scimap request handler to accept scimap requests for people as an entity.
This commit is contained in:
parent
c01980c795
commit
2208ffd6c0
6 changed files with 115 additions and 21 deletions
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -92,7 +92,7 @@ public class OrganizationUtilityFunctions {
|
||||||
|
|
||||||
QueryRunner<ResultSet> highestLevelOrganizationQueryHandler = new GenericQueryRunner(
|
QueryRunner<ResultSet> highestLevelOrganizationQueryHandler = new GenericQueryRunner(
|
||||||
fieldLabelToOutputFieldLabel, aggregationRules, whereClause,
|
fieldLabelToOutputFieldLabel, aggregationRules, whereClause,
|
||||||
groupOrderClause, dataset, log);
|
groupOrderClause, dataset);
|
||||||
|
|
||||||
String highestLevelOrgURI = OrganizationUtilityFunctions
|
String highestLevelOrgURI = OrganizationUtilityFunctions
|
||||||
.getHighestLevelOrganizationURI(
|
.getHighestLevelOrganizationURI(
|
||||||
|
|
|
@ -87,11 +87,48 @@ public class MapOfScienceVisualizationRequestHandler implements
|
||||||
//
|
//
|
||||||
return prepareStandaloneMarkupResponse(vitroRequest, entityURI);
|
return prepareStandaloneMarkupResponse(vitroRequest, entityURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Map<String, String> getSubjectPersonEntityAndGenerateDataResponse(
|
||||||
|
VitroRequest vitroRequest, Log log, Dataset dataset,
|
||||||
|
String subjectEntityURI, VisConstants.DataVisMode dataOuputFormat)
|
||||||
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
|
Map<String, Activity> documentURIForAssociatedPeopleTOVO = new HashMap<String, Activity>();
|
||||||
|
|
||||||
|
|
||||||
|
Entity personEntity = SelectOnModelUtilities
|
||||||
|
.getSubjectPersonEntity(dataset, subjectEntityURI);
|
||||||
|
|
||||||
|
if (personEntity.getSubEntities() != null) {
|
||||||
|
|
||||||
|
documentURIForAssociatedPeopleTOVO = SelectOnModelUtilities
|
||||||
|
.getPublicationsWithJournalForAssociatedPeople(dataset, personEntity.getSubEntities());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (documentURIForAssociatedPeopleTOVO.isEmpty()) {
|
||||||
|
|
||||||
|
if (VisConstants.DataVisMode.JSON.equals(dataOuputFormat)) {
|
||||||
|
return prepareStandaloneDataErrorResponse();
|
||||||
|
} else {
|
||||||
|
return prepareDataErrorResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (VisConstants.DataVisMode.JSON.equals(dataOuputFormat)) {
|
||||||
|
return prepareStandaloneDataResponse(vitroRequest, personEntity);
|
||||||
|
} else {
|
||||||
|
return prepareDataResponse(vitroRequest, personEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, String> getSubjectEntityAndGenerateDataResponse(
|
private Map<String, String> getSubjectEntityAndGenerateDataResponse(
|
||||||
VitroRequest vitroRequest, Log log, Dataset dataset,
|
VitroRequest vitroRequest, Log log, Dataset dataset,
|
||||||
String subjectEntityURI, VisConstants.DataVisMode dataOuputFormat)
|
String subjectEntityURI, VisConstants.DataVisMode dataOuputFormat)
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
Entity organizationEntity = SelectOnModelUtilities
|
Entity organizationEntity = SelectOnModelUtilities
|
||||||
.getSubjectOrganizationHierarchy(dataset, subjectEntityURI);
|
.getSubjectOrganizationHierarchy(dataset, subjectEntityURI);
|
||||||
|
@ -187,15 +224,15 @@ public class MapOfScienceVisualizationRequestHandler implements
|
||||||
if (VisualizationFrameworkConstants.SUBDISCIPLINE_TO_ACTIVTY_VIS_MODE
|
if (VisualizationFrameworkConstants.SUBDISCIPLINE_TO_ACTIVTY_VIS_MODE
|
||||||
.equalsIgnoreCase(vitroRequest.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
.equalsIgnoreCase(vitroRequest.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY))) {
|
||||||
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
||||||
getSubDisciplineToPublicationsCSVContent(entity));
|
getSubDisciplineToPublicationsCSVContent(entity));
|
||||||
|
|
||||||
outputFileName += "_subdiscipline-to-publications" + ".csv";
|
outputFileName += "_subdiscipline-to-publications" + ".csv";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
fileData.put(DataVisualizationController.FILE_CONTENT_KEY,
|
||||||
getDisciplineToPublicationsCSVContent(entity));
|
getDisciplineToPublicationsCSVContent(entity));
|
||||||
|
|
||||||
outputFileName += "_discipline-to-publications" + ".csv";
|
outputFileName += "_discipline-to-publications" + ".csv";
|
||||||
|
|
||||||
|
@ -257,14 +294,26 @@ public class MapOfScienceVisualizationRequestHandler implements
|
||||||
currentDataVisMode = VisConstants.DataVisMode.JSON;
|
currentDataVisMode = VisConstants.DataVisMode.JSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UtilityFunctions.isEntityAPerson(vitroRequest, entityURI)) {
|
||||||
|
|
||||||
|
return getSubjectPersonEntityAndGenerateDataResponse(
|
||||||
|
vitroRequest,
|
||||||
|
log,
|
||||||
|
dataset,
|
||||||
|
entityURI,
|
||||||
|
currentDataVisMode);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
return getSubjectEntityAndGenerateDataResponse(
|
return getSubjectEntityAndGenerateDataResponse(
|
||||||
vitroRequest,
|
vitroRequest,
|
||||||
log,
|
log,
|
||||||
dataset,
|
dataset,
|
||||||
entityURI,
|
entityURI,
|
||||||
currentDataVisMode);
|
currentDataVisMode);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -304,7 +353,6 @@ public class MapOfScienceVisualizationRequestHandler implements
|
||||||
body.put("entityLabel", organizationLabel);
|
body.put("entityLabel", organizationLabel);
|
||||||
body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace());
|
body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace());
|
||||||
|
|
||||||
|
|
||||||
return new TemplateResponseValues(standaloneTemplate, body);
|
return new TemplateResponseValues(standaloneTemplate, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
||||||
"",
|
"",
|
||||||
whereClause,
|
whereClause,
|
||||||
"",
|
"",
|
||||||
dataset, log);
|
dataset);
|
||||||
|
|
||||||
return getThumbnailInformation(imageQueryHandler.getQueryResult(),
|
return getThumbnailInformation(imageQueryHandler.getQueryResult(),
|
||||||
fieldLabelToOutputFieldLabel, vitroRequest);
|
fieldLabelToOutputFieldLabel, vitroRequest);
|
||||||
|
@ -131,7 +131,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
||||||
aggregationRules,
|
aggregationRules,
|
||||||
whereClause,
|
whereClause,
|
||||||
groupOrderClause,
|
groupOrderClause,
|
||||||
dataset, log);
|
dataset);
|
||||||
|
|
||||||
Gson publicationsInformation = new Gson();
|
Gson publicationsInformation = new Gson();
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
||||||
aggregationRules,
|
aggregationRules,
|
||||||
whereClause,
|
whereClause,
|
||||||
"",
|
"",
|
||||||
dataset, log);
|
dataset);
|
||||||
|
|
||||||
Gson grantsInformation = new Gson();
|
Gson grantsInformation = new Gson();
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
||||||
aggregationRules,
|
aggregationRules,
|
||||||
whereClause,
|
whereClause,
|
||||||
groupOrderClause,
|
groupOrderClause,
|
||||||
dataset, log);
|
dataset);
|
||||||
|
|
||||||
return getHighestLevelOrganizationTemporalGraphVisURL(
|
return getHighestLevelOrganizationTemporalGraphVisURL(
|
||||||
highestLevelOrganizationQueryHandler.getQueryResult(),
|
highestLevelOrganizationQueryHandler.getQueryResult(),
|
||||||
|
|
|
@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
import com.hp.hpl.jena.query.Dataset;
|
import com.hp.hpl.jena.query.Dataset;
|
||||||
import com.hp.hpl.jena.query.Query;
|
import com.hp.hpl.jena.query.Query;
|
||||||
|
@ -42,7 +41,7 @@ public class GenericQueryRunner implements QueryRunner<ResultSet> {
|
||||||
String aggregationRules,
|
String aggregationRules,
|
||||||
String whereClause,
|
String whereClause,
|
||||||
String groupOrderClause,
|
String groupOrderClause,
|
||||||
Dataset dataset, Log log) {
|
Dataset dataset) {
|
||||||
|
|
||||||
this.fieldLabelToOutputFieldLabel = fieldLabelToOutputFieldLabel;
|
this.fieldLabelToOutputFieldLabel = fieldLabelToOutputFieldLabel;
|
||||||
this.aggregationRules = aggregationRules;
|
this.aggregationRules = aggregationRules;
|
||||||
|
|
|
@ -72,6 +72,53 @@ public class SelectOnModelUtilities {
|
||||||
return entityWithSubOrganizations;
|
return entityWithSubOrganizations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Entity getSubjectPersonEntity(Dataset dataset,
|
||||||
|
String subjectEntityURI) throws MalformedQueryParametersException {
|
||||||
|
|
||||||
|
Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>();
|
||||||
|
fieldLabelToOutputFieldLabel.put("authorLabel", QueryFieldLabels.AUTHOR_LABEL);
|
||||||
|
|
||||||
|
String whereClause = ""
|
||||||
|
+ " <" + subjectEntityURI + "> rdfs:label ?authorLabel . ";
|
||||||
|
|
||||||
|
QueryRunner<ResultSet> personQuery =
|
||||||
|
new GenericQueryRunner(fieldLabelToOutputFieldLabel,
|
||||||
|
"",
|
||||||
|
whereClause,
|
||||||
|
"",
|
||||||
|
dataset);
|
||||||
|
|
||||||
|
Entity personEntity = new Entity(subjectEntityURI);
|
||||||
|
|
||||||
|
ResultSet queryResult = personQuery.getQueryResult();
|
||||||
|
|
||||||
|
while (queryResult.hasNext()) {
|
||||||
|
|
||||||
|
QuerySolution solution = queryResult.nextSolution();
|
||||||
|
|
||||||
|
RDFNode personLabelNode = solution.get(QueryFieldLabels.AUTHOR_LABEL);
|
||||||
|
if (personLabelNode != null) {
|
||||||
|
personEntity.setEntityLabel(personLabelNode.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We are adding A person as it's own subentity in order to make our code for geenrating csv, json
|
||||||
|
* & other data as streamlined as possible between entities of type Organization & Person.
|
||||||
|
* */
|
||||||
|
SubEntity subEntity = new SubEntity(subjectEntityURI, personEntity.getEntityLabel());
|
||||||
|
subEntity.setEntityClass(VOConstants.EntityClassType.PERSON);
|
||||||
|
|
||||||
|
personEntity.addSubEntity(subEntity);
|
||||||
|
|
||||||
|
// Entity entityWithParentOrganizations = getAllParentOrganizations(dataset, subjectEntityURI);
|
||||||
|
//
|
||||||
|
// personEntity.addParents(entityWithParentOrganizations.getParents());
|
||||||
|
|
||||||
|
return personEntity;
|
||||||
|
}
|
||||||
|
|
||||||
public static Entity getAllParentOrganizations(Dataset dataset,
|
public static Entity getAllParentOrganizations(Dataset dataset,
|
||||||
String subjectEntityURI) throws MalformedQueryParametersException {
|
String subjectEntityURI) throws MalformedQueryParametersException {
|
||||||
Model organizationModel = ModelConstructorUtilities
|
Model organizationModel = ModelConstructorUtilities
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue