1. SPARQL query was illegally modified due to Refactor. This led to "foaf:Person" being changed to "foaf:Individual".
2. Changed the slugify logic so that only first 10 letters are considered for the file nam, else the filenames become very very big, especially for schools like CALS.
This commit is contained in:
parent
4a74799a18
commit
9a6a7ce3fb
7 changed files with 16 additions and 14 deletions
|
@ -36,7 +36,7 @@ public class TestJava {
|
|||
System.out.println(sampleBlurns);
|
||||
for (String blurb : sampleBlurns) {
|
||||
|
||||
System.out.println(blurb);
|
||||
System.out.println(blurb.substring(0, 10));
|
||||
}
|
||||
Map<String, Integer> yearToPublicationCount = new TreeMap<String, Integer>();
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ public class QueryHandler {
|
|||
String ontologyHandle) {
|
||||
|
||||
String sparqlQuery = " {?department " + ontologyHandle + " ?" + employeeHandle + " . "
|
||||
+ "?" + employeeHandle + " rdf:type foaf:Individual; rdfs:label ?authorLabel. "
|
||||
+ "?" + employeeHandle + " rdf:type foaf:Person; rdfs:label ?authorLabel. "
|
||||
+ "OPTIONAL { ?" + employeeHandle + " vivo:authorOf ?document ." +
|
||||
" ?document rdf:type bibo:Document ." +
|
||||
" ?document rdfs:label ?documentLabel ." +
|
||||
|
|
|
@ -40,6 +40,8 @@ import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.VivoEmployee;
|
|||
|
||||
public class VisualizationRequestHandler {
|
||||
|
||||
private static final int MAX_NAME_TEXT_LENGTH = 10;
|
||||
|
||||
public static final String VIS_CONTAINER_URL_HANDLE = "container";
|
||||
|
||||
public static final String COLLEGE_URI_URL_HANDLE = "uri";
|
||||
|
@ -348,7 +350,7 @@ public class VisualizationRequestHandler {
|
|||
collegeName = "";
|
||||
}
|
||||
|
||||
String outputFileName = slugify(collegeName + "depts-pub-count") + ".csv";
|
||||
String outputFileName = slugify(collegeName) + "depts-pub-count" + ".csv";
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition","attachment;filename=" + outputFileName);
|
||||
|
@ -379,7 +381,7 @@ public class VisualizationRequestHandler {
|
|||
* @return
|
||||
*/
|
||||
private String slugify(String textToBeSlugified) {
|
||||
return textToBeSlugified.toLowerCase().replaceAll("[^a-zA-Z0-9-]", "-");
|
||||
return textToBeSlugified.toLowerCase().replaceAll("[^a-zA-Z0-9-]", "-").substring(0, MAX_NAME_TEXT_LENGTH);
|
||||
}
|
||||
|
||||
private void generateCsvFileBuffer(
|
||||
|
|
|
@ -166,7 +166,7 @@ public class QueryHandler {
|
|||
+ SPARQL_QUERY_COMMON_SELECT_CLAUSE
|
||||
+ "(str(<" + queryURI + ">) as ?authPersonLit) "
|
||||
+ "WHERE { "
|
||||
+ "<" + queryURI + "> rdf:type foaf:Individual ; vivo:authorOf ?document ; rdfs:label ?authorLabel. "
|
||||
+ "<" + queryURI + "> rdf:type foaf:Person ; vivo:authorOf ?document ; rdfs:label ?authorLabel. "
|
||||
+ SPARQL_QUERY_COMMON_WHERE_CLAUSE
|
||||
+ "}";
|
||||
|
||||
|
@ -179,7 +179,7 @@ public class QueryHandler {
|
|||
throws MalformedQueryParametersException {
|
||||
|
||||
if(this.queryParam == null || "".equals(queryParam)) {
|
||||
throw new MalformedQueryParametersException("URI parameter is either null or empty.");
|
||||
throw new MalformedQueryParametersException("URL parameter is either null or empty.");
|
||||
} else {
|
||||
|
||||
/*
|
||||
|
|
|
@ -35,6 +35,8 @@ import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Individual;
|
|||
|
||||
public class VisualizationRequestHandler {
|
||||
|
||||
private static final int MAX_NAME_TEXT_LENGTH = 10;
|
||||
|
||||
public static final String VIS_CONTAINER_URL_HANDLE = "container";
|
||||
|
||||
public static final String INDIVIDUAL_URI_URL_HANDLE = "uri";
|
||||
|
@ -205,8 +207,7 @@ public class VisualizationRequestHandler {
|
|||
authorName = "";
|
||||
}
|
||||
|
||||
String outputFileName = slugify(authorName + "report")
|
||||
+ ".pdf";
|
||||
String outputFileName = slugify(authorName) + "report" + ".pdf";
|
||||
|
||||
response.setContentType("application/pdf");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + outputFileName);
|
||||
|
@ -262,8 +263,7 @@ public class VisualizationRequestHandler {
|
|||
authorName = "";
|
||||
}
|
||||
|
||||
String outputFileName = slugify(authorName + "pub-count-sparkline")
|
||||
+ ".csv";
|
||||
String outputFileName = slugify(authorName) + "pub-count-sparkline" + ".csv";
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition","attachment;filename=" + outputFileName);
|
||||
|
@ -293,7 +293,7 @@ public class VisualizationRequestHandler {
|
|||
* @return
|
||||
*/
|
||||
private String slugify(String textToBeSlugified) {
|
||||
return textToBeSlugified.toLowerCase().replaceAll("[^a-zA-Z0-9-]", "-");
|
||||
return textToBeSlugified.toLowerCase().replaceAll("[^a-zA-Z0-9-]", "-").substring(0, MAX_NAME_TEXT_LENGTH);
|
||||
}
|
||||
|
||||
private void generateCsvFileBuffer(Map<String, Integer> yearToPublicationCount,
|
||||
|
|
|
@ -6,8 +6,8 @@ public class Individual {
|
|||
private String individualURL;
|
||||
|
||||
public Individual(String individualURL, String individualLabel) {
|
||||
this.individualLabel = individualLabel;
|
||||
this.individualURL = individualURL;
|
||||
this.individualLabel = individualLabel;
|
||||
}
|
||||
|
||||
public Individual(String individualURL) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.VOConstants.E
|
|||
* @author cdtank
|
||||
*
|
||||
*/
|
||||
public class VivoEmployee extends Individual{
|
||||
public class VivoEmployee extends Individual {
|
||||
|
||||
private EmployeeType employeeType;
|
||||
private Set<VivoDepartmentOrDivision> parentDepartments = new HashSet<VivoDepartmentOrDivision>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue