1. Fix for grants obtaining publication results

This commit is contained in:
cdtank 2011-03-21 19:33:03 +00:00
parent 81736350bb
commit aee1d00801

View file

@ -211,9 +211,11 @@ public class SelectOnModelUtilities {
fieldLabelToOutputFieldLabel.put("document", QueryFieldLabels.DOCUMENT_URL); fieldLabelToOutputFieldLabel.put("document", QueryFieldLabels.DOCUMENT_URL);
fieldLabelToOutputFieldLabel.put("documentLabel", QueryFieldLabels.DOCUMENT_LABEL); fieldLabelToOutputFieldLabel.put("documentLabel", QueryFieldLabels.DOCUMENT_LABEL);
fieldLabelToOutputFieldLabel.put("documentPublicationDate", QueryFieldLabels.DOCUMENT_PUBLICATION_DATE); fieldLabelToOutputFieldLabel.put("documentPublicationDate", QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
fieldLabelToOutputFieldLabel.put("lastCachedDateTime", QueryFieldLabels.LAST_CACHED_AT_DATETIME);
String whereClause = "" String whereClause = ""
+ " <" + subOrganization.getIndividualURI() + "> vivosocnet:hasPersonWithPublication ?document . " + " <" + subOrganization.getIndividualURI() + "> vivosocnet:hasPersonWithPublication ?document . "
+ " <" + subOrganization.getIndividualURI() + "> vivosocnet:lastCachedAt ?lastCachedDateTime . "
+ " ?document rdfs:label ?documentLabel . " + " ?document rdfs:label ?documentLabel . "
+ " OPTIONAL { " + " OPTIONAL { "
+ " ?document core:dateTimeValue ?dateTimeValue . " + " ?document core:dateTimeValue ?dateTimeValue . "
@ -372,21 +374,32 @@ public class SelectOnModelUtilities {
return allGrantURIToVO; return allGrantURIToVO;
} }
public static Map<String, Activity> getGrantForAssociatedPeople( public static Map<String, Activity> getGrantsForAssociatedPeople(
Dataset dataset, Collection<SubEntity> people) Dataset dataset, Collection<SubEntity> people)
throws MalformedQueryParametersException { throws MalformedQueryParametersException {
Map<String, Activity> allGrantURIToVOs = new HashMap<String, Activity>(); Map<String, Activity> allGrantURIToVOs = new HashMap<String, Activity>();
System.out.println("peopel for grants under consideration are ");
for (SubEntity person : people) {
System.out.println(person.getIndividualURI() + " -- " + person.getIndividualLabel());
}
for (SubEntity person : people) { for (SubEntity person : people) {
System.out.println("constructing grants for " + person.getIndividualLabel() + " :: " + person.getIndividualURI()); System.out.println("constructing grants for " + person.getIndividualLabel() + " :: " + person.getIndividualURI());
long before = System.currentTimeMillis();
Model personGrantsModel = ModelConstructorUtilities Model personGrantsModel = ModelConstructorUtilities
.getOrConstructModel( .getOrConstructModel(
person.getIndividualURI(), person.getIndividualURI(),
PersonToGrantsModelConstructor.MODEL_TYPE, PersonToGrantsModelConstructor.MODEL_TYPE,
dataset); dataset);
System.out.print("\t construct took " + (System.currentTimeMillis() - before));
before = System.currentTimeMillis();
Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>(); Map<String, String> fieldLabelToOutputFieldLabel = new HashMap<String, String>();
fieldLabelToOutputFieldLabel.put("grant", QueryFieldLabels.GRANT_URL); fieldLabelToOutputFieldLabel.put("grant", QueryFieldLabels.GRANT_URL);
fieldLabelToOutputFieldLabel.put("grantLabel", QueryFieldLabels.GRANT_LABEL); fieldLabelToOutputFieldLabel.put("grantLabel", QueryFieldLabels.GRANT_LABEL);
@ -432,6 +445,8 @@ public class SelectOnModelUtilities {
personGrantsQuery.getQueryResult(), personGrantsQuery.getQueryResult(),
allGrantURIToVOs)); allGrantURIToVOs));
System.out.println("\t || select took " + (System.currentTimeMillis() - before));
} }
return allGrantURIToVOs; return allGrantURIToVOs;
} }
@ -473,9 +488,7 @@ public class SelectOnModelUtilities {
person.addActivities(getPublicationForEntity( person.addActivities(getPublicationForEntity(
personPublicationsQuery.getQueryResult(), personPublicationsQuery.getQueryResult(),
allDocumentURIToVOs)); allDocumentURIToVOs));
} }
return allDocumentURIToVOs; return allDocumentURIToVOs;
} }
} }