From b1db3b2daab4978eb98048d8f867237179b7bc8f Mon Sep 17 00:00:00 2001 From: kongchinhua Date: Tue, 6 Dec 2011 22:14:40 +0000 Subject: [PATCH] Due to changes from the ontology, this have to be fixed. We should customize this to be flexible adopt to future ontology changes - Change core:roleIn to core:roleContributesTo - Change core:relatedRole to core:contributingRole Remove no publication venue from CSV while there it's value is zero. --- .../CoPIGrantCountConstructQueryRunner.java | 10 +++--- .../CoPIGrantCountQueryRunner.java | 36 +++++++++---------- ...pOfScienceVisualizationRequestHandler.java | 10 +++--- ...tsForSubOrganizationsModelConstructor.java | 6 ++-- .../PeopleToGrantsModelConstructor.java | 6 ++-- .../PersonToGrantsModelConstructor.java | 6 ++-- 6 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountConstructQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountConstructQueryRunner.java index 5b38b8a3..c1ab3a09 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountConstructQueryRunner.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountConstructQueryRunner.java @@ -38,9 +38,9 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor { .getLog(CoPIGrantCountConstructQueryRunner.class.getName()); private static final String SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING = - "?Role core:roleIn ?Grant . " + "?Role core:roleContributesTo ?Grant . " // + "?Grant rdfs:label ?GrantLabel . " - + "?Grant core:relatedRole ?RelatedRole . "; + + "?Grant core:contributingRole ?RelatedRole . "; public CoPIGrantCountConstructQueryRunner(String egoURI, Dataset dataset, Log log) { @@ -160,7 +160,7 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor { + ">" + preboundProperty + " ?Role . " - + "?Role core:roleIn ?Grant ." + + "?Role core:roleContributesTo ?Grant ." + "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " + "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . " + "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . " @@ -174,7 +174,7 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor { + ">" + preboundProperty + " ?Role . " - + "?Role core:roleIn ?Grant ." + + "?Role core:roleContributesTo ?Grant ." + "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " + "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . " + "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . " @@ -185,7 +185,7 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor { // + ">" // + preboundProperty // + " ?Role . " -// + "?Role core:roleIn ?Grant ." +// + "?Role core:roleContributesTo ?Grant ." // + "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " // + "?dateTimeIntervalValueForGrant core:end ?endDateForGrant . " // + "?endDateForGrant core:dateTime ?endDateTimeValueForGrant . " diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountQueryRunner.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountQueryRunner.java index a9242629..a33dba55 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountQueryRunner.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/coprincipalinvestigator/CoPIGrantCountQueryRunner.java @@ -115,9 +115,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner + "<" + queryURI + "> core:hasCo-PrincipalInvestigatorRole ?Role . " - + "?Role core:roleIn ?Grant . " + + "?Role core:roleContributesTo ?Grant . " - + "?Grant core:relatedRole ?RelatedRole . " + + "?Grant core:contributingRole ?RelatedRole . " + "?RelatedRole core:principalInvestigatorRoleOf ?CoPI . " @@ -135,9 +135,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner + "<" + queryURI + "> core:hasCo-PrincipalInvestigatorRole ?Role . " - + "?Role core:roleIn ?Grant . " + + "?Role core:roleContributesTo ?Grant . " - + "?Grant core:relatedRole ?RelatedRole . " + + "?Grant core:contributingRole ?RelatedRole . " + "?RelatedRole core:investigatorRoleOf ?CoPI . " @@ -156,9 +156,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner + "<" + queryURI + "> core:hasCo-PrincipalInvestigatorRole ?Role . " - + "?Role core:roleIn ?Grant . " + + "?Role core:roleContributesTo ?Grant . " - + "?Grant core:relatedRole ?RelatedRole . " + + "?Grant core:contributingRole ?RelatedRole . " + "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?CoPI . " @@ -178,9 +178,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner + "<" + queryURI + "> core:hasPrincipalInvestigatorRole ?Role . " - + "?Role core:roleIn ?Grant . " + + "?Role core:roleContributesTo ?Grant . " - + "?Grant core:relatedRole ?RelatedRole . " + + "?Grant core:contributingRole ?RelatedRole . " + "?RelatedRole core:principalInvestigatorRoleOf ?CoPI . " @@ -199,9 +199,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner + "<" + queryURI + "> core:hasPrincipalInvestigatorRole ?Role . " - + "?Role core:roleIn ?Grant . " + + "?Role core:roleContributesTo ?Grant . " - + "?Grant core:relatedRole ?RelatedRole . " + + "?Grant core:contributingRole ?RelatedRole . " + "?RelatedRole core:investigatorRoleOf ?CoPI . " @@ -220,9 +220,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner + "<" + queryURI + "> core:hasPrincipalInvestigatorRole ?Role . " - + "?Role core:roleIn ?Grant . " + + "?Role core:roleContributesTo ?Grant . " - + "?Grant core:relatedRole ?RelatedRole . " + + "?Grant core:contributingRole ?RelatedRole . " + "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?CoPI . " @@ -241,9 +241,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner + "<" + queryURI + "> core:hasInvestigatorRole ?Role . " - + "?Role core:roleIn ?Grant . " + + "?Role core:roleContributesTo ?Grant . " - + "?Grant core:relatedRole ?RelatedRole . " + + "?Grant core:contributingRole ?RelatedRole . " + "?RelatedRole core:investigatorRoleOf ?CoPI . " @@ -262,9 +262,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner + "<" + queryURI + "> core:hasInvestigatorRole ?Role . " - + "?Role core:roleIn ?Grant . " + + "?Role core:roleContributesTo ?Grant . " - + "?Grant core:relatedRole ?RelatedRole . " + + "?Grant core:contributingRole ?RelatedRole . " + "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?CoPI . " @@ -283,9 +283,9 @@ public class CoPIGrantCountQueryRunner implements QueryRunner + "<" + queryURI + "> core:hasInvestigatorRole ?Role . " - + "?Role core:roleIn ?Grant . " + + "?Role core:roleContributesTo ?Grant . " - + "?Grant core:relatedRole ?RelatedRole . " + + "?Grant core:contributingRole ?RelatedRole . " + "?RelatedRole core:principalInvestigatorRoleOf ?CoPI . " diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/mapofscience/MapOfScienceVisualizationRequestHandler.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/mapofscience/MapOfScienceVisualizationRequestHandler.java index 5182db31..8549c341 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/mapofscience/MapOfScienceVisualizationRequestHandler.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/mapofscience/MapOfScienceVisualizationRequestHandler.java @@ -568,10 +568,12 @@ public class MapOfScienceVisualizationRequestHandler implements DecimalFormat percentageActivityFormat = new DecimalFormat("#.#"); - csvFileContent.append(StringEscapeUtils.escapeCsv("No Publication Venue Given")); - csvFileContent.append(", "); - csvFileContent.append(percentageActivityFormat.format(stats.noJournalCount)); - csvFileContent.append("\n"); + if (stats.noJournalCount > 0) { + csvFileContent.append(StringEscapeUtils.escapeCsv("No Publication Venue Given")); + csvFileContent.append(", "); + csvFileContent.append(percentageActivityFormat.format(stats.noJournalCount)); + csvFileContent.append("\n"); + } if (result != null) { diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/OrganizationToGrantsForSubOrganizationsModelConstructor.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/OrganizationToGrantsForSubOrganizationsModelConstructor.java index 549abec5..4a8f238a 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/OrganizationToGrantsForSubOrganizationsModelConstructor.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/OrganizationToGrantsForSubOrganizationsModelConstructor.java @@ -60,7 +60,7 @@ public class OrganizationToGrantsForSubOrganizationsModelConstructor implements + " ?subOrganization core:organizationForPosition ?Position . " + " ?Position core:positionForPerson ?Person . " + " ?Person core:" + roleTypeProperty + " ?Role . " - + " ?Role core:roleIn ?Grant . " + + " ?Role core:roleContributesTo ?Grant . " + " ?Grant rdfs:label ?grantLabel . " + " " + " LET(?now := afn:now()) " @@ -81,7 +81,7 @@ public class OrganizationToGrantsForSubOrganizationsModelConstructor implements + " ?subOrganization core:organizationForPosition ?Position . " + " ?Position core:positionForPerson ?Person . " + " ?Person core:" + roleTypeProperty + " ?Role . " - + " ?Role core:roleIn ?Grant . " + + " ?Role core:roleContributesTo ?Grant . " + " " + " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " // + " OPTIONAL { " @@ -110,7 +110,7 @@ public class OrganizationToGrantsForSubOrganizationsModelConstructor implements + " ?subOrganization core:organizationForPosition ?Position . " + " ?Position core:positionForPerson ?Person . " + " ?Person core:" + roleTypeProperty + " ?Role . " - + " ?Role core:roleIn ?Grant . " + + " ?Role core:roleContributesTo ?Grant . " + " " + " ?Role core:dateTimeInterval ?dateTimeIntervalValue . " // + " OPTIONAL { " diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/PeopleToGrantsModelConstructor.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/PeopleToGrantsModelConstructor.java index 00dc054d..f4d7f869 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/PeopleToGrantsModelConstructor.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/PeopleToGrantsModelConstructor.java @@ -52,7 +52,7 @@ private Set constructPersonGrantsQueryTemplate(String constructProperty, + " } " + " WHERE { " + " ?person core:" + roleTypeProperty + " ?Role . " - + " ?Role core:roleIn ?Grant . " + + " ?Role core:roleContributesTo ?Grant . " + " ?Grant rdfs:label ?grantLabel . " + " " + " LET(?now := afn:now()) " @@ -67,7 +67,7 @@ private Set constructPersonGrantsQueryTemplate(String constructProperty, + " } " + " WHERE { " + " ?person core:" + roleTypeProperty + " ?Role . " - + " ?Role core:roleIn ?Grant . " + + " ?Role core:roleContributesTo ?Grant . " + " " + " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " // + " OPTIONAL { " @@ -90,7 +90,7 @@ private Set constructPersonGrantsQueryTemplate(String constructProperty, + " } " + " WHERE { " + " ?person core:" + roleTypeProperty + " ?Role . " - + " ?Role core:roleIn ?Grant . " + + " ?Role core:roleContributesTo ?Grant . " + " " + " ?Role core:dateTimeInterval ?dateTimeIntervalValue . " // + " OPTIONAL { " diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/PersonToGrantsModelConstructor.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/PersonToGrantsModelConstructor.java index c63529ed..74f80558 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/PersonToGrantsModelConstructor.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/modelconstructor/PersonToGrantsModelConstructor.java @@ -55,7 +55,7 @@ private Set constructPersonGrantsQueryTemplate(String constructProperty, + " } " + " WHERE { " + " <" + personURI + "> core:" + roleTypeProperty + " ?Role . " - + " ?Role core:roleIn ?Grant . " + + " ?Role core:roleContributesTo ?Grant . " + " ?Grant rdfs:label ?grantLabel . " + " " + " LET(?now := afn:now()) " @@ -70,7 +70,7 @@ private Set constructPersonGrantsQueryTemplate(String constructProperty, + " } " + " WHERE { " + " <" + personURI + "> core:" + roleTypeProperty + " ?Role . " - + " ?Role core:roleIn ?Grant . " + + " ?Role core:roleContributesTo ?Grant . " + " " + " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " // + " OPTIONAL { " @@ -93,7 +93,7 @@ private Set constructPersonGrantsQueryTemplate(String constructProperty, + " } " + " WHERE { " + " <" + personURI + "> core:" + roleTypeProperty + " ?Role . " - + " ?Role core:roleIn ?Grant . " + + " ?Role core:roleContributesTo ?Grant . " + " " + " ?Role core:dateTimeInterval ?dateTimeIntervalValue . " // + " OPTIONAL { "