diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/visualization/VisualizationController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/visualization/VisualizationController.java index e41dfab02..f7b0f2f37 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/visualization/VisualizationController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/visualization/VisualizationController.java @@ -36,7 +36,6 @@ import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -169,7 +168,7 @@ public class VisualizationController extends BaseEditController { response, vreq, rdfResultFormatParam); - + if (dataSource != null) { /* @@ -201,7 +200,7 @@ public class VisualizationController extends BaseEditController { * This is side-effecting because the visualization content is added * to the request object. * */ - visRequestHandler.generateVisualization(dataSource); + visRequestHandler.generateVisualization(this, dataSource); } else { log.error("ERROR! data model empoty"); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/visualization/VisualizationFrameworkConstants.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/visualization/VisualizationFrameworkConstants.java index 465648c9c..542a708c4 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/visualization/VisualizationFrameworkConstants.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/visualization/VisualizationFrameworkConstants.java @@ -3,20 +3,17 @@ package edu.cornell.mannlib.vitro.webapp.controller.visualization; public class VisualizationFrameworkConstants { public static final String VIS_CONTAINER_URL_HANDLE = "container"; - public static final String INDIVIDUAL_URI_URL_HANDLE = "uri"; - public static final String VIS_MODE_URL_HANDLE = "vis_mode"; - public static final String RENDER_MODE_URL_HANDLE = "render_mode"; + + public static final String STANDALONE_RENDER_MODE_URL_VALUE = "standalone"; - public static final String DYNAMIC_RENDER_MODE_URL_VALUE = "dynamic"; - public static final String DATA_RENDER_MODE_URL_VALUE = "data"; - public static final String PDF_RENDER_MODE_URL_VALUE = "pdf"; + public static final String IMAGE_VIS_MODE_URL_VALUE = "image"; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/QueryHandler.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/QueryHandler.java index 380a8d470..7ff6b755a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/QueryHandler.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/QueryHandler.java @@ -161,6 +161,8 @@ public class QueryHandler { egoCoAuthorEdge = new Edge(egoNode, coAuthorNode, biboDocument, edgeIDGenerator); edges.add(egoCoAuthorEdge); } + + } /* @@ -326,7 +328,7 @@ public class QueryHandler { private String generateEgoCoAuthorshipSparqlQuery(String queryURI) { // Resource uri1 = ResourceFactory.createResource(queryURI); - String sparqlQuery = QueryConstants.SPARQL_QUERY_PREFIXES + String sparqlQuery = QueryConstants.getSparqlPrefixQuery() + "SELECT " + " (str(<" + queryURI + ">) as ?" + QueryFieldLabels.AUTHOR_URL + ") " + " (str(?authorLabel) as ?" + QueryFieldLabels.AUTHOR_LABEL + ") " @@ -347,7 +349,7 @@ public class QueryHandler { + "OPTIONAL { ?document vitro:moniker ?documentMoniker } . " + "OPTIONAL { ?document vitro:blurb ?documentBlurb } . " + "OPTIONAL { ?document vitro:description ?documentDescription } " - + "FILTER (<" + queryURI + "> != ?coAuthorPerson ) . " +// + "FILTER (<" + queryURI + "> != ?coAuthorPerson ) . " + "}"; System.out.println(sparqlQuery); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/VisualizationRequestHandler.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/VisualizationRequestHandler.java index b46297008..b12a73153 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/VisualizationRequestHandler.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/coauthorship/VisualizationRequestHandler.java @@ -1,35 +1,28 @@ package edu.cornell.mannlib.vitro.webapp.visualization.coauthorship; -import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; +import java.util.Set; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import com.hp.hpl.jena.query.DataSource; -import com.itextpdf.text.Document; -import com.itextpdf.text.DocumentException; -import com.itextpdf.text.pdf.PdfWriter; import edu.cornell.mannlib.vitro.webapp.beans.Portal; import edu.cornell.mannlib.vitro.webapp.controller.Controllers; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationController; import edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationFrameworkConstants; -import edu.cornell.mannlib.vitro.webapp.visualization.PDFDocument; -import edu.cornell.mannlib.vitro.webapp.visualization.constants.VisConstants; +import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; -import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.BiboDocument; -import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Individual; +import edu.cornell.mannlib.vitro.webapp.visualization.utils.GenericQueryHandler; +import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.GenericQueryMap; public class VisualizationRequestHandler { @@ -48,7 +41,7 @@ public class VisualizationRequestHandler { } - public void generateVisualization(DataSource dataSource) { + public void generateVisualization(VisualizationController visualizationController, DataSource dataSource) { String resultFormatParam = "RS_TEXT"; String rdfResultFormatParam = "RDF/XML-ABBREV"; @@ -60,6 +53,103 @@ public class VisualizationRequestHandler { String visMode = vitroRequest.getParameter(VisualizationFrameworkConstants.VIS_MODE_URL_HANDLE); String visContainer = vitroRequest.getParameter(VisualizationFrameworkConstants.VIS_CONTAINER_URL_HANDLE); + + + + /* + * If the data being requested is about a standalone image, which is used when we want + * to render an image & other info for a co-author OR ego for that matter. + * */ + if (VisualizationFrameworkConstants.DATA_RENDER_MODE_URL_VALUE.equalsIgnoreCase(renderMode) + && VisualizationFrameworkConstants.IMAGE_VIS_MODE_URL_VALUE.equalsIgnoreCase(visMode) ) { + + + String filterRule = "?predicate = vitro:imageThumb"; + GenericQueryHandler imageQueryHandler = new GenericQueryHandler(egoURIParam, + filterRule, + resultFormatParam, + rdfResultFormatParam, + dataSource, + log); + + try { + + GenericQueryMap imagePropertyToValues = imageQueryHandler.getJavaValueObjects(); + + String imagePath = ""; + /* + * If there is no imageThumb property we want to give the link to "No Image" snap. + * */ + if (imagePropertyToValues.size() > 0) { + + String vitroSparqlNamespace = QueryConstants.PREFIX_TO_NAMESPACE.get("vitro"); + String imageThumbProperty = vitroSparqlNamespace + "imageThumb"; + + Set personImageThumbPaths = imagePropertyToValues.get(imageThumbProperty); + + /* + * Although we know that there can be only one imagePath we are restricted by Java's + * expression power. + * */ + for (String providedImagePath : personImageThumbPaths) { + imagePath = "/images/" + providedImagePath; + } + + String imageServerPath = visualizationController.getServletContext().getRealPath(imagePath); + + File imageFile = new File(imageServerPath) ; + + if (imageFile == null) { + + Portal portal = vitroRequest.getPortal(); + String themeDir = portal != null ? portal.getThemeDir() : Portal.DEFAULT_THEME_DIR_FROM_CONTEXT; + + System.out.println("bfore cxtpth " + themeDir); + + themeDir = vitroRequest.getContextPath() + '/' + themeDir; + + System.out.println("bfore cxtpth " + themeDir); + + imagePath = themeDir + "site_icons/visualization/coauthorship/no_image.png"; + + System.out.println(imagePath); + + } + + + } else { + + Portal portal = vitroRequest.getPortal(); + String themeDir = portal != null ? portal.getThemeDir() : Portal.DEFAULT_THEME_DIR_FROM_CONTEXT; + + System.out.println("bfore cxtpth " + themeDir); + + themeDir = vitroRequest.getContextPath() + '/' + themeDir; + + System.out.println("bfore cxtpth " + themeDir); + + imagePath = themeDir + "site_icons/visualization/coauthorship/no_image.png"; + + System.out.println(imagePath); + + + + } + + + } catch (MalformedQueryParametersException e) { + try { + handleMalformedParameters(e.getMessage()); + } catch (ServletException e1) { + log.error(e1.getStackTrace()); + } catch (IOException e1) { + log.error(e1.getStackTrace()); + } + return; + } + + } + QueryHandler queryManager = new QueryHandler(egoURIParam, @@ -80,13 +170,17 @@ public class VisualizationRequestHandler { * It is ugly! * */ if (VisualizationFrameworkConstants.DATA_RENDER_MODE_URL_VALUE.equalsIgnoreCase(renderMode)) { - prepareVisualizationQueryDataResponse(authorNodesAndEdges); - - return; + + /* + * When just the graphML file is required - based on which actual visualization will + * be rendered. + * */ + prepareVisualizationQueryDataResponse(authorNodesAndEdges); + return; + + } - - /* * Computations required to generate HTML for the sparklines & related context. * */ @@ -170,6 +264,23 @@ public class VisualizationRequestHandler { } } + private void prepareVisualizationQueryImageResponse(String imageURL) { + + response.setContentType("text/plain"); + + try { + + PrintWriter responseWriter = response.getWriter(); + + responseWriter.append(imageURL); + + responseWriter.close(); + + } catch (IOException e) { + e.printStackTrace(); + } + } + private void prepareVisualizationQueryStandaloneResponse(String egoURIParam, HttpServletRequest request, HttpServletResponse response, diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/collegepubcount/QueryHandler.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/collegepubcount/QueryHandler.java index 346f21dff..33a91f384 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/collegepubcount/QueryHandler.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/collegepubcount/QueryHandler.java @@ -240,7 +240,7 @@ public class QueryHandler { private String generateCollegeEmployeeSparqlQuery(String queryURI) { // Resource uri1 = ResourceFactory.createResource(queryURI); - String sparqlQuery = QueryConstants.SPARQL_QUERY_PREFIXES + String sparqlQuery = QueryConstants.getSparqlPrefixQuery() + "SELECT (str(?collegeLabel) as ?" + QueryFieldLabels.COLLEGE_LABEL + ") " + " (str(?department) as ?" + QueryFieldLabels.DEPARTMENT_URL + ") " + " (str(?departmentLabel) as ?" + QueryFieldLabels.DEPARTMENT_LABEL + ") " diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryConstants.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryConstants.java index d01ffd0a5..648612391 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryConstants.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryConstants.java @@ -1,8 +1,15 @@ package edu.cornell.mannlib.vitro.webapp.visualization.constants; +import java.util.HashMap; +import java.util.Map; + public class QueryConstants { - public static final String SPARQL_QUERY_PREFIXES = "" + + /* + * This is not supposed to be used. Will remove after verifying that the dynamic prefix + * section generation works. + * */ + public static final String SPARQL_QUERY_PREFIXES_DEP = "" + "PREFIX rdf: \n" + "PREFIX rdfs: \n" + "PREFIX vitro: \n" + @@ -10,7 +17,78 @@ public class QueryConstants { "PREFIX core: \n" + "PREFIX bibo: \n" + "PREFIX foaf: \n" + - "PREFIX aktp: \n"; + "PREFIX aktp: \n" + + "PREFIX xsd: \n" + + "PREFIX owl: \n" + + "PREFIX swrl: \n" + + "PREFIX swrlb: \n" + + "PREFIX far: \n" + + "PREFIX ai: \n" + + "PREFIX akts: \n" + + "PREFIX hr: \n" + + "PREFIX dcterms: \n" + + "PREFIX dcelem: \n" + + "PREFIX event: \n" + + "PREFIX geo: \n" + + "PREFIX mann: \n" + + "PREFIX pubmed: \n" + + "PREFIX rdfsyn: \n" + + "PREFIX skos: \n" + + "PREFIX socsci: \n" + + "PREFIX stars: \n" + + "PREFIX temp: \n" + + "PREFIX wos: \n"; + + + public static final Map PREFIX_TO_NAMESPACE = new HashMap() {{ + + put("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); + put("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); + put("xsd", "http://www.w3.org/2001/XMLSchema#"); + put("owl", "http://www.w3.org/2002/07/owl#"); + put("swrl", "http://www.w3.org/2003/11/swrl#"); + put("swrlb", "http://www.w3.org/2003/11/swrlb#"); + put("vitro", "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#"); + put("far", "http://vitro.mannlib.cornell.edu/ns/reporting#"); + put("ai", "http://vitro.mannlib.cornell.edu/ns/hotel#"); + put("aktp", "http://www.aktors.org/ontology/portal#"); + put("akts", "http://www.aktors.org/ontology/support#"); + put("bibo", "http://purl.org/ontology/bibo/"); + put("hr", "http://vivo.cornell.edu/ns/hr/0.9/hr.owl#"); + put("dcterms", "http://purl.org/dc/terms/"); + put("dcelem", "http://purl.org/dc/elements/1.1/"); + put("event", "http://purl.org/NET/c4dm/event.owl#"); + put("foaf", "http://xmlns.com/foaf/0.1/"); + put("geo", "http://aims.fao.org/aos/geopolitical.owl#"); + put("mann", "http://vivo.cornell.edu/ns/mannadditions/0.1#"); + put("pubmed", "http://vitro.mannlib.cornell.edu/ns/pubmed#"); + put("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); + put("rdfsyn", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); + put("skos", "http://www.w3.org/2004/02/skos/core#"); + put("socsci", "http://vivo.library.cornell.edu/ns/vivo/socsci/0.1#"); + put("stars", "http://vitro.mannlib.cornell.edu/ns/cornell/stars/classes#"); + put("temp", "http://vitro.mannlib.cornell.edu/ns/temp#"); + put("wos", "http://vivo.mannlib.cornell.edu/ns/ThomsonWOS/0.1#"); + put("core", "http://vivoweb.org/ontology/core#"); + put("vivo", "http://vivo.library.cornell.edu/ns/0.1#"); + + }}; + + + public static String getSparqlPrefixQuery() { + + StringBuilder prefixSection = new StringBuilder(); + + for (Map.Entry prefixEntry : PREFIX_TO_NAMESPACE.entrySet()) { + prefixSection.append("PREFIX " + prefixEntry.getKey() + ": <" + prefixEntry.getValue() + ">\n"); + } + + + return prefixSection.toString(); + + } } + + diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryFieldLabels.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryFieldLabels.java index 8d06f0689..01749d70a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryFieldLabels.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/constants/QueryFieldLabels.java @@ -2,6 +2,13 @@ package edu.cornell.mannlib.vitro.webapp.visualization.constants; public class QueryFieldLabels { + /* + * Generic Query related field labels + * */ + public static final String PREDICATE = "predicateLit"; + public static final String OBJECT = "objectLit"; + + /* * Document related field labels * */ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/personpubcount/QueryHandler.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/personpubcount/QueryHandler.java index 6782f11ce..809cffae5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/personpubcount/QueryHandler.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/personpubcount/QueryHandler.java @@ -162,7 +162,7 @@ public class QueryHandler { private String generateSparqlQuery(String queryURI) { // Resource uri1 = ResourceFactory.createResource(queryURI); - String sparqlQuery = QueryConstants.SPARQL_QUERY_PREFIXES + String sparqlQuery = QueryConstants.getSparqlPrefixQuery() + SPARQL_QUERY_COMMON_SELECT_CLAUSE + "(str(<" + queryURI + ">) as ?authPersonLit) " + "WHERE { " diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/utils/GenericQueryHandler.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/utils/GenericQueryHandler.java new file mode 100644 index 000000000..dc0b82b2b --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/utils/GenericQueryHandler.java @@ -0,0 +1,161 @@ +package edu.cornell.mannlib.vitro.webapp.visualization.utils; + +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.Query; +import com.hp.hpl.jena.query.QueryExecution; +import com.hp.hpl.jena.query.QueryExecutionFactory; +import com.hp.hpl.jena.query.QueryFactory; +import com.hp.hpl.jena.query.QuerySolution; +import com.hp.hpl.jena.query.ResultSet; +import com.hp.hpl.jena.query.Syntax; +import com.hp.hpl.jena.rdf.model.RDFNode; + +import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; +import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels; +import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; +import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.GenericQueryMap; + + + +/** + * Very dumb name of the class. change it. + * @author cdtank + * + */ +public class GenericQueryHandler { + + protected static final Syntax SYNTAX = Syntax.syntaxARQ; + + private String filterRule, individualURLParam, resultFormatParam, rdfResultFormatParam; + private DataSource dataSource; + + private Log log; + + public GenericQueryHandler(String individualURLParam, + String filterRule, + String resultFormatParam, + String rdfResultFormatParam, + DataSource dataSource, + Log log) { + + this.individualURLParam = individualURLParam; + this.filterRule = filterRule; + this.resultFormatParam = resultFormatParam; + this.rdfResultFormatParam = rdfResultFormatParam; + this.dataSource = dataSource; + this.log = log; + + } + + private GenericQueryMap createJavaValueObjects(ResultSet resultSet) { + + GenericQueryMap queryResultVO = new GenericQueryMap(); + + while (resultSet.hasNext()) { + QuerySolution solution = resultSet.nextSolution(); + + + /* + * We only want to create only ONE ego node. + * */ + RDFNode predicateNode = solution.get(QueryFieldLabels.PREDICATE); + RDFNode objectNode = solution.get(QueryFieldLabels.OBJECT); + + if (predicateNode != null && objectNode != null) { + queryResultVO.addEntry(predicateNode.toString(), + objectNode.toString()); + } + + } + + return queryResultVO; + } + + + private ResultSet executeQuery(String queryText, + String resultFormatParam, + String rdfResultFormatParam, + DataSource dataSource) { + + QueryExecution queryExecution = null; + try{ + Query query = QueryFactory.create(queryText, SYNTAX); + +// QuerySolutionMap qs = new QuerySolutionMap(); +// qs.add("authPerson", queryParam); // bind resource to s + + queryExecution = QueryExecutionFactory.create(query, dataSource); + + + //remocve this if loop after knowing what is describe & construct sparql stuff. + if (query.isSelectType()){ + return queryExecution.execSelect(); + } + } finally { + if(queryExecution != null) { + queryExecution.close(); + } + + } + return null; + } + + private String generateGenericSparqlQuery(String queryURI, String filterRule) { +// Resource uri1 = ResourceFactory.createResource(queryURI); + String filterClause; + + if (filterRule == null || filterRule.trim().isEmpty()) { + filterClause = ""; + } else { + filterClause = "FILTER ( " + filterRule + " ) . "; + } + + String sparqlQuery = QueryConstants.getSparqlPrefixQuery() + + "SELECT " + + " (str(?predicate) as ?" + QueryFieldLabels.PREDICATE + ") " + + " (str(?object) as ?" + QueryFieldLabels.OBJECT + ") " + + "WHERE { " + + "<" + queryURI + "> ?predicate ?object. " + + filterClause + + "}"; + + System.out.println(sparqlQuery); + + return sparqlQuery; + } + + + public GenericQueryMap getJavaValueObjects() + throws MalformedQueryParametersException { + + if (this.individualURLParam == null || "".equals(individualURLParam)) { + throw new MalformedQueryParametersException("URI parameter is either null or empty."); + } else { + + /* + * To test for the validity of the URI submitted. + * */ + IRIFactory iRIFactory = IRIFactory.jenaImplementation(); + IRI iri = iRIFactory.create(this.individualURLParam); + if (iri.hasViolation(false)) { + String errorMsg = ((Violation)iri.violations(false).next()).getShortMessage()+" "; + log.error("Generic Query " + errorMsg); + throw new MalformedQueryParametersException("URI provided for an individual is malformed."); + } + } + + ResultSet resultSet = executeQuery(generateGenericSparqlQuery(this.individualURLParam, this.filterRule), + this.resultFormatParam, + this.rdfResultFormatParam, + this.dataSource); + + return createJavaValueObjects(resultSet); + } + + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/valueobjects/GenericQueryMap.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/valueobjects/GenericQueryMap.java new file mode 100644 index 000000000..1a35f2558 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/visualization/valueobjects/GenericQueryMap.java @@ -0,0 +1,39 @@ +package edu.cornell.mannlib.vitro.webapp.visualization.valueobjects; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; + +/** + * Right now this is just acting as a hashmap but in future we would want to provide + * more detailed info other than just what properties had what values. E.g. we + * could parse properties (& its values) to look for what namespaces are used. + * @author cdtank + * + */ +@SuppressWarnings("serial") +public class GenericQueryMap extends HashMap> { + + public GenericQueryMap() { + super(); + } + + public void addEntry(String property, String value) { + + Set values; + + if (this.containsKey(property)) { + + values = this.get(property); + values.add(value); + + } else { + + values = new HashSet(); + values.add(value); + this.put(property, values); + + } + } + +} diff --git a/webapp/web/templates/visualization/dummy_vis_client.jsp b/webapp/web/templates/visualization/dummy_vis_client.jsp index aa0aa4263..65f4a98fe 100644 --- a/webapp/web/templates/visualization/dummy_vis_client.jsp +++ b/webapp/web/templates/visualization/dummy_vis_client.jsp @@ -93,12 +93,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +