Made some significant changes as part of tweaking the queries to reduce response times with SDB. -- NOT CONSIDERED FINAL.
This commit is contained in:
parent
e09eeae3b9
commit
706d9d3c9f
21 changed files with 278 additions and 207 deletions
|
@ -6,6 +6,7 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.hp.hpl.jena.query.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.query.DatasetFactory;
|
||||
import com.hp.hpl.jena.query.Syntax;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
@ -81,14 +82,14 @@ public class StandardVisualizationController extends FreemarkerHttpServlet {
|
|||
|
||||
}
|
||||
|
||||
DataSource dataSource = setupJENADataSource(model, vitroRequest);
|
||||
Dataset dataset = setupJENADataSource(vitroRequest);
|
||||
|
||||
if (dataSource != null && visRequestHandler != null) {
|
||||
if (dataset != null && visRequestHandler != null) {
|
||||
|
||||
try {
|
||||
return visRequestHandler.generateStandardVisualization(vitroRequest,
|
||||
log,
|
||||
dataSource);
|
||||
dataset);
|
||||
} catch (MalformedQueryParametersException e) {
|
||||
return UtilityFunctions.handleMalformedParameters(
|
||||
"Standard Visualization Query Error - Individual Publication Count",
|
||||
|
@ -130,16 +131,16 @@ public class StandardVisualizationController extends FreemarkerHttpServlet {
|
|||
return visRequestHandler;
|
||||
}
|
||||
|
||||
private DataSource setupJENADataSource(Model model, VitroRequest vreq) {
|
||||
private Dataset setupJENADataSource(VitroRequest vreq) {
|
||||
|
||||
log.debug("rdfResultFormat was: " + VisConstants.RDF_RESULT_FORMAT_PARAM);
|
||||
|
||||
DataSource dataSource = DatasetFactory.create();
|
||||
ModelMaker maker = (ModelMaker) getServletContext().getAttribute("vitroJenaModelMaker");
|
||||
// DataSource dataSource = DatasetFactory.create();
|
||||
// ModelMaker maker = (ModelMaker) getServletContext().getAttribute("vitroJenaModelMaker");
|
||||
//
|
||||
// dataSource.setDefaultModel(model);
|
||||
|
||||
dataSource.setDefaultModel(model);
|
||||
|
||||
return dataSource;
|
||||
return vreq.getDataset();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ 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.DataSource;
|
||||
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;
|
||||
|
@ -51,7 +51,7 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
|||
|
||||
private String egoURI;
|
||||
|
||||
private DataSource dataSource;
|
||||
private Dataset Dataset;
|
||||
|
||||
private Log log;
|
||||
|
||||
|
@ -60,10 +60,10 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
|||
private UniqueIDGenerator edgeIDGenerator;
|
||||
|
||||
public CoAuthorshipQueryRunner(String egoURI,
|
||||
DataSource dataSource, Log log) {
|
||||
Dataset Dataset, Log log) {
|
||||
|
||||
this.egoURI = egoURI;
|
||||
this.dataSource = dataSource;
|
||||
this.Dataset = Dataset;
|
||||
this.log = log;
|
||||
|
||||
this.nodeIDGenerator = new UniqueIDGenerator();
|
||||
|
@ -393,12 +393,12 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
|||
}
|
||||
|
||||
private ResultSet executeQuery(String queryText,
|
||||
DataSource dataSource) {
|
||||
Dataset Dataset) {
|
||||
|
||||
QueryExecution queryExecution = null;
|
||||
Query query = QueryFactory.create(queryText, SYNTAX);
|
||||
|
||||
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
||||
queryExecution = QueryExecutionFactory.create(query, Dataset);
|
||||
return queryExecution.execSelect();
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
|||
}
|
||||
|
||||
ResultSet resultSet = executeQuery(generateEgoCoAuthorshipSparqlQuery(this.egoURI),
|
||||
this.dataSource);
|
||||
this.Dataset);
|
||||
return createQueryResult(resultSet);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.apache.commons.lang.StringEscapeUtils;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import com.hp.hpl.jena.query.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -40,13 +40,13 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
|
|||
|
||||
@Override
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException {
|
||||
Dataset Dataset) throws MalformedQueryParametersException {
|
||||
throw new UnsupportedOperationException("CoAuthorship does not provide Ajax Response.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> generateDataVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
|
|||
.VIS_MODE_KEY);
|
||||
|
||||
QueryRunner<CoAuthorshipData> queryManager =
|
||||
new CoAuthorshipQueryRunner(egoURI, dataSource, log);
|
||||
new CoAuthorshipQueryRunner(egoURI, Dataset, log);
|
||||
|
||||
CoAuthorshipData authorNodesAndEdges =
|
||||
queryManager.getQueryResult();
|
||||
|
@ -105,7 +105,7 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
|
|||
|
||||
public ResponseValues generateStandardVisualization(VitroRequest vitroRequest,
|
||||
Log log,
|
||||
DataSource dataSource)
|
||||
Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
/*
|
||||
|
@ -117,7 +117,7 @@ public class CoAuthorshipRequestHandler implements VisualizationRequestHandler {
|
|||
.INDIVIDUAL_URI_KEY);
|
||||
|
||||
QueryRunner<CoAuthorshipData> queryManager =
|
||||
new CoAuthorshipQueryRunner(egoURI, dataSource, log);
|
||||
new CoAuthorshipQueryRunner(egoURI, Dataset, log);
|
||||
|
||||
CoAuthorshipData authorNodesAndEdges =
|
||||
queryManager.getQueryResult();
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
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.DataSource;
|
||||
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;
|
||||
|
@ -30,7 +30,7 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
|
||||
private String egoURI;
|
||||
|
||||
private DataSource dataSource;
|
||||
private Dataset Dataset;
|
||||
|
||||
private long before, after;
|
||||
|
||||
|
@ -42,9 +42,9 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
+ "?Grant rdfs:label ?GrantLabel . "
|
||||
+ "?Grant core:relatedRole ?RelatedRole . ";
|
||||
|
||||
public CoPIGrantCountConstructQueryRunner(String egoURI, DataSource dataSource, Log log){
|
||||
public CoPIGrantCountConstructQueryRunner(String egoURI, Dataset Dataset, Log log){
|
||||
this.egoURI = egoURI;
|
||||
this.dataSource = dataSource;
|
||||
this.Dataset = Dataset;
|
||||
//this.log = log;
|
||||
}
|
||||
|
||||
|
@ -61,17 +61,17 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForInvestigatorRoleOfProperty(String queryURI){
|
||||
private String generateConstructQueryForInvestigatorRoleOfProperty(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
|
||||
+ "?RelatedRole core:investigatorRoleOf ?coInvestigator ."
|
||||
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . "
|
||||
+ "}"
|
||||
+ "WHERE { "
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
|
||||
+ "?RelatedRole core:investigatorRoleOf ?coInvestigator ."
|
||||
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . "
|
||||
|
@ -80,17 +80,17 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForPrincipalInvestigatorRoleOfProperty(String queryURI){
|
||||
private String generateConstructQueryForPrincipalInvestigatorRoleOfProperty(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
|
||||
+ "?RelatedRole core:principalInvestigatorRoleOf ?coInvestigator ."
|
||||
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . "
|
||||
+ "}"
|
||||
+ "WHERE { "
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
|
||||
+ "?RelatedRole core:principalInvestigatorRoleOf ?coInvestigator ."
|
||||
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . "
|
||||
|
@ -99,17 +99,17 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(String queryURI){
|
||||
private String generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
|
||||
+ "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?coInvestigator ."
|
||||
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . "
|
||||
+ "}"
|
||||
+ "WHERE { "
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
|
||||
+ "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?coInvestigator ."
|
||||
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . "
|
||||
|
@ -118,11 +118,11 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForDateTimeValueofRole(String queryURI){
|
||||
private String generateConstructQueryForDateTimeValueofRole(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||
+ "?dateTimeIntervalValue core:start ?startDate . "
|
||||
+ "?startDate core:dateTime ?startDateTimeValue . "
|
||||
|
@ -131,13 +131,13 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
+ "}"
|
||||
+ "WHERE { "
|
||||
+ "{"
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||
+ "?dateTimeIntervalValue core:start ?startDate . "
|
||||
+ "?startDate core:dateTime ?startDateTimeValue . "
|
||||
+ "} UNION "
|
||||
+ "{"
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||
+ "?dateTimeIntervalValue core:end ?endDate . "
|
||||
+ "?endDate core:dateTime ?endDateTimeValue . "
|
||||
|
@ -147,11 +147,11 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForDateTimeValueofGrant(String queryURI){
|
||||
private String generateConstructQueryForDateTimeValueofGrant(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
||||
|
@ -161,14 +161,14 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
+ "}"
|
||||
+ "WHERE { "
|
||||
+ "{"
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
||||
+ "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
|
||||
+ "} UNION "
|
||||
+ "{"
|
||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
||||
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||
+ "?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
|
||||
|
@ -179,15 +179,16 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private Model executeQuery(Set<String> constructQueries, DataSource dataSource) {
|
||||
private Model executeQuery(Set<String> constructQueries, Dataset Dataset) {
|
||||
|
||||
Model constructedModel = ModelFactory.createDefaultModel();
|
||||
|
||||
before = System.currentTimeMillis();
|
||||
|
||||
for (String queryString : constructQueries) {
|
||||
|
||||
log.debug("CONSTRUCT query string : " + queryString);
|
||||
before = System.currentTimeMillis();
|
||||
|
||||
log.info("CONSTRUCT query string : " + queryString);
|
||||
|
||||
Query query = null;
|
||||
|
||||
|
@ -200,16 +201,17 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(
|
||||
query, dataSource);
|
||||
query, Dataset);
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
qe.close();
|
||||
}
|
||||
|
||||
after = System.currentTimeMillis();
|
||||
log.info("Time taken to execute the CONSTRUCT query is in milliseconds: " + (after - before) );
|
||||
|
||||
}
|
||||
after = System.currentTimeMillis();
|
||||
log.info("Time taken to execute the CONSTRUCT queries is in milliseconds: " + (after - before) );
|
||||
|
||||
return constructedModel;
|
||||
}
|
||||
|
@ -238,7 +240,7 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
populateConstructQueries(constructQueries);
|
||||
|
||||
Model model = executeQuery(constructQueries,
|
||||
this.dataSource);
|
||||
this.Dataset);
|
||||
|
||||
return model;
|
||||
|
||||
|
@ -247,12 +249,23 @@ public class CoPIGrantCountConstructQueryRunner {
|
|||
private void populateConstructQueries(Set<String> constructQueries) {
|
||||
|
||||
constructQueries.add(generateConstructQueryForInvestigatorLabel(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForInvestigatorRoleOfProperty(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForInvestigatorRoleOfProperty(this.egoURI, "core:hasInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(this.egoURI, "core:hasInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty(this.egoURI, "core:hasInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI, "core:hasInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI, "core:hasInvestigatorRole"));
|
||||
|
||||
constructQueries.add(generateConstructQueryForInvestigatorRoleOfProperty(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
|
||||
constructQueries.add(generateConstructQueryForInvestigatorRoleOfProperty(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
|
||||
}
|
||||
}
|
|
@ -11,7 +11,8 @@ import org.apache.commons.lang.StringEscapeUtils;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import com.hp.hpl.jena.query.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
|
@ -35,19 +36,19 @@ public class CoPIGrantCountRequestHandler implements VisualizationRequestHandler
|
|||
|
||||
@Override
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException {
|
||||
Dataset Dataset) throws MalformedQueryParametersException {
|
||||
throw new UnsupportedOperationException("Co-PI Grant Count does not provide Ajax Response.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> generateDataVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
String egoURI = vitroRequest.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||
String visMode = vitroRequest.getParameter(VisualizationFrameworkConstants.VIS_MODE_KEY);
|
||||
|
||||
CoPIGrantCountConstructQueryRunner constructQueryRunner = new CoPIGrantCountConstructQueryRunner(egoURI, dataSource, log);
|
||||
CoPIGrantCountConstructQueryRunner constructQueryRunner = new CoPIGrantCountConstructQueryRunner(egoURI, Dataset, log);
|
||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||
|
||||
QueryRunner<CoPIData> queryManager = new CoPIGrantCountQueryRunner(egoURI, constructedModel, log);
|
||||
|
@ -95,7 +96,7 @@ public class CoPIGrantCountRequestHandler implements VisualizationRequestHandler
|
|||
|
||||
@Override
|
||||
public ResponseValues generateStandardVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
/*
|
||||
* Support for this has ceased to exist. Standalone mode was created only for demo
|
||||
|
@ -103,7 +104,7 @@ public class CoPIGrantCountRequestHandler implements VisualizationRequestHandler
|
|||
* */
|
||||
/* String egoURI = vitroRequest.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||
|
||||
QueryRunner<CoPIData> queryManager = new CoPIGrantCountQueryRunner(egoURI, dataSource, log);
|
||||
QueryRunner<CoPIData> queryManager = new CoPIGrantCountQueryRunner(egoURI, Dataset, log);
|
||||
|
||||
CoPIData PINodesAndEdges = queryManager.getQueryResult();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import com.hp.hpl.jena.query.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.query.QuerySolution;
|
||||
import com.hp.hpl.jena.query.ResultSet;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
@ -61,7 +61,7 @@ public class EntityComparisonUtilityFunctions {
|
|||
return "";
|
||||
}
|
||||
|
||||
public static String getHighestLevelOrganizationURI(Log log, DataSource dataSource)
|
||||
public static String getHighestLevelOrganizationURI(Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>();
|
||||
|
@ -82,7 +82,7 @@ public class EntityComparisonUtilityFunctions {
|
|||
|
||||
QueryRunner<ResultSet> highestLevelOrganizationQueryHandler = new GenericQueryRunner(
|
||||
fieldLabelToOutputFieldLabel, aggregationRules, whereClause,
|
||||
groupOrderClause, dataSource, log);
|
||||
groupOrderClause, Dataset, log);
|
||||
|
||||
String highestLevelOrgURI = EntityComparisonUtilityFunctions
|
||||
.getHighestLevelOrganizationURI(
|
||||
|
@ -92,10 +92,10 @@ public class EntityComparisonUtilityFunctions {
|
|||
}
|
||||
|
||||
public static Map<String, Set<String>> getSubEntityTypes(Log log,
|
||||
DataSource dataSource, String subjectOrganization)
|
||||
Dataset Dataset, String subjectOrganization)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
EntitySubOrganizationTypesConstructQueryRunner constructQueryRunnerForSubOrganizationTypes = new EntitySubOrganizationTypesConstructQueryRunner(subjectOrganization, dataSource, log) ;
|
||||
EntitySubOrganizationTypesConstructQueryRunner constructQueryRunnerForSubOrganizationTypes = new EntitySubOrganizationTypesConstructQueryRunner(subjectOrganization, Dataset, log) ;
|
||||
Model constructedModelForSubOrganizationTypes = constructQueryRunnerForSubOrganizationTypes.getConstructedModel();
|
||||
|
||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
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.DataSource;
|
||||
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;
|
||||
|
@ -29,15 +29,15 @@ public class EntityPublicationCountConstructQueryRunner {
|
|||
|
||||
private String egoURI;
|
||||
|
||||
private DataSource dataSource;
|
||||
private Dataset Dataset;
|
||||
|
||||
private Log log = LogFactory.getLog(EntityPublicationCountConstructQueryRunner.class.getName());
|
||||
|
||||
private long before, after;
|
||||
|
||||
public EntityPublicationCountConstructQueryRunner(String egoURI, DataSource dataSource, Log log){
|
||||
public EntityPublicationCountConstructQueryRunner(String egoURI, Dataset Dataset, Log log){
|
||||
this.egoURI = egoURI;
|
||||
this.dataSource = dataSource;
|
||||
this.Dataset = Dataset;
|
||||
//this.log = log;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ public class EntityPublicationCountConstructQueryRunner {
|
|||
|
||||
}
|
||||
|
||||
private Model executeQuery(Set<String> constructQueries, DataSource dataSource) {
|
||||
private Model executeQuery(Set<String> constructQueries, Dataset Dataset) {
|
||||
|
||||
Model constructedModel = ModelFactory.createDefaultModel();
|
||||
|
||||
|
@ -208,7 +208,7 @@ public class EntityPublicationCountConstructQueryRunner {
|
|||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(
|
||||
query, dataSource);
|
||||
query, Dataset);
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
|
@ -247,7 +247,7 @@ public class EntityPublicationCountConstructQueryRunner {
|
|||
populateConstructQueries(constructQueries);
|
||||
|
||||
Model model = executeQuery(constructQueries,
|
||||
this.dataSource);
|
||||
this.Dataset);
|
||||
|
||||
return model;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.google.gson.Gson;
|
|||
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.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class EntityPublicationCountRequestHandler implements
|
|||
|
||||
@Override
|
||||
public ResponseValues generateStandardVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
String entityURI = vitroRequest
|
||||
|
@ -54,7 +54,7 @@ public class EntityPublicationCountRequestHandler implements
|
|||
if (StringUtils.isNotBlank(entityURI)){
|
||||
|
||||
return getSubjectEntityAndGenerateResponse(vitroRequest, log,
|
||||
dataSource, entityURI);
|
||||
Dataset, entityURI);
|
||||
} else {
|
||||
|
||||
String staffProvidedHighestLevelOrganization = ConfigurationProperties.getProperty("visualization.topLevelOrg");
|
||||
|
@ -79,26 +79,26 @@ public class EntityPublicationCountRequestHandler implements
|
|||
} else {
|
||||
|
||||
return getSubjectEntityAndGenerateResponse(vitroRequest,
|
||||
log, dataSource,
|
||||
log, Dataset,
|
||||
staffProvidedHighestLevelOrganization);
|
||||
}
|
||||
}
|
||||
|
||||
String highestLevelOrgURI = EntityComparisonUtilityFunctions.getHighestLevelOrganizationURI(log,
|
||||
dataSource);
|
||||
Dataset);
|
||||
|
||||
return getSubjectEntityAndGenerateResponse(vitroRequest, log,
|
||||
dataSource, highestLevelOrgURI);
|
||||
Dataset, highestLevelOrgURI);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ResponseValues getSubjectEntityAndGenerateResponse(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource,
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset,
|
||||
String subjectEntityURI)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
EntityPublicationCountConstructQueryRunner constructQueryRunner = new EntityPublicationCountConstructQueryRunner(subjectEntityURI, dataSource, log);
|
||||
EntityPublicationCountConstructQueryRunner constructQueryRunner = new EntityPublicationCountConstructQueryRunner(subjectEntityURI, Dataset, log);
|
||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||
|
||||
QueryRunner<Entity> queryManager = new EntityPublicationCountQueryRunner(
|
||||
|
@ -115,19 +115,19 @@ public class EntityPublicationCountRequestHandler implements
|
|||
} else {
|
||||
|
||||
return getSubEntityTypesAndRenderStandaloneResponse(
|
||||
vitroRequest, log, dataSource,
|
||||
vitroRequest, log, Dataset,
|
||||
subjectEntityURI, entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ResponseValues getSubEntityTypesAndRenderStandaloneResponse(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource,
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset,
|
||||
String subjectEntityURI, Entity entity)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||
log, dataSource, subjectEntityURI);
|
||||
log, Dataset, subjectEntityURI);
|
||||
|
||||
return prepareStandaloneResponse(vitroRequest, entity, subjectEntityURI,
|
||||
subOrganizationTypesResult);
|
||||
|
@ -136,13 +136,13 @@ public class EntityPublicationCountRequestHandler implements
|
|||
|
||||
@Override
|
||||
public Map<String, String> generateDataVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
String entityURI = vitroRequest
|
||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||
|
||||
EntityPublicationCountConstructQueryRunner constructQueryRunner = new EntityPublicationCountConstructQueryRunner(entityURI, dataSource, log);
|
||||
EntityPublicationCountConstructQueryRunner constructQueryRunner = new EntityPublicationCountConstructQueryRunner(entityURI, Dataset, log);
|
||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||
|
||||
QueryRunner<Entity> queryManager = new EntityPublicationCountQueryRunner(
|
||||
|
@ -151,7 +151,7 @@ public class EntityPublicationCountRequestHandler implements
|
|||
Entity entity = queryManager.getQueryResult();
|
||||
|
||||
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||
log, dataSource, entityURI);
|
||||
log, Dataset, entityURI);
|
||||
|
||||
return prepareDataResponse(entity, entity.getSubEntities(),subOrganizationTypesResult);
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class EntityPublicationCountRequestHandler implements
|
|||
|
||||
@Override
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException {
|
||||
Dataset Dataset) throws MalformedQueryParametersException {
|
||||
throw new UnsupportedOperationException("Entity Pub Count does not provide Ajax Response.");
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
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.DataSource;
|
||||
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;
|
||||
|
@ -30,13 +30,13 @@ public class EntitySubOrganizationTypesConstructQueryRunner {
|
|||
|
||||
private String egoURI;
|
||||
|
||||
private DataSource dataSource;
|
||||
private Dataset Dataset;
|
||||
|
||||
private Log log = LogFactory.getLog(EntitySubOrganizationTypesConstructQueryRunner.class.getName());
|
||||
|
||||
public EntitySubOrganizationTypesConstructQueryRunner(String egoURI, DataSource dataSource, Log log){
|
||||
public EntitySubOrganizationTypesConstructQueryRunner(String egoURI, Dataset Dataset, Log log){
|
||||
this.egoURI = egoURI;
|
||||
this.dataSource = dataSource;
|
||||
this.Dataset = Dataset;
|
||||
//this.log = log;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class EntitySubOrganizationTypesConstructQueryRunner {
|
|||
|
||||
}
|
||||
|
||||
private Model executeQuery(Set<String> constructQueries, DataSource dataSource) {
|
||||
private Model executeQuery(Set<String> constructQueries, Dataset Dataset) {
|
||||
|
||||
Model constructedModel = ModelFactory.createDefaultModel();
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class EntitySubOrganizationTypesConstructQueryRunner {
|
|||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(
|
||||
query, dataSource);
|
||||
query, Dataset);
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
|
@ -160,7 +160,7 @@ public class EntitySubOrganizationTypesConstructQueryRunner {
|
|||
populateConstructQueries(constructQueries);
|
||||
|
||||
Model model = executeQuery(constructQueries,
|
||||
this.dataSource);
|
||||
this.Dataset);
|
||||
//model.write(System.out);
|
||||
return model;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
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.DataSource;
|
||||
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;
|
||||
|
@ -30,15 +30,15 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
|
||||
private String egoURI;
|
||||
|
||||
private DataSource dataSource;
|
||||
private Dataset Dataset;
|
||||
|
||||
private long before, after;
|
||||
|
||||
private Log log = LogFactory.getLog(EntityGrantCountConstructQueryRunner.class.getName());
|
||||
|
||||
public EntityGrantCountConstructQueryRunner(String egoURI, DataSource dataSource, Log log){
|
||||
public EntityGrantCountConstructQueryRunner(String egoURI, Dataset Dataset, Log log){
|
||||
this.egoURI = egoURI;
|
||||
this.dataSource = dataSource;
|
||||
this.Dataset = Dataset;
|
||||
//this.log = log;
|
||||
}
|
||||
|
||||
|
@ -55,14 +55,14 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForDateTimeValueofRoleForOneLevelDeep(String queryURI){
|
||||
private String generateConstructQueryForDateTimeValueofRoleForOneLevelDeep(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
||||
+ "?subOrganization core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||
+ "?dateTimeIntervalValue core:start ?startDate . "
|
||||
+ "?startDate core:dateTime ?startDateTimeValue . "
|
||||
|
@ -74,7 +74,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
||||
+ "?subOrganization core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||
+ "?dateTimeIntervalValue core:start ?startDate . "
|
||||
+ "?startDate core:dateTime ?startDateTimeValue . "
|
||||
|
@ -83,7 +83,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
||||
+ "?subOrganization core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||
+ "?dateTimeIntervalValue core:end ?endDate . "
|
||||
+ "?endDate core:dateTime ?endDateTimeValue . "
|
||||
|
@ -93,14 +93,14 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForDateTimeValueofGrantForOneLevelDeep(String queryURI){
|
||||
private String generateConstructQueryForDateTimeValueofGrantForOneLevelDeep(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
||||
+ "?subOrganization core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
||||
|
@ -113,7 +113,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
||||
+ "?subOrganization core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
||||
|
@ -123,7 +123,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
||||
+ "?subOrganization core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||
+ "?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
|
||||
|
@ -134,13 +134,13 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForDateTimeValueofRole(String queryURI){
|
||||
private String generateConstructQueryForDateTimeValueofRole(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||
+ "?dateTimeIntervalValue core:start ?startDate . "
|
||||
+ "?startDate core:dateTime ?startDateTimeValue . "
|
||||
|
@ -151,7 +151,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "{"
|
||||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||
+ "?dateTimeIntervalValue core:start ?startDate . "
|
||||
+ "?startDate core:dateTime ?startDateTimeValue "
|
||||
|
@ -159,7 +159,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "{"
|
||||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||
+ "?dateTimeIntervalValue core:end ?endDate . "
|
||||
+ "?endDate core:dateTime ?endDateTimeValue "
|
||||
|
@ -169,13 +169,13 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForDateTimeValueofGrant(String queryURI){
|
||||
private String generateConstructQueryForDateTimeValueofGrant(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
||||
|
@ -187,7 +187,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "{"
|
||||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
||||
|
@ -196,7 +196,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "{"
|
||||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||
+ "?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
|
||||
|
@ -207,7 +207,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
return sparqlQuery;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForSubOrganizations(String queryURI){
|
||||
private String generateConstructQueryForSubOrganizations(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
|
||||
|
@ -217,7 +217,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "?subOrganization core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person rdfs:label ?PersonLabel ."
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant rdfs:label ?GrantLabel "
|
||||
+"}"
|
||||
|
@ -227,7 +227,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "?subOrganization core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person rdfs:label ?PersonLabel ."
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant rdfs:label ?GrantLabel "
|
||||
+ "}" ;
|
||||
|
@ -237,7 +237,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
|
||||
}
|
||||
|
||||
private String generateConstructQueryForPersons(String queryURI){
|
||||
private String generateConstructQueryForPersons(String queryURI, String preboundProperty){
|
||||
|
||||
String sparqlQuery =
|
||||
|
||||
|
@ -245,7 +245,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person rdfs:label ?PersonLabel ."
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant rdfs:label ?GrantLabel "
|
||||
+"}"
|
||||
|
@ -253,7 +253,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||
+ "?Position core:positionForPerson ?Person . "
|
||||
+ "?Person rdfs:label ?PersonLabel ."
|
||||
+ "?Person ?preboundProperty ?Role . "
|
||||
+ "?Person " + preboundProperty + " ?Role . "
|
||||
+ "?Role core:roleIn ?Grant ."
|
||||
+ "?Grant rdfs:label ?GrantLabel "
|
||||
+ "}" ;
|
||||
|
@ -265,7 +265,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
|
||||
|
||||
|
||||
private Model executeQuery(Set<String> constructQueries, DataSource dataSource) {
|
||||
private Model executeQuery(Set<String> constructQueries, Dataset Dataset) {
|
||||
|
||||
Model constructedModel = ModelFactory.createDefaultModel();
|
||||
|
||||
|
@ -287,7 +287,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(
|
||||
query, dataSource);
|
||||
query, Dataset);
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
|
@ -328,7 +328,7 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
populateConstructQueries(constructQueries);
|
||||
|
||||
Model model = executeQuery(constructQueries,
|
||||
this.dataSource);
|
||||
this.Dataset);
|
||||
|
||||
return model;
|
||||
|
||||
|
@ -337,13 +337,27 @@ public class EntityGrantCountConstructQueryRunner {
|
|||
private void populateConstructQueries(Set<String> constructQueries) {
|
||||
|
||||
constructQueries.add(generateConstructQueryForOrganizationLabel(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForSubOrganizations(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForPersons(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRoleForOneLevelDeep(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrantForOneLevelDeep(this.egoURI));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI));
|
||||
|
||||
constructQueries.add(generateConstructQueryForSubOrganizations(this.egoURI, "core:hasInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForPersons(this.egoURI, "core:hasInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRoleForOneLevelDeep(this.egoURI, "core:hasInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI, "core:hasInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrantForOneLevelDeep(this.egoURI, "core:hasInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI, "core:hasInvestigatorRole"));
|
||||
|
||||
constructQueries.add(generateConstructQueryForSubOrganizations(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForPersons(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRoleForOneLevelDeep(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrantForOneLevelDeep(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI, "core:hasPrincipalInvestigatorRole"));
|
||||
|
||||
constructQueries.add(generateConstructQueryForSubOrganizations(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForPersons(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRoleForOneLevelDeep(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrantForOneLevelDeep(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI, "core:hasCo-PrincipalInvestigatorRole"));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.google.gson.Gson;
|
|||
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.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
|
||||
|
@ -46,7 +46,7 @@ public class EntityGrantCountRequestHandler implements
|
|||
|
||||
@Override
|
||||
public ResponseValues generateStandardVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
String entityURI = vitroRequest
|
||||
|
@ -55,7 +55,7 @@ public class EntityGrantCountRequestHandler implements
|
|||
if (StringUtils.isNotBlank(entityURI)){
|
||||
|
||||
return getSubjectEntityAndGenerateResponse(vitroRequest, log,
|
||||
dataSource, entityURI);
|
||||
Dataset, entityURI);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -81,16 +81,16 @@ public class EntityGrantCountRequestHandler implements
|
|||
} else {
|
||||
|
||||
return getSubjectEntityAndGenerateResponse(vitroRequest,
|
||||
log, dataSource,
|
||||
log, Dataset,
|
||||
staffProvidedHighestLevelOrganization);
|
||||
}
|
||||
}
|
||||
|
||||
String highestLevelOrgURI = EntityComparisonUtilityFunctions.getHighestLevelOrganizationURI(log,
|
||||
dataSource);
|
||||
Dataset);
|
||||
|
||||
return getSubjectEntityAndGenerateResponse(vitroRequest, log,
|
||||
dataSource, highestLevelOrgURI);
|
||||
Dataset, highestLevelOrgURI);
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,13 +98,13 @@ public class EntityGrantCountRequestHandler implements
|
|||
|
||||
@Override
|
||||
public Map<String, String> generateDataVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
String entityURI = vitroRequest
|
||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||
|
||||
EntityGrantCountConstructQueryRunner constructQueryRunner = new EntityGrantCountConstructQueryRunner(entityURI, dataSource, log);
|
||||
EntityGrantCountConstructQueryRunner constructQueryRunner = new EntityGrantCountConstructQueryRunner(entityURI, Dataset, log);
|
||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||
|
||||
QueryRunner<Entity> queryManager = new EntityGrantCountQueryRunner(
|
||||
|
@ -114,7 +114,7 @@ public class EntityGrantCountRequestHandler implements
|
|||
|
||||
|
||||
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||
log, dataSource, entityURI);
|
||||
log, Dataset, entityURI);
|
||||
|
||||
return prepareDataResponse(entity, entity.getSubEntities(),subOrganizationTypesResult);
|
||||
|
||||
|
@ -122,16 +122,16 @@ public class EntityGrantCountRequestHandler implements
|
|||
|
||||
@Override
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException {
|
||||
Dataset Dataset) throws MalformedQueryParametersException {
|
||||
throw new UnsupportedOperationException("Entity Grant Count does not provide Ajax Response.");
|
||||
}
|
||||
|
||||
private ResponseValues getSubjectEntityAndGenerateResponse(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource,
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset,
|
||||
String subjectEntityURI)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
EntityGrantCountConstructQueryRunner constructQueryRunner = new EntityGrantCountConstructQueryRunner(subjectEntityURI, dataSource, log);
|
||||
EntityGrantCountConstructQueryRunner constructQueryRunner = new EntityGrantCountConstructQueryRunner(subjectEntityURI, Dataset, log);
|
||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||
|
||||
QueryRunner<Entity> queryManager = new EntityGrantCountQueryRunner(
|
||||
|
@ -146,18 +146,18 @@ public class EntityGrantCountRequestHandler implements
|
|||
} else {
|
||||
|
||||
return getSubEntityTypesAndRenderStandaloneResponse(
|
||||
vitroRequest, log, dataSource,
|
||||
vitroRequest, log, Dataset,
|
||||
subjectEntityURI, entity);
|
||||
}
|
||||
}
|
||||
|
||||
private ResponseValues getSubEntityTypesAndRenderStandaloneResponse(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource,
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset,
|
||||
String subjectOrganization, Entity entity)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||
log, dataSource, subjectOrganization);
|
||||
log, Dataset, subjectOrganization);
|
||||
|
||||
return prepareStandaloneResponse(vitroRequest, entity, subjectOrganization,
|
||||
subOrganizationTypesResult);
|
||||
|
|
|
@ -11,7 +11,7 @@ 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.DataSource;
|
||||
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;
|
||||
|
@ -40,7 +40,7 @@ public class PersonGrantCountQueryRunner implements QueryRunner<Set<Grant>>{
|
|||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private String personURI;
|
||||
private DataSource dataSource;
|
||||
private Dataset Dataset;
|
||||
private Individual principalInvestigator;
|
||||
|
||||
public Individual getPrincipalInvestigator(){
|
||||
|
@ -83,10 +83,10 @@ public class PersonGrantCountQueryRunner implements QueryRunner<Set<Grant>>{
|
|||
+ "}" ;
|
||||
|
||||
|
||||
public PersonGrantCountQueryRunner(String personURI, DataSource dataSource, Log log){
|
||||
public PersonGrantCountQueryRunner(String personURI, Dataset Dataset, Log log){
|
||||
|
||||
this.personURI = personURI;
|
||||
this.dataSource = dataSource;
|
||||
this.Dataset = Dataset;
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
|
@ -142,12 +142,12 @@ public class PersonGrantCountQueryRunner implements QueryRunner<Set<Grant>>{
|
|||
return PIGrant;
|
||||
}
|
||||
|
||||
private ResultSet executeQuery(String queryURI, DataSource dataSource){
|
||||
private ResultSet executeQuery(String queryURI, Dataset Dataset){
|
||||
|
||||
QueryExecution queryExecution = null;
|
||||
|
||||
Query query = QueryFactory.create(getSparqlQuery(queryURI), SYNTAX);
|
||||
queryExecution = QueryExecutionFactory.create(query,dataSource);
|
||||
queryExecution = QueryExecutionFactory.create(query,Dataset);
|
||||
|
||||
return queryExecution.execSelect();
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public class PersonGrantCountQueryRunner implements QueryRunner<Set<Grant>>{
|
|||
throw new MalformedQueryParametersException("URL parameter is either null or empty.");
|
||||
}
|
||||
|
||||
ResultSet resultSet = executeQuery(this.personURI, this.dataSource);
|
||||
ResultSet resultSet = executeQuery(this.personURI, this.Dataset);
|
||||
|
||||
return createJavaValueObjects(resultSet);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.apache.commons.lang.StringEscapeUtils;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import com.hp.hpl.jena.query.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -47,14 +47,14 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
|||
|
||||
@Override
|
||||
public Map<String, String> generateDataVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
|
||||
String personURI = vitroRequest
|
||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||
|
||||
QueryRunner<Set<Grant>> queryManager = new PersonGrantCountQueryRunner(personURI, dataSource, log );
|
||||
QueryRunner<Set<Grant>> queryManager = new PersonGrantCountQueryRunner(personURI, Dataset, log );
|
||||
|
||||
Set<Grant> piGrants = queryManager.getQueryResult();
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
|||
|
||||
@Override
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException {
|
||||
Dataset Dataset) throws MalformedQueryParametersException {
|
||||
|
||||
String personURI = vitroRequest
|
||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||
|
@ -88,7 +88,7 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
|||
String visContainer = vitroRequest
|
||||
.getParameter(VisualizationFrameworkConstants.VIS_CONTAINER_KEY);
|
||||
|
||||
QueryRunner<Set<Grant>> queryManager = new PersonGrantCountQueryRunner(personURI, dataSource, log );
|
||||
QueryRunner<Set<Grant>> queryManager = new PersonGrantCountQueryRunner(personURI, Dataset, log );
|
||||
|
||||
Set<Grant> piGrants = queryManager.getQueryResult();
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
|||
|
||||
@Override
|
||||
public ResponseValues generateStandardVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
String personURI = vitroRequest
|
||||
|
@ -139,7 +139,7 @@ public class PersonGrantCountRequestHandler implements VisualizationRequestHandl
|
|||
String visContainer = vitroRequest
|
||||
.getParameter(VisualizationFrameworkConstants.VIS_CONTAINER_KEY);
|
||||
|
||||
QueryRunner<Set<Grant>> queryManager = new PersonGrantCountQueryRunner(personURI, dataSource, log );
|
||||
QueryRunner<Set<Grant>> queryManager = new PersonGrantCountQueryRunner(personURI, Dataset, log );
|
||||
|
||||
Set<Grant> piGrants = queryManager.getQueryResult();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import com.hp.hpl.jena.query.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Portal;
|
||||
|
@ -60,13 +60,13 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
|||
|
||||
@Override
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException {
|
||||
Dataset Dataset) throws MalformedQueryParametersException {
|
||||
throw new UnsupportedOperationException("Person Level does not provide Ajax Response.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> generateDataVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
throw new UnsupportedOperationException("Person Level does not provide Data Response.");
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
|||
|
||||
@Override
|
||||
public ResponseValues generateStandardVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
String egoURI = vitroRequest.getParameter(
|
||||
|
@ -86,12 +86,12 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
|||
|
||||
if (VisualizationFrameworkConstants.COPI_VIS_MODE.equalsIgnoreCase(visMode)){
|
||||
|
||||
CoPIGrantCountConstructQueryRunner constructQueryRunner = new CoPIGrantCountConstructQueryRunner(egoURI, dataSource, log);
|
||||
CoPIGrantCountConstructQueryRunner constructQueryRunner = new CoPIGrantCountConstructQueryRunner(egoURI, Dataset, log);
|
||||
Model constructedModel = constructQueryRunner.getConstructedModel();
|
||||
|
||||
QueryRunner<CoPIData> coPIQueryManager = new CoPIGrantCountQueryRunner(egoURI, constructedModel, log);
|
||||
|
||||
QueryRunner<Set<Grant>> grantQueryManager = new PersonGrantCountQueryRunner(egoURI, dataSource, log);
|
||||
QueryRunner<Set<Grant>> grantQueryManager = new PersonGrantCountQueryRunner(egoURI, Dataset, log);
|
||||
|
||||
CoPIData coPIData = coPIQueryManager.getQueryResult();
|
||||
|
||||
|
@ -146,9 +146,9 @@ public class PersonLevelRequestHandler implements VisualizationRequestHandler {
|
|||
|
||||
} else {
|
||||
|
||||
QueryRunner<CoAuthorshipData> coAuthorshipQueryManager = new CoAuthorshipQueryRunner(egoURI, dataSource, log);
|
||||
QueryRunner<CoAuthorshipData> coAuthorshipQueryManager = new CoAuthorshipQueryRunner(egoURI, Dataset, log);
|
||||
|
||||
QueryRunner<Set<BiboDocument>> publicationQueryManager = new PersonPublicationCountQueryRunner(egoURI, dataSource, log);
|
||||
QueryRunner<Set<BiboDocument>> publicationQueryManager = new PersonPublicationCountQueryRunner(egoURI, Dataset, log);
|
||||
|
||||
CoAuthorshipData coAuthorshipData = coAuthorshipQueryManager.getQueryResult();
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.personpubcount;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.query.Syntax;
|
||||
|
||||
public class PersonPublicationCountConstructQueryRunner {
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private String egoURI;
|
||||
|
||||
private Dataset Dataset;
|
||||
|
||||
private Log log = LogFactory.getLog(PersonPublicationCountConstructQueryRunner.class.getName());
|
||||
|
||||
private long before, after;
|
||||
|
||||
public PersonPublicationCountConstructQueryRunner(String egoURI, Dataset Dataset, Log log){
|
||||
this.egoURI = egoURI;
|
||||
this.Dataset = Dataset;
|
||||
//this.log = log;
|
||||
}
|
||||
|
||||
private String generateConstructQueryForAuthorLabel(String queryURI) {
|
||||
|
||||
String sparqlQuery =
|
||||
"CONSTRUCT { "
|
||||
+ "<"+queryURI+ "> rdfs:label ?authorLabel ."
|
||||
+ "}"
|
||||
+ "WHERE {"
|
||||
+ "<"+queryURI+ "> rdfs:label ?authorLabel ."
|
||||
+ "}";
|
||||
|
||||
return sparqlQuery;
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ 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.DataSource;
|
||||
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;
|
||||
|
@ -41,7 +41,7 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
|||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private String personURI;
|
||||
private DataSource dataSource;
|
||||
private Dataset Dataset;
|
||||
|
||||
private Individual author;
|
||||
|
||||
|
@ -71,10 +71,10 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
|||
+ "OPTIONAL { ?document vitro:description ?documentDescription }\n";
|
||||
|
||||
public PersonPublicationCountQueryRunner(String personURI,
|
||||
DataSource dataSource, Log log) {
|
||||
Dataset Dataset, Log log) {
|
||||
|
||||
this.personURI = personURI;
|
||||
this.dataSource = dataSource;
|
||||
this.Dataset = Dataset;
|
||||
this.log = log;
|
||||
|
||||
}
|
||||
|
@ -143,11 +143,11 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
|||
}
|
||||
|
||||
private ResultSet executeQuery(String queryURI,
|
||||
DataSource dataSource) {
|
||||
Dataset Dataset) {
|
||||
|
||||
QueryExecution queryExecution = null;
|
||||
Query query = QueryFactory.create(getSparqlQuery(queryURI), SYNTAX);
|
||||
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
||||
queryExecution = QueryExecutionFactory.create(query, Dataset);
|
||||
return queryExecution.execSelect();
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
|||
}
|
||||
|
||||
ResultSet resultSet = executeQuery(this.personURI,
|
||||
this.dataSource);
|
||||
this.Dataset);
|
||||
|
||||
return createJavaValueObjects(resultSet);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.apache.commons.lang.StringEscapeUtils;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import com.hp.hpl.jena.query.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.DocumentException;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
|
@ -54,7 +54,7 @@ VisualizationRequestHandler {
|
|||
|
||||
@Override
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException {
|
||||
Dataset Dataset) throws MalformedQueryParametersException {
|
||||
|
||||
String personURI = vitroRequest
|
||||
.getParameter(
|
||||
|
@ -70,7 +70,7 @@ VisualizationRequestHandler {
|
|||
|
||||
QueryRunner<Set<BiboDocument>> queryManager = new PersonPublicationCountQueryRunner(
|
||||
personURI,
|
||||
dataSource,
|
||||
Dataset,
|
||||
log);
|
||||
|
||||
Set<BiboDocument> authorDocuments = queryManager.getQueryResult();
|
||||
|
@ -108,14 +108,14 @@ VisualizationRequestHandler {
|
|||
|
||||
@Override
|
||||
public Map<String, String> generateDataVisualization(VitroRequest vitroRequest, Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException {
|
||||
Dataset Dataset) throws MalformedQueryParametersException {
|
||||
|
||||
String personURI = vitroRequest
|
||||
.getParameter(VisualizationFrameworkConstants.INDIVIDUAL_URI_KEY);
|
||||
|
||||
QueryRunner<Set<BiboDocument>> queryManager = new PersonPublicationCountQueryRunner(
|
||||
personURI,
|
||||
dataSource,
|
||||
Dataset,
|
||||
log);
|
||||
|
||||
Set<BiboDocument> authorDocuments = queryManager.getQueryResult();
|
||||
|
@ -137,7 +137,7 @@ VisualizationRequestHandler {
|
|||
|
||||
@Override
|
||||
public ResponseValues generateStandardVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
String personURI = vitroRequest.getParameter(
|
||||
|
@ -151,7 +151,7 @@ VisualizationRequestHandler {
|
|||
|
||||
QueryRunner<Set<BiboDocument>> queryManager = new PersonPublicationCountQueryRunner(
|
||||
personURI,
|
||||
dataSource,
|
||||
Dataset,
|
||||
log);
|
||||
|
||||
Set<BiboDocument> authorDocuments = queryManager.getQueryResult();
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.google.gson.Gson;
|
|||
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.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.query.QuerySolution;
|
||||
import com.hp.hpl.jena.query.ResultSet;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
|
@ -46,7 +46,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest,
|
||||
Log log,
|
||||
DataSource dataSource)
|
||||
Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
String individualURI = vitroRequest.getParameter(
|
||||
|
@ -70,7 +70,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
QueryRunner<GenericQueryMap> profileQueryHandler =
|
||||
new AllPropertiesQueryRunner(individualURI,
|
||||
filterRule,
|
||||
dataSource,
|
||||
Dataset,
|
||||
log);
|
||||
|
||||
GenericQueryMap profilePropertiesToValues =
|
||||
|
@ -105,7 +105,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
"",
|
||||
whereClause,
|
||||
"",
|
||||
dataSource, log);
|
||||
Dataset, log);
|
||||
|
||||
return getThumbnailInformation(imageQueryHandler.getQueryResult(),
|
||||
fieldLabelToOutputFieldLabel);
|
||||
|
@ -127,7 +127,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
aggregationRules,
|
||||
whereClause,
|
||||
groupOrderClause,
|
||||
dataSource, log);
|
||||
Dataset, log);
|
||||
|
||||
Gson publicationsInformation = new Gson();
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
aggregationRules,
|
||||
whereClause,
|
||||
"",
|
||||
dataSource, log);
|
||||
Dataset, log);
|
||||
|
||||
Gson grantsInformation = new Gson();
|
||||
|
||||
|
@ -268,7 +268,7 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
aggregationRules,
|
||||
whereClause,
|
||||
groupOrderClause,
|
||||
dataSource, log);
|
||||
Dataset, log);
|
||||
|
||||
return getHighestLevelOrganizationTemporalGraphVisURL(
|
||||
highestLevelOrganizationQueryHandler.getQueryResult(),
|
||||
|
@ -395,14 +395,14 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
|
||||
@Override
|
||||
public Map<String, String> generateDataVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
throw new UnsupportedOperationException("Utilities does not provide Data Response.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseValues generateStandardVisualization(
|
||||
VitroRequest vitroRequest, Log log, DataSource dataSource)
|
||||
VitroRequest vitroRequest, Log log, Dataset Dataset)
|
||||
throws MalformedQueryParametersException {
|
||||
throw new UnsupportedOperationException("Utilities does not provide Standard Response.");
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ 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.DataSource;
|
||||
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;
|
||||
|
@ -36,18 +36,18 @@ public class AllPropertiesQueryRunner implements QueryRunner<GenericQueryMap> {
|
|||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private String filterRule, individualURI;
|
||||
private DataSource dataSource;
|
||||
private Dataset Dataset;
|
||||
|
||||
private Log log;
|
||||
|
||||
public AllPropertiesQueryRunner(String individualURI,
|
||||
String filterRule,
|
||||
DataSource dataSource,
|
||||
Dataset Dataset,
|
||||
Log log) {
|
||||
|
||||
this.individualURI = individualURI;
|
||||
this.filterRule = filterRule;
|
||||
this.dataSource = dataSource;
|
||||
this.Dataset = Dataset;
|
||||
this.log = log;
|
||||
|
||||
}
|
||||
|
@ -74,12 +74,12 @@ public class AllPropertiesQueryRunner implements QueryRunner<GenericQueryMap> {
|
|||
}
|
||||
|
||||
private ResultSet executeQuery(String queryText,
|
||||
DataSource dataSource) {
|
||||
Dataset Dataset) {
|
||||
|
||||
QueryExecution queryExecution = null;
|
||||
Query query = QueryFactory.create(queryText, SYNTAX);
|
||||
|
||||
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
||||
queryExecution = QueryExecutionFactory.create(query, Dataset);
|
||||
return queryExecution.execSelect();
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class AllPropertiesQueryRunner implements QueryRunner<GenericQueryMap> {
|
|||
ResultSet resultSet = executeQuery(generateGenericSparqlQuery(
|
||||
this.individualURI,
|
||||
this.filterRule),
|
||||
this.dataSource);
|
||||
this.Dataset);
|
||||
|
||||
return createJavaValueObjects(resultSet);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import com.hp.hpl.jena.query.DataSource;
|
||||
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;
|
||||
|
@ -30,7 +30,7 @@ public class GenericQueryRunner implements QueryRunner<ResultSet> {
|
|||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private String whereClause;
|
||||
private DataSource dataSource;
|
||||
private Dataset Dataset;
|
||||
|
||||
private Log log;
|
||||
|
||||
|
@ -44,23 +44,23 @@ public class GenericQueryRunner implements QueryRunner<ResultSet> {
|
|||
String aggregationRules,
|
||||
String whereClause,
|
||||
String groupOrderClause,
|
||||
DataSource dataSource, Log log) {
|
||||
Dataset Dataset, Log log) {
|
||||
|
||||
this.fieldLabelToOutputFieldLabel = fieldLabelToOutputFieldLabel;
|
||||
this.aggregationRules = aggregationRules;
|
||||
this.whereClause = whereClause;
|
||||
this.groupOrderClause = groupOrderClause;
|
||||
this.dataSource = dataSource;
|
||||
this.Dataset = Dataset;
|
||||
this.log = log;
|
||||
|
||||
}
|
||||
|
||||
private ResultSet executeQuery(String queryText,
|
||||
DataSource dataSource) {
|
||||
Dataset Dataset) {
|
||||
|
||||
QueryExecution queryExecution = null;
|
||||
Query query = QueryFactory.create(queryText, SYNTAX);
|
||||
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
||||
queryExecution = QueryExecutionFactory.create(query, Dataset);
|
||||
return queryExecution.execSelect();
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class GenericQueryRunner implements QueryRunner<ResultSet> {
|
|||
throws MalformedQueryParametersException {
|
||||
|
||||
ResultSet resultSet = executeQuery(generateGenericSparqlQuery(),
|
||||
this.dataSource);
|
||||
this.Dataset);
|
||||
|
||||
return resultSet;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Map;
|
|||
import org.apache.commons.logging.Log;
|
||||
|
||||
import com.hp.hpl.jena.query.DataSource;
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||
|
@ -25,14 +26,14 @@ public interface VisualizationRequestHandler{
|
|||
|
||||
ResponseValues generateStandardVisualization(VitroRequest vitroRequest,
|
||||
Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException;
|
||||
Dataset dataSource) throws MalformedQueryParametersException;
|
||||
|
||||
Object generateAjaxVisualization(VitroRequest vitroRequest,
|
||||
Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException;
|
||||
Dataset dataSource) throws MalformedQueryParametersException;
|
||||
|
||||
Map<String, String> generateDataVisualization(VitroRequest vitroRequest,
|
||||
Log log,
|
||||
DataSource dataSource) throws MalformedQueryParametersException;
|
||||
Dataset dataSource) throws MalformedQueryParametersException;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue