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(
|
||||
fieldLabelToOutputFieldLabel, aggregationRules, whereClause,
|
||||
groupOrderClause, dataset, log);
|
||||
groupOrderClause, dataset);
|
||||
|
||||
String highestLevelOrgURI = OrganizationUtilityFunctions
|
||||
.getHighestLevelOrganizationURI(
|
||||
|
|
|
@ -88,6 +88,43 @@ public class MapOfScienceVisualizationRequestHandler implements
|
|||
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(
|
||||
VitroRequest vitroRequest, Log log, Dataset dataset,
|
||||
String subjectEntityURI, VisConstants.DataVisMode dataOuputFormat)
|
||||
|
@ -257,6 +294,16 @@ public class MapOfScienceVisualizationRequestHandler implements
|
|||
currentDataVisMode = VisConstants.DataVisMode.JSON;
|
||||
}
|
||||
|
||||
if (UtilityFunctions.isEntityAPerson(vitroRequest, entityURI)) {
|
||||
|
||||
return getSubjectPersonEntityAndGenerateDataResponse(
|
||||
vitroRequest,
|
||||
log,
|
||||
dataset,
|
||||
entityURI,
|
||||
currentDataVisMode);
|
||||
|
||||
} else {
|
||||
|
||||
return getSubjectEntityAndGenerateDataResponse(
|
||||
vitroRequest,
|
||||
|
@ -267,6 +314,8 @@ public class MapOfScienceVisualizationRequestHandler implements
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||
|
@ -304,7 +353,6 @@ public class MapOfScienceVisualizationRequestHandler implements
|
|||
body.put("entityLabel", organizationLabel);
|
||||
body.put("vivoDefaultNamespace", vreq.getWebappDaoFactory().getDefaultNamespace());
|
||||
|
||||
|
||||
return new TemplateResponseValues(standaloneTemplate, body);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
"",
|
||||
whereClause,
|
||||
"",
|
||||
dataset, log);
|
||||
dataset);
|
||||
|
||||
return getThumbnailInformation(imageQueryHandler.getQueryResult(),
|
||||
fieldLabelToOutputFieldLabel, vitroRequest);
|
||||
|
@ -131,7 +131,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
aggregationRules,
|
||||
whereClause,
|
||||
groupOrderClause,
|
||||
dataset, log);
|
||||
dataset);
|
||||
|
||||
Gson publicationsInformation = new Gson();
|
||||
|
||||
|
@ -162,7 +162,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
aggregationRules,
|
||||
whereClause,
|
||||
"",
|
||||
dataset, log);
|
||||
dataset);
|
||||
|
||||
Gson grantsInformation = new Gson();
|
||||
|
||||
|
@ -309,7 +309,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
aggregationRules,
|
||||
whereClause,
|
||||
groupOrderClause,
|
||||
dataset, log);
|
||||
dataset);
|
||||
|
||||
return getHighestLevelOrganizationTemporalGraphVisURL(
|
||||
highestLevelOrganizationQueryHandler.getQueryResult(),
|
||||
|
|
|
@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.query.Query;
|
||||
|
@ -42,7 +41,7 @@ public class GenericQueryRunner implements QueryRunner<ResultSet> {
|
|||
String aggregationRules,
|
||||
String whereClause,
|
||||
String groupOrderClause,
|
||||
Dataset dataset, Log log) {
|
||||
Dataset dataset) {
|
||||
|
||||
this.fieldLabelToOutputFieldLabel = fieldLabelToOutputFieldLabel;
|
||||
this.aggregationRules = aggregationRules;
|
||||
|
|
|
@ -72,6 +72,53 @@ public class SelectOnModelUtilities {
|
|||
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,
|
||||
String subjectEntityURI) throws MalformedQueryParametersException {
|
||||
Model organizationModel = ModelConstructorUtilities
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue