1) Removed entry for freemarker in visualization-beans-injection.xml
2) Commented out the part related to query.isSelectType() in all the QueryRunners 3) Added a generalized query for temporal vis that doesn't impose hierarchy. (Even if there are only people in a University/School, it works!) 4) Added print method to CoPIData
This commit is contained in:
parent
080458b688
commit
7b9a7cf5e2
9 changed files with 184 additions and 162 deletions
|
@ -21,11 +21,6 @@
|
||||||
class="edu.cornell.mannlib.vitro.webapp.visualization.entitycomparison.EntityPublicationCountRequestHandler" />
|
class="edu.cornell.mannlib.vitro.webapp.visualization.entitycomparison.EntityPublicationCountRequestHandler" />
|
||||||
<bean id="coprincipalinvestigator"
|
<bean id="coprincipalinvestigator"
|
||||||
class="edu.cornell.mannlib.vitro.webapp.visualization.coprincipalinvestigator.CoPIGrantCountRequestHandler" />
|
class="edu.cornell.mannlib.vitro.webapp.visualization.coprincipalinvestigator.CoPIGrantCountRequestHandler" />
|
||||||
<bean id="freemarker"
|
|
||||||
class="edu.cornell.mannlib.vitro.webapp.visualization.freemarker.FreemarkerRequestHandler" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<bean id="visualizationInjector"
|
<bean id="visualizationInjector"
|
||||||
class="edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationInjector">
|
class="edu.cornell.mannlib.vitro.webapp.controller.visualization.VisualizationInjector">
|
||||||
|
@ -49,9 +44,6 @@
|
||||||
<entry key="coprincipalinvestigator">
|
<entry key="coprincipalinvestigator">
|
||||||
<ref bean="coprincipalinvestigator"></ref>
|
<ref bean="coprincipalinvestigator"></ref>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="freemarker">
|
|
||||||
<ref bean="freemarker"></ref>
|
|
||||||
</entry>
|
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
|
|
@ -399,23 +399,23 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
||||||
DataSource dataSource) {
|
DataSource dataSource) {
|
||||||
|
|
||||||
QueryExecution queryExecution = null;
|
QueryExecution queryExecution = null;
|
||||||
try {
|
// try {
|
||||||
Query query = QueryFactory.create(queryText, SYNTAX);
|
Query query = QueryFactory.create(queryText, SYNTAX);
|
||||||
|
|
||||||
// QuerySolutionMap qs = new QuerySolutionMap();
|
// QuerySolutionMap qs = new QuerySolutionMap();
|
||||||
// qs.add("authPerson", queryParam); // bind resource to s
|
// qs.add("authPerson", queryParam); // bind resource to s
|
||||||
|
|
||||||
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
||||||
|
System.out.println("\n\nquery.isSelectType() is "+ query.isSelectType()+ " \n\n");
|
||||||
if (query.isSelectType()) {
|
// if (query.isSelectType()) {
|
||||||
return queryExecution.execSelect();
|
return queryExecution.execSelect();
|
||||||
}
|
// }
|
||||||
} finally {
|
// } finally {
|
||||||
if (queryExecution != null) {
|
// if (queryExecution != null) {
|
||||||
queryExecution.close();
|
// queryExecution.close();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateEgoCoAuthorshipSparqlQuery(String queryURI) {
|
private String generateEgoCoAuthorshipSparqlQuery(String queryURI) {
|
||||||
|
|
|
@ -95,20 +95,20 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CoPIData> {
|
||||||
private ResultSet executeQuery(String queryText, DataSource dataSource) {
|
private ResultSet executeQuery(String queryText, DataSource dataSource) {
|
||||||
|
|
||||||
QueryExecution queryExecution = null;
|
QueryExecution queryExecution = null;
|
||||||
try {
|
// try {
|
||||||
Query query = QueryFactory.create(queryText, SYNTAX);
|
Query query = QueryFactory.create(queryText, SYNTAX);
|
||||||
|
|
||||||
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
||||||
|
System.out.println("\n\nquery.isSelectType() is "+ query.isSelectType()+ " \n\n");
|
||||||
if (query.isSelectType()) {
|
// if (query.isSelectType()) {
|
||||||
return queryExecution.execSelect();
|
return queryExecution.execSelect();
|
||||||
}
|
// }
|
||||||
} finally {
|
// } finally {
|
||||||
if (queryExecution != null) {
|
// if (queryExecution != null) {
|
||||||
queryExecution.close();
|
// queryExecution.close();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoPIData getQueryResult()
|
public CoPIData getQueryResult()
|
||||||
|
@ -132,6 +132,7 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CoPIData> {
|
||||||
|
|
||||||
ResultSet resultSet = executeQuery(generateEgoCoPIquery(this.egoURI),
|
ResultSet resultSet = executeQuery(generateEgoCoPIquery(this.egoURI),
|
||||||
this.dataSource);
|
this.dataSource);
|
||||||
|
System.out.println("ResultSet ");
|
||||||
return createQueryResult(resultSet);
|
return createQueryResult(resultSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,11 +191,14 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CoPIData> {
|
||||||
nodes.add(egoNode);
|
nodes.add(egoNode);
|
||||||
nodeURLToVO.put(egoPIURLNode.toString(), egoNode);
|
nodeURLToVO.put(egoPIURLNode.toString(), egoNode);
|
||||||
|
|
||||||
|
|
||||||
RDFNode authorLabelNode = solution.get(QueryFieldLabels.PI_LABEL);
|
RDFNode authorLabelNode = solution.get(QueryFieldLabels.PI_LABEL);
|
||||||
if (authorLabelNode != null) {
|
if (authorLabelNode != null) {
|
||||||
egoNode.setNodeName(authorLabelNode.toString());
|
egoNode.setNodeName(authorLabelNode.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.println("\n----------------------------------");
|
||||||
|
System.out.println("PI: "+ egoNode.getIndividualLabel());
|
||||||
|
|
||||||
RDFNode grantNode = solution.get(QueryFieldLabels.GRANT_URL);
|
RDFNode grantNode = solution.get(QueryFieldLabels.GRANT_URL);
|
||||||
Grant grant;
|
Grant grant;
|
||||||
|
@ -207,6 +211,7 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CoPIData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
egoNode.addGrant(grant);
|
egoNode.addGrant(grant);
|
||||||
|
System.out.println("Adding grant: "+ grant.getIndividualLabel());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* After some discussion we concluded that for the purpose of this visualization
|
* After some discussion we concluded that for the purpose of this visualization
|
||||||
|
@ -237,6 +242,7 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CoPIData> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("Adding CO-PI: "+ coPINode.getIndividualLabel());
|
||||||
coPINode.addGrant(grant);
|
coPINode.addGrant(grant);
|
||||||
|
|
||||||
Set<CoPINode> coPIsForCurrentGrant;
|
Set<CoPINode> coPIsForCurrentGrant;
|
||||||
|
@ -251,9 +257,10 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CoPIData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
coPIsForCurrentGrant.add(coPINode);
|
coPIsForCurrentGrant.add(coPINode);
|
||||||
|
System.out.println("Co-PI for current grant : "+ coPINode.getIndividualLabel());
|
||||||
|
|
||||||
CoPIEdge egoCoPIEdge = getExistingEdge(egoNode, coPINode, edgeUniqueIdentifierToVO);
|
CoPIEdge egoCoPIEdge = getExistingEdge(egoNode, coPINode, edgeUniqueIdentifierToVO);
|
||||||
|
System.out.println("\n----------------------------------");
|
||||||
/*
|
/*
|
||||||
* If "egoCoPIEdge" is null it means that no edge exists in between the egoNode
|
* If "egoCoPIEdge" is null it means that no edge exists in between the egoNode
|
||||||
* & current coPINode. Else create a new edge, add it to the edges set & add
|
* & current coPINode. Else create a new edge, add it to the edges set & add
|
||||||
|
|
|
@ -41,6 +41,8 @@ public class CoPIGrantCountRequestHandler implements VisualizationRequestHandler
|
||||||
try{
|
try{
|
||||||
CoPIData PINodesAndEdges = queryManager.getQueryResult();
|
CoPIData PINodesAndEdges = queryManager.getQueryResult();
|
||||||
|
|
||||||
|
PINodesAndEdges.print();
|
||||||
|
|
||||||
if (VisualizationFrameworkConstants.DATA_RENDER_MODE
|
if (VisualizationFrameworkConstants.DATA_RENDER_MODE
|
||||||
.equalsIgnoreCase(renderMode)) {
|
.equalsIgnoreCase(renderMode)) {
|
||||||
|
|
||||||
|
|
|
@ -166,63 +166,91 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
|
||||||
private ResultSet executeQuery(String queryURI, DataSource dataSource) {
|
private ResultSet executeQuery(String queryURI, DataSource dataSource) {
|
||||||
|
|
||||||
QueryExecution queryExecution = null;
|
QueryExecution queryExecution = null;
|
||||||
try {
|
// try {
|
||||||
Query query = QueryFactory.create(
|
Query query = QueryFactory.create(
|
||||||
getSparqlQuery(queryURI, this.visMode), SYNTAX);
|
getSparqlQuery(queryURI, this.visMode), SYNTAX);
|
||||||
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
||||||
|
System.out.println("\n\nquery.isSelectType() is "+ query.isSelectType()+ " \n\n");
|
||||||
if (query.isSelectType()) {
|
|
||||||
return queryExecution.execSelect();
|
return queryExecution.execSelect();
|
||||||
}
|
// if (query.isSelectType()) {
|
||||||
} finally {
|
// return queryExecution.execSelect();
|
||||||
if (queryExecution != null) {
|
// }
|
||||||
queryExecution.close();
|
// } finally {
|
||||||
}
|
// if (queryExecution != null) {
|
||||||
}
|
// queryExecution.close();
|
||||||
return null;
|
// }
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSparqlQuery(String queryURI, String visMode) {
|
private String getSparqlQuery(String queryURI, String visMode) {
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|
||||||
if (visMode.equals("DEPARTMENT")) {
|
if (visMode.equals("DEPARTMENT")) {
|
||||||
result = getSparqlQueryForDepartment(queryURI);
|
// result = getSparqlQueryForDepartment(queryURI);
|
||||||
ENTITY_URL = QueryFieldLabels.DEPARTMENT_URL;
|
ENTITY_URL = QueryFieldLabels.DEPARTMENT_URL;
|
||||||
ENTITY_LABEL = QueryFieldLabels.DEPARTMENT_LABEL;
|
ENTITY_LABEL = QueryFieldLabels.DEPARTMENT_LABEL;
|
||||||
SUBENTITY_URL = QueryFieldLabels.PERSON_URL;
|
SUBENTITY_URL = QueryFieldLabels.PERSON_URL;
|
||||||
SUBENTITY_LABEL = QueryFieldLabels.PERSON_LABEL;
|
SUBENTITY_LABEL = QueryFieldLabels.PERSON_LABEL;
|
||||||
} else {
|
} else {
|
||||||
result = getSparqlQueryForOrganization(queryURI);
|
// result = getSparqlQueryForOrganization(queryURI);
|
||||||
ENTITY_URL = QueryFieldLabels.ORGANIZATION_URL;
|
ENTITY_URL = QueryFieldLabels.ORGANIZATION_URL;
|
||||||
ENTITY_LABEL = QueryFieldLabels.ORGANIZATION_LABEL;
|
ENTITY_LABEL = QueryFieldLabels.ORGANIZATION_LABEL;
|
||||||
SUBENTITY_URL = QueryFieldLabels.SUBORGANIZATION_URL;
|
SUBENTITY_URL = QueryFieldLabels.SUBORGANIZATION_URL;
|
||||||
SUBENTITY_LABEL = QueryFieldLabels.SUBORGANIZATION_LABEL;
|
SUBENTITY_LABEL = QueryFieldLabels.SUBORGANIZATION_LABEL;
|
||||||
}
|
}
|
||||||
|
result = getSparqlQueryForOrganization(queryURI);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSparqlQueryForDepartment(String queryURI) {
|
// private String getSparqlQueryForDepartment(String queryURI) {
|
||||||
|
//
|
||||||
|
// String sparqlQuery = QueryConstants.getSparqlPrefixQuery()
|
||||||
|
// + "SELECT (str(?DepartmentLabel) as ?departmentLabelLit) "
|
||||||
|
// + SPARQL_QUERY_COMMON_SELECT_CLAUSE + " (str(<" + queryURI
|
||||||
|
// + ">) as ?" + QueryFieldLabels.DEPARTMENT_URL + ") "
|
||||||
|
// + "WHERE { " + "<" + queryURI + "> rdf:type core:Department ;"
|
||||||
|
// + " rdfs:label ?DepartmentLabel ;"
|
||||||
|
// + " core:organizationForPosition ?Position . "
|
||||||
|
// + " ?Position rdf:type core:Position ;"
|
||||||
|
// + " core:positionForPerson ?Person . "
|
||||||
|
// + " ?Person core:authorInAuthorship ?Resource ; "
|
||||||
|
// + " rdfs:label ?PersonLabel ; core:personInPosition ?SecondaryPosition . "
|
||||||
|
// + " ?Resource core:linkedInformationResource ?Document ."
|
||||||
|
// + " ?SecondaryPosition rdfs:label ?SecondaryPositionLabel ."
|
||||||
|
// + SPARQL_QUERY_COMMON_WHERE_CLAUSE + "}"
|
||||||
|
// + " ORDER BY ?DocumentLabel";
|
||||||
|
// System.out.println("\nThe sparql query is :\n" + sparqlQuery);
|
||||||
|
// return sparqlQuery;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
String sparqlQuery = QueryConstants.getSparqlPrefixQuery()
|
// private String getSparqlQueryForOrganization(String queryURI) {
|
||||||
+ "SELECT (str(?DepartmentLabel) as ?departmentLabelLit) "
|
//
|
||||||
+ SPARQL_QUERY_COMMON_SELECT_CLAUSE + " (str(<" + queryURI
|
// String sparqlQuery = QueryConstants.getSparqlPrefixQuery()
|
||||||
+ ">) as ?" + QueryFieldLabels.DEPARTMENT_URL + ") "
|
// + "SELECT (str(?organizationLabel) as ?organizationLabelLit) "
|
||||||
+ "WHERE { " + "<" + queryURI + "> rdf:type core:Department ;"
|
// + " (str(?subOrganization) as ?subOrganizationLit) "
|
||||||
+ " rdfs:label ?DepartmentLabel ;"
|
// + " (str(?subOrganizationLabel) as ?subOrganizationLabelLit) "
|
||||||
+ " core:organizationForPosition ?Position . "
|
// + SPARQL_QUERY_COMMON_SELECT_CLAUSE + " (str(<" + queryURI
|
||||||
+ " ?Position rdf:type core:Position ;"
|
// + ">) as ?" + QueryFieldLabels.ORGANIZATION_URL + ") "
|
||||||
+ " core:positionForPerson ?Person . "
|
// + "WHERE { " + "<" + queryURI + "> rdf:type foaf:Organization ;"
|
||||||
+ " ?Person core:authorInAuthorship ?Resource ; "
|
// + " rdfs:label ?organizationLabel ;"
|
||||||
+ " rdfs:label ?PersonLabel ; core:personInPosition ?SecondaryPosition . "
|
// + " core:hasSubOrganization ?subOrganization ."
|
||||||
+ " ?Resource core:linkedInformationResource ?Document ."
|
// + " ?subOrganization rdfs:label ?subOrganizationLabel ;"
|
||||||
+ " ?SecondaryPosition rdfs:label ?SecondaryPositionLabel ."
|
// + " core:organizationForPosition ?Position . "
|
||||||
+ SPARQL_QUERY_COMMON_WHERE_CLAUSE + "}"
|
// + " ?Position rdf:type core:Position ;"
|
||||||
+ " ORDER BY ?DocumentLabel";
|
// + " core:positionForPerson ?Person . "
|
||||||
System.out.println("\nThe sparql query is :\n" + sparqlQuery);
|
// + " ?Person core:authorInAuthorship ?Resource ; "
|
||||||
return sparqlQuery;
|
// + " rdfs:label ?PersonLabel ; core:personInPosition ?SecondaryPosition . "
|
||||||
|
// + " ?Resource core:linkedInformationResource ?Document ."
|
||||||
}
|
// + " ?SecondaryPosition rdfs:label ?SecondaryPositionLabel ."
|
||||||
|
// + SPARQL_QUERY_COMMON_WHERE_CLAUSE + "}"
|
||||||
|
// + " ORDER BY ?DocumentLabel";
|
||||||
|
// System.out.println("\nThe sparql query is :\n" + sparqlQuery);
|
||||||
|
// return sparqlQuery;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
private String getSparqlQueryForOrganization(String queryURI){
|
private String getSparqlQueryForOrganization(String queryURI){
|
||||||
|
|
||||||
|
@ -230,22 +258,31 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
|
||||||
+ "SELECT (str(?organizationLabel) as ?organizationLabelLit) "
|
+ "SELECT (str(?organizationLabel) as ?organizationLabelLit) "
|
||||||
+ " (str(?subOrganization) as ?subOrganizationLit) "
|
+ " (str(?subOrganization) as ?subOrganizationLit) "
|
||||||
+ " (str(?subOrganizationLabel) as ?subOrganizationLabelLit) "
|
+ " (str(?subOrganizationLabel) as ?subOrganizationLabelLit) "
|
||||||
|
+ " (str(?DepartmentLabel) as ?departmentLabelLit) "
|
||||||
+ SPARQL_QUERY_COMMON_SELECT_CLAUSE + " (str(<" + queryURI
|
+ SPARQL_QUERY_COMMON_SELECT_CLAUSE + " (str(<" + queryURI
|
||||||
+ ">) as ?" + QueryFieldLabels.ORGANIZATION_URL + ") "
|
+ ">) as ?" + ENTITY_URL + ") "
|
||||||
+ "WHERE { " + "<" + queryURI + "> rdf:type foaf:Organization ;"
|
+ "WHERE { " + "<" + queryURI + "> rdf:type foaf:Organization ;"
|
||||||
+ " rdfs:label ?organizationLabel ;"
|
+ " rdfs:label ?organizationLabel ."
|
||||||
+ " core:hasSubOrganization ?subOrganization ."
|
+ "{ "
|
||||||
+ " ?subOrganization rdfs:label ?subOrganizationLabel ;"
|
+ "<" + queryURI + "> core:hasSubOrganization ?subOrganization ."
|
||||||
+ " core:organizationForPosition ?Position . "
|
+ "?subOrganization rdfs:label ?subOrganizationLabel ; core:organizationForPosition ?Position . "
|
||||||
+ " ?Position rdf:type core:Position ;"
|
+ " ?Position rdf:type core:Position ; core:positionForPerson ?Person ."
|
||||||
+ " core:positionForPerson ?Person . "
|
+ " ?Person core:authorInAuthorship ?Resource ; rdfs:label ?PersonLabel ; core:personInPosition ?SecondaryPosition . "
|
||||||
+ " ?Person core:authorInAuthorship ?Resource ; "
|
|
||||||
+ " rdfs:label ?PersonLabel ; core:personInPosition ?SecondaryPosition . "
|
|
||||||
+ " ?Resource core:linkedInformationResource ?Document . "
|
+ " ?Resource core:linkedInformationResource ?Document . "
|
||||||
+ " ?SecondaryPosition rdfs:label ?SecondaryPositionLabel ."
|
+ " ?SecondaryPosition rdfs:label ?SecondaryPositionLabel ."
|
||||||
+ SPARQL_QUERY_COMMON_WHERE_CLAUSE + "}"
|
+ SPARQL_QUERY_COMMON_WHERE_CLAUSE + "}"
|
||||||
+ " ORDER BY ?DocumentLabel";
|
+ "UNION "
|
||||||
|
+ "{ "
|
||||||
|
+ "<" + queryURI + "> rdf:type core:Department ; rdfs:label ?DepartmentLabel ; core:organizationForPosition ?Position ."
|
||||||
|
+ " ?Position rdf:type core:Position ; core:positionForPerson ?Person ."
|
||||||
|
+ " ?Person core:authorInAuthorship ?Resource ; rdfs:label ?PersonLabel ; core:personInPosition ?SecondaryPosition . "
|
||||||
|
+ " ?Resource core:linkedInformationResource ?Document ."
|
||||||
|
+ " ?SecondaryPosition rdfs:label ?SecondaryPositionLabel ."
|
||||||
|
+ SPARQL_QUERY_COMMON_WHERE_CLAUSE + "}"
|
||||||
|
+ "}";
|
||||||
|
|
||||||
System.out.println("\nThe sparql query is :\n" + sparqlQuery);
|
System.out.println("\nThe sparql query is :\n" + sparqlQuery);
|
||||||
|
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,6 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
String visContainer = vitroRequest
|
String visContainer = vitroRequest
|
||||||
.getParameter(VisualizationFrameworkConstants.VIS_CONTAINER_KEY);
|
.getParameter(VisualizationFrameworkConstants.VIS_CONTAINER_KEY);
|
||||||
|
|
||||||
System.out
|
|
||||||
.println("\nInside EntityPublicationCountRequestHandler! \n----------------------------------------- ");
|
|
||||||
System.out.println("\nEntity URI: " + entityURI + "\nRender Mode: "
|
|
||||||
+ renderMode + "\nVis Mode: " + ENTITY_VIS_MODE
|
|
||||||
+ "\nVis Containter: " + visContainer);
|
|
||||||
|
|
||||||
QueryRunner<Entity> queryManager = new EntityPublicationCountQueryRunner(
|
QueryRunner<Entity> queryManager = new EntityPublicationCountQueryRunner(
|
||||||
entityURI, dataSource, log, ENTITY_VIS_MODE);
|
entityURI, dataSource, log, ENTITY_VIS_MODE);
|
||||||
|
|
||||||
|
@ -77,50 +71,14 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
if (ENTITY_VIS_MODE.equals("DEPARTMENT")) {
|
if (ENTITY_VIS_MODE.equals("DEPARTMENT")) {
|
||||||
|
|
||||||
SUB_ENTITY_VIS_MODE = "PERSON";
|
SUB_ENTITY_VIS_MODE = "PERSON";
|
||||||
// System.out
|
|
||||||
// .println("\n\nDocuments within the Entity\n---------------------------------------------");
|
|
||||||
// for (BiboDocument document : entity.getPublications()) {
|
|
||||||
// System.out.println(document.getDocumentLabel() + " > "
|
|
||||||
// + document.getDocumentURL());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// System.out
|
|
||||||
// .println("\n\nSubEntities within the Entity\n---------------------------------------------");
|
|
||||||
//
|
|
||||||
// for (SubEntity person : entity.getSubEntities()) {
|
|
||||||
// System.out.println(person.getIndividualLabel());
|
|
||||||
// }
|
|
||||||
}else if (ENTITY_VIS_MODE.equals("SCHOOL")) {
|
}else if (ENTITY_VIS_MODE.equals("SCHOOL")) {
|
||||||
|
|
||||||
SUB_ENTITY_VIS_MODE = "DEPARTMENT";
|
SUB_ENTITY_VIS_MODE = "DEPARTMENT";
|
||||||
// System.out
|
|
||||||
// .println("\nDocuments within the Entity\n---------------------------------------------");
|
|
||||||
// for (BiboDocument document : entity.getPublications()) {
|
|
||||||
// System.out.println(document.getDocumentLabel() + " > "
|
|
||||||
// + document.getDocumentURL());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// System.out
|
|
||||||
// .println("\n\nSubEntities within the Entity\n---------------------------------------------");
|
|
||||||
// for (SubEntity department : entity.getSubEntities()) {
|
|
||||||
// System.out.println(department.getIndividualLabel());
|
|
||||||
// }
|
|
||||||
}else {
|
}else {
|
||||||
SUB_ENTITY_VIS_MODE = "SCHOOL";
|
SUB_ENTITY_VIS_MODE = "SCHOOL";
|
||||||
// System.out
|
|
||||||
// .println("\nDocuments within the Entity\n---------------------------------------------");
|
|
||||||
// for (BiboDocument document : entity.getPublications()) {
|
|
||||||
// System.out.println(document.getDocumentLabel() + " > "
|
|
||||||
// + document.getDocumentURL());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// System.out
|
|
||||||
// .println("\n\nSubEntities within the Entity\n---------------------------------------------");
|
|
||||||
//
|
|
||||||
// for (SubEntity school : entity.getSubEntities()) {
|
|
||||||
// System.out.println(school.getIndividualLabel());
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||||
|
@ -128,17 +86,8 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes.getQueryResult();
|
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes.getQueryResult();
|
||||||
|
|
||||||
System.out.println("Sub Organization Types With Their Labels \n------------------");
|
|
||||||
|
|
||||||
for(String label: subOrganizationTypesResult.keySet()){
|
|
||||||
System.out.println("Label :"+ label);
|
|
||||||
for(String type : subOrganizationTypesResult.get(label)){
|
|
||||||
System.out.println("type: "+ type);
|
|
||||||
}
|
|
||||||
System.out.println();
|
|
||||||
}
|
|
||||||
|
|
||||||
RequestDispatcher requestDispatcher = null;
|
RequestDispatcher requestDispatcher = null;
|
||||||
|
|
||||||
if (VisualizationFrameworkConstants.DATA_RENDER_MODE
|
if (VisualizationFrameworkConstants.DATA_RENDER_MODE
|
||||||
.equalsIgnoreCase(renderMode)) {
|
.equalsIgnoreCase(renderMode)) {
|
||||||
|
|
||||||
|
@ -288,7 +237,8 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
entityJson.getOrganizationType().addAll(subOrganizationTypesResult.get(entityJson.getLabel()));
|
entityJson.getOrganizationType().addAll(subOrganizationTypesResult.get(entityJson.getLabel()));
|
||||||
|
|
||||||
entityJson.setEntityURI(subentity.getIndividualURI());
|
entityJson.setEntityURI(subentity.getIndividualURI());
|
||||||
entityJson.setVisMode(SUB_ENTITY_VIS_MODE);
|
setEntityVisMode(entityJson);
|
||||||
|
//entityJson.setVisMode(SUB_ENTITY_VIS_MODE);
|
||||||
System.out.println("Adding object with uri: "
|
System.out.println("Adding object with uri: "
|
||||||
+ entityJson.getEntityURI() + " vismode: "
|
+ entityJson.getEntityURI() + " vismode: "
|
||||||
+ entityJson.getVisMode() + " label: "
|
+ entityJson.getVisMode() + " label: "
|
||||||
|
@ -301,4 +251,15 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
return json.toJson(subEntitiesJson);
|
return json.toJson(subEntitiesJson);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setEntityVisMode(JsonObject entityJson) {
|
||||||
|
if(entityJson.getOrganizationType().contains("Department")){
|
||||||
|
entityJson.setVisMode("DEPARTMENT");
|
||||||
|
}else if(entityJson.getOrganizationType().contains("School")){
|
||||||
|
entityJson.setVisMode("SCHOOL");
|
||||||
|
}else{
|
||||||
|
entityJson.setVisMode(SUB_ENTITY_VIS_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,20 +69,20 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
|
||||||
private ResultSet executeQuery(String queryURI, DataSource dataSource) {
|
private ResultSet executeQuery(String queryURI, DataSource dataSource) {
|
||||||
|
|
||||||
QueryExecution queryExecution = null;
|
QueryExecution queryExecution = null;
|
||||||
try {
|
// try {
|
||||||
Query query = QueryFactory.create(
|
Query query = QueryFactory.create(
|
||||||
getSparqlQuery(queryURI), SYNTAX);
|
getSparqlQuery(queryURI), SYNTAX);
|
||||||
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
||||||
|
System.out.println("\n\nquery.isSelectType() is "+ query.isSelectType()+ " \n\n");
|
||||||
if (query.isSelectType()) {
|
// if (query.isSelectType()) {
|
||||||
return queryExecution.execSelect();
|
return queryExecution.execSelect();
|
||||||
}
|
// }
|
||||||
} finally {
|
// } finally {
|
||||||
if (queryExecution != null) {
|
// if (queryExecution != null) {
|
||||||
queryExecution.close();
|
// queryExecution.close();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSparqlQuery(String queryURI) {
|
private String getSparqlQuery(String queryURI) {
|
||||||
|
@ -105,7 +105,7 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
|
||||||
+ " rdf:type ?subOrganizationType . "
|
+ " rdf:type ?subOrganizationType . "
|
||||||
+ " ?subOrganizationType rdfs:label ?subOrganizationTypeLabel ."
|
+ " ?subOrganizationType rdfs:label ?subOrganizationTypeLabel ."
|
||||||
+ "}";
|
+ "}";
|
||||||
System.out.println("\nThe sparql query is :\n" + sparqlQuery);
|
|
||||||
} else{
|
} else{
|
||||||
|
|
||||||
SUBORGANISATION_LABEL = QueryFieldLabels.PERSON_LABEL;
|
SUBORGANISATION_LABEL = QueryFieldLabels.PERSON_LABEL;
|
||||||
|
@ -128,6 +128,7 @@ public class EntitySubOrganizationTypesQueryRunner implements QueryRunner<Map<St
|
||||||
+ " ?personType rdfs:label ?personTypeLabel ."
|
+ " ?personType rdfs:label ?personTypeLabel ."
|
||||||
+ "}";;
|
+ "}";;
|
||||||
}
|
}
|
||||||
|
System.out.println("\nThe sparql query is :\n" + sparqlQuery);
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
||||||
DataSource dataSource) {
|
DataSource dataSource) {
|
||||||
|
|
||||||
QueryExecution queryExecution = null;
|
QueryExecution queryExecution = null;
|
||||||
try {
|
// try {
|
||||||
Query query = QueryFactory.create(getSparqlQuery(queryURI), SYNTAX);
|
Query query = QueryFactory.create(getSparqlQuery(queryURI), SYNTAX);
|
||||||
|
|
||||||
// QuerySolutionMap qs = new QuerySolutionMap();
|
// QuerySolutionMap qs = new QuerySolutionMap();
|
||||||
|
@ -160,15 +160,15 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
||||||
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
queryExecution = QueryExecutionFactory.create(query, dataSource);
|
||||||
|
|
||||||
|
|
||||||
if (query.isSelectType()) {
|
// if (query.isSelectType()) {
|
||||||
return queryExecution.execSelect();
|
return queryExecution.execSelect();
|
||||||
}
|
// }
|
||||||
} finally {
|
// } finally {
|
||||||
if (queryExecution != null) {
|
// if (queryExecution != null) {
|
||||||
queryExecution.close();
|
// queryExecution.close();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSparqlQuery(String queryURI) {
|
private String getSparqlQuery(String queryURI) {
|
||||||
|
|
|
@ -57,6 +57,28 @@ public class CoPIData {
|
||||||
return EDGE_SCHEMA;
|
return EDGE_SCHEMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void print(){
|
||||||
|
|
||||||
|
System.out.println("\n-----------------------------");
|
||||||
|
|
||||||
|
System.out.println("Ego node is "+ this.getEgoNode().getNodeName());
|
||||||
|
|
||||||
|
System.out.println("\nNodes are: ");
|
||||||
|
|
||||||
|
for(CoPINode node : this.getNodes()){
|
||||||
|
System.out.println(node.getNodeName());
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("\nEdges are: ");
|
||||||
|
|
||||||
|
for(CoPIEdge edge : this.getEdges()){
|
||||||
|
System.out.println(edge.getSourceNode() + "-->" + edge.getTargetNode());
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("\n-----------------------------");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private Set<Map<String, String>> initializeEdgeSchema() {
|
private Set<Map<String, String>> initializeEdgeSchema() {
|
||||||
|
|
||||||
Set<Map<String, String>> edgeSchema = new HashSet<Map<String, String>>();
|
Set<Map<String, String>> edgeSchema = new HashSet<Map<String, String>>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue