updates related to autocomplete changes

This commit is contained in:
tworrall 2012-03-27 20:26:19 +00:00
parent 0eafc20767
commit f0ccf65ddd
9 changed files with 321 additions and 116 deletions

View file

@ -2,8 +2,12 @@
var advisingRelUtils = { var advisingRelUtils = {
onLoad: function(subject) { onLoad: function(subject,blankSentinel) {
if ( subject ) { subjName = subject; } this.subjName = '';
if ( subject ) { this.subjName = subject; }
this.sentinel = '';
if ( blankSentinel ) { this.sentinel = blankSentinel; }
this.initObjectReferences(); this.initObjectReferences();
this.bindEventListeners(); this.bindEventListeners();
@ -12,35 +16,54 @@ var advisingRelUtils = {
initObjectReferences: function() { initObjectReferences: function() {
this.form = $('#personHasAdvisingRelationship'); this.form = $('#personHasAdvisingRelationship');
this.label = $('#advisingRelLabel'); this.adRelshiplabel = $('#advisingRelLabel');
this.advisee = $('#advisee'); this.advisee = $('#advisee');
this.subjArea = $('#SubjectArea'); this.subjArea = $('#SubjectArea');
this.firstName = $('#firstName'); this.firstName = $('#firstName');
this.lastName = $('#lastName'); this.lastName = $('#lastName');
this.adviseeUri = $('#adviseeUri'); this.adviseeUri = $('#adviseeUri');
this.subjAreaUri = $('#subjAreaUri');
this.saveAdviseeLabel = $('#saveAdviseeLabel');
this.adviseeAcSelection = $('div#adviseeAcSelection');
// may not need this
this.firstName.attr('disabled', '');
}, },
bindEventListeners: function() { bindEventListeners: function() {
this.idCache = {}; this.idCache = {};
//we want to use the advisee label in the relationship label.
// since the former gets cleared on submit in some cases, store
//the value in a hidden field and map to relationship label
this.advisee.change( function(objEvent) {
window.setTimeout('advisingRelUtils.mapAdviseeValue()', 180);
});
this.advisee.blur( function(objEvent) {
window.setTimeout('advisingRelUtils.mapAdviseeValue()', 180);
});
this.form.submit(function() { this.form.submit(function() {
advisingRelUtils.resolveAdviseeNames(); advisingRelUtils.resolveAdviseeNames();
advisingRelUtils.buildAdvisingRelLabel(); advisingRelUtils.buildAdvisingRelLabel();
}); });
}, },
mapAdviseeValue: function() {
if ( this.adviseeAcSelection.attr('class').indexOf('userSelected') != -1 ) {
this.saveAdviseeLabel.val(this.advisee.val());
}
},
resolveAdviseeNames: function() { resolveAdviseeNames: function() {
var firstName, var firstName,
lastName, lastName,
name; name;
// If selecting an existing person, don't submit name fields // If selecting an existing person, don't submit name fields
if (this.adviseeUri.val() != '') { if (this.adviseeUri.val() == '' || this.adviseeUri.val() == this.sentinel ) {
this.firstName.attr('disabled', 'disabled');
this.lastName.attr('disabled', 'disabled');
}
else {
firstName = this.firstName.val(); firstName = this.firstName.val();
lastName = this.advisee.val(); lastName = this.advisee.val();
@ -50,19 +73,22 @@ var advisingRelUtils = {
} }
this.advisee.val(name); this.advisee.val(name);
this.lastName.val(lastName); this.lastName.val(lastName);
}
else {
this.firstName.attr('disabled', 'disabled');
this.lastName.attr('disabled', 'disabled');
} }
}, },
buildAdvisingRelLabel: function() { buildAdvisingRelLabel: function() {
if ( this.advisee.val().substring(0, 18) != "Select an existing") { if ( this.advisee.val() != "" ) {
this.label.val(subjName + " advising " + this.advisee.val()); this.adRelshiplabel.val(this.subjName + " advising " + this.advisee.val());
} }
else if ( this.subjArea.val().substring(0, 18) != "Select an existing" ) { else if ( this.saveAdviseeLabel.val() != "" ){
this.label.val(subjName + " advising in " + this.subjArea.val()); this.adRelshiplabel.val(this.subjName + " advising " + this.saveAdviseeLabel.val());
} }
else { else {
this.label.val(subjName + " advising relationship"); this.adRelshiplabel.val(this.subjName + " advising relationship");
} }
} }

View file

@ -3,14 +3,22 @@
var awardReceiptUtils = { var awardReceiptUtils = {
onLoad: function(mode, subjectName) { onLoad: function(mode, subjectName, href) {
this.initObjectReferences(); this.initObjectReferences();
this.bindEventListeners(); this.bindEventListeners();
// in edit mode, copy the year awarded to the displayed input element this.baseHref = href;
if ( mode == "edit" ) { this.editMode = mode;
// in edit mode copy the year awarded to the displayed input element
if ( this.editMode == "edit" ) {
this.hiddenOrgDiv = $('div#hiddenOrgLabel');
this.displayedYear.val(this.yearAwarded.val()); this.displayedYear.val(this.yearAwarded.val());
if ( this.org.val() != '' ) {
window.setTimeout('awardReceiptUtils.hiddenOrgDiv.removeClass("hidden")', 100);
window.setTimeout('awardReceiptUtils.orgAcSelection.hide()', 100);
}
} }
this.subjectName = subjectName; this.subjectName = subjectName;
$.extend(this, vitro.customFormUtils);
}, },
initObjectReferences: function() { initObjectReferences: function() {
@ -18,21 +26,66 @@ var awardReceiptUtils = {
this.form = $('#personHasAwardOrHonor'); this.form = $('#personHasAwardOrHonor');
this.recLabel = $('#awardReceiptLabel'); this.recLabel = $('#awardReceiptLabel');
this.award = $('#award'); this.award = $('#award');
this.org = $('#org');
this.yearAwarded = $('#yearAwarded-year'); this.yearAwarded = $('#yearAwarded-year');
this.displayedYear = $('#yearAwardedDisplay'); this.displayedYear = $('#yearAwardedDisplay');
this.awardAcSelection = $('div#awardAcSelection');
this.orgAcSelection = $('div#orgAcSelection');
this.orgUriReceiver = $('input#orgUri');
this.changeLink = this.awardAcSelection.children('p').children('#changeSelection');
}, },
bindEventListeners: function() { bindEventListeners: function() {
this.idCache = {}; this.idCache = {};
// the delay ensures that the function is called after the ac selection is completed
this.award.change( function(objEvent) {
window.setTimeout('awardReceiptUtils.hideConferredBy()', 180);
});
this.award.blur( function(objEvent) {
window.setTimeout('awardReceiptUtils.hideConferredBy()', 180);
});
this.form.submit(function() { this.form.submit(function() {
awardReceiptUtils.setYearAwardedLabel(); awardReceiptUtils.setYearAwardedValue();
awardReceiptUtils.buildAwardReceiptLabel(); awardReceiptUtils.buildAwardReceiptLabel();
}); });
this.changeLink.click( function() {
awardReceiptUtils.showConferredBy();
});
}, },
hideConferredBy: function() {
if ( this.awardAcSelection.attr('class').indexOf('userSelected') != -1 ) {
this.org.parent('p').hide();
this.org.val('');
this.resetAcSelection(); }
},
showConferredBy: function() {
this.org.val('Select an existing Organization or create a new one.');
this.org.addClass('acSelectorWithHelpText');
this.org.parent('p').show();
if ( this.editMode == "edit" ) {
this.hiddenOrgDiv.hide();
}
this.resetAcSelection();
},
resetAcSelection: function() {
var $acSelection = $("div.acSelection[acGroupName='org']");
if ( this.orgUriReceiver.val() != '' ) {
this.hideFields($acSelection);
$acSelection.removeClass('userSelected');
$acSelection.find("span.acSelectionInfo").text('');
$acSelection.find("a.verifyMatch").attr('href', this.baseHref);
}
},
buildAwardReceiptLabel: function() { buildAwardReceiptLabel: function() {
var rdfsLabel = this.award.val(); var rdfsLabel = this.award.val();
if ( this.yearAwarded.val().length ) { if ( this.yearAwarded.val().length ) {
@ -41,7 +94,7 @@ var awardReceiptUtils = {
this.recLabel.val(rdfsLabel); this.recLabel.val(rdfsLabel);
}, },
setYearAwardedLabel: function() { setYearAwardedValue: function() {
this.yearAwarded.val(this.displayedYear.val()); this.yearAwarded.val(this.displayedYear.val());
} }

View file

@ -271,10 +271,10 @@ var customForm = {
//if user selected, then clear out the label since we only //if user selected, then clear out the label since we only
//want to submit the label as value on form if it's a new label //want to submit the label as value on form if it's a new label
if(inputs.length && $(inputs.eq(0)).attr(customForm.flagClearLabelForExisting)) { if(inputs.length && $(inputs.eq(0)).attr(customForm.flagClearLabelForExisting)) {
//if(inputs.length) { var $selectorInput = $("input.acSelector[acGroupName='" + groupName + "']");
$("input.acSelector[acGroupName='" + groupName + "']").each(function() { var $displayInput = $("input.display[acGroupName='" + groupName + "']");
$(this).val(''); $displayInput.val($selectorInput.val());
}); $selectorInput.val('');
} }
}); });
} }
@ -480,7 +480,7 @@ var customForm = {
if ( $checkSelection.is(':hidden') && $checkSelection.attr('acGroupName') != $acSelectionObj.attr('acGroupName') ) { if ( $checkSelection.is(':hidden') && $checkSelection.attr('acGroupName') != $acSelectionObj.attr('acGroupName') ) {
customForm.resetAcSelection($checkSelection); customForm.resetAcSelection($checkSelection);
$acSelector = customForm.getAcSelector($checkSelection); $acSelector = customForm.getAcSelector($checkSelection);
$acSelector.parent("p").show(); $acSelector.parent('p').show();
} }
}); });
} }
@ -490,7 +490,7 @@ var customForm = {
} }
$acSelector = this.getAcSelector($acSelectionObj); $acSelector = this.getAcSelector($acSelectionObj);
$acSelector.parent("p").show(); $acSelector.parent('p').show();
this.resetAcSelection($acSelectionObj); this.resetAcSelection($acSelectionObj);
if ( clearAcSelectorVal == true ) { if ( clearAcSelectorVal == true ) {
$acSelector.val(''); $acSelector.val('');

View file

@ -24,14 +24,16 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<#assign htmlForElements = editConfiguration.pageData.htmlForElements /> <#assign htmlForElements = editConfiguration.pageData.htmlForElements />
<#--Retrieve variables needed--> <#--Retrieve variables needed-->
<#assign adviseeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "advisee") /> <#assign adviseeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingAdvisee") />
<#assign adviseeLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "adviseeLabel") /> <#assign adviseeLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "adviseeLabel") />
<#assign adviseeLabelDisplayValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "adviseeLabelDisplay") />
<#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName") /> <#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName") />
<#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName") /> <#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName") />
<#assign advisingRelTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "advisingRelType") /> <#assign advisingRelTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "advisingRelType") />
<#assign advisingRelLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "advisingRelLabel") /> <#assign advisingRelLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "advisingRelLabel") />
<#assign subjAreaValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingSubjArea") /> <#assign subjAreaValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingSubjArea") />
<#assign subjAreaLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "subjAreaLabel") /> <#assign subjAreaLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "subjAreaLabel") />
<#assign subjAreaLabelDisplayValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "subjAreaLabelDisplay") />
<#assign degreeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "degree") /> <#assign degreeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "degree") />
<#assign acFilterForIndividuals = "['" + editConfiguration.subjectUri + "']" /> <#assign acFilterForIndividuals = "['" + editConfiguration.subjectUri + "']" />
<#assign sparqlForAcFilter = editConfiguration.pageData.sparqlForAcFilter /> <#assign sparqlForAcFilter = editConfiguration.pageData.sparqlForAcFilter />
@ -58,6 +60,8 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<#--Display error messages if any--> <#--Display error messages if any-->
<#if submissionErrors?has_content> <#if submissionErrors?has_content>
<#assign adviseeLabelValue = adviseeLabelDisplayValue />
<#assign subjAreaLabelValue = subjAreaLabelDisplayValue />
<section id="error-alert" role="alert"> <section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" /> <img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p> <p>
@ -117,21 +121,23 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<input class="acSelector" size="50" type="text" acGroupName="advisee" id="advisee" name="adviseeLabel" value="${adviseeLabelValue}" > <input class="acSelector" size="50" type="text" acGroupName="advisee" id="advisee" name="adviseeLabel" value="${adviseeLabelValue}" >
<input size="30" type="text" id="firstName" name="firstName" value="" ><br /> <input size="30" type="text" id="firstName" name="firstName" value="" ><br />
<input type="hidden" id="lastName" name="lastName" value=""> <input type="hidden" id="lastName" name="lastName" value="">
<input class="display" type="hidden" acGroupName="advisee" id="adviseeDisplay" name="adviseeLabelDisplay" value="${adviseeLabelDisplayValue}" >
</p> </p>
<div class="acSelection" acGroupName="advisee"> <div class="acSelection" acGroupName="advisee" id="adviseeAcSelection">
<p class="inline"> <p class="inline">
<label>Selected Advisee:</label> <label>Selected Advisee:</label>
<span class="acSelectionInfo" id="arf"></span> <span class="acSelectionInfo" id="arf"></span>
<a href="" class="verifyMatch" title="verify match">(Verify this match</a> or <a href="" class="verifyMatch" title="verify match">(Verify this match</a> or
<a href="#" class="changeSelection" id="changeSelection">change selection)</a> <a href="#" class="changeSelection" id="changeSelection">change selection)</a>
</p> </p>
<input class="acUriReceiver" type="hidden" id="adviseeUri" name="advisee" value="${adviseeValue}" /> <input class="acUriReceiver" type="hidden" id="adviseeUri" name="existingAdvisee" value="${adviseeValue}" ${flagClearLabelForExisting}="true"/>
</div> </div>
<p> <p>
<label for="SubjectArea">Subject Area</label> <label for="SubjectArea">Subject Area</label>
<input class="acSelector" size="50" type="text" id="SubjectArea" acGroupName="SubjectArea" name="subjAreaLabel" value="${subjAreaLabelValue}" /> <input class="acSelector" size="50" type="text" id="SubjectArea" acGroupName="SubjectArea" name="subjAreaLabel" value="${subjAreaLabelValue}" />
<input class="display" type="hidden" id="SubjectAreaDisplay" acGroupName="SubjectArea" name="subjAreaLabelDisplay" value="${subjAreaLabelDisplayValue}" />
</p> </p>
<div class="acSelection" acGroupName="SubjectArea"> <div class="acSelection" acGroupName="SubjectArea">
<p class="inline"> <p class="inline">
@ -172,7 +178,8 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
${htmlForElements["endField"]} ${yearHint} ${htmlForElements["endField"]} ${yearHint}
</#if> </#if>
<#--End draw elements--> <#--End draw elements-->
<input type="hidden" size="50" id="advisingRelLabel" name="advisingRelLabel" value="${advisingRelLabelValue}"/> <input type="hidden" id="advisingRelLabel" name="advisingRelLabel" value="${advisingRelLabelValue}"/>
<input type="hidden" id="saveAdviseeLabel" name="saveAdviseeLabel" value="${adviseeLabelValue}"/>
<input type="hidden" id="editKey" name="editKey" value="${editKey}"/> <input type="hidden" id="editKey" name="editKey" value="${editKey}"/>
<p class="submit"> <p class="submit">
@ -207,7 +214,7 @@ var customFormData = {
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
advisingRelUtils.onLoad("${editConfiguration.subjectName}"); advisingRelUtils.onLoad('${editConfiguration.subjectName}', '${blankSentinel}');
}); });
</script> </script>

View file

@ -13,21 +13,31 @@
<#assign editMode = "add"> <#assign editMode = "add">
</#if> </#if>
<#assign newUriSentinel = "" /> <#--The blank sentinel indicates what value should be put in a URI when no autocomplete result has been selected.
<#if editConfigurationConstants?has_content> If the blank value is non-null or non-empty, n3 editing for an existing object will remove the original relationship
<#assign newUriSentinel = editConfigurationConstants["NEW_URI_SENTINEL"] /> if nothing is selected for that object-->
<#assign blankSentinel = "" />
<#if editConfigurationConstants?has_content && editConfigurationConstants?keys?seq_contains("BLANK_SENTINEL")>
<#assign blankSentinel = editConfigurationConstants["BLANK_SENTINEL"] />
</#if> </#if>
<#--This flag is for clearing the label field on submission for an existing object being selected from autocomplete.
Set this flag on the input acUriReceiver where you would like this behavior to occur. -->
<#assign flagClearLabelForExisting = "flagClearLabelForExisting" />
<#assign htmlForElements = editConfiguration.pageData.htmlForElements /> <#assign htmlForElements = editConfiguration.pageData.htmlForElements />
<#--Retrieve variables needed--> <#--Retrieve variables needed-->
<#assign awardValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "award") /> <#assign awardValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingAward") />
<#assign awardLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "awardLabel") /> <#assign awardLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "awardLabel") />
<#assign awardReceiptLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "awardReceiptLabel") /> <#assign awardReceiptLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "awardReceiptLabel") />
<#assign orgValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "org") /> <#assign orgValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingOrg") />
<#assign orgLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "orgLabel") /> <#assign orgLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "orgLabel") />
<#assign descriptionValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "description") /> <#assign descriptionValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "description") />
<#assign yearAwardedValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "yearAwarded") /> <#assign yearAwardedDisplayValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "yearAwardedDisplay") />
<#assign orgLabelDisplayValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "orgLabelDisplay") />
<#assign awardLabelDisplayValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "awardLabelDisplay") />
<#--If edit submission exists, then retrieve validation errors if they exist--> <#--If edit submission exists, then retrieve validation errors if they exist-->
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content> <#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
@ -51,6 +61,8 @@
<#--Display error messages if any--> <#--Display error messages if any-->
<#if submissionErrors?has_content> <#if submissionErrors?has_content>
<#assign orgLabelValue = orgLabelDisplayValue />
<#assign awardLabelValue = awardLabelDisplayValue />
<section id="error-alert" role="alert"> <section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" /> <img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p> <p>
@ -86,31 +98,41 @@
<p> <p>
<label for="relatedIndLabel">Award or Honor Name ${requiredHint}</label> <label for="relatedIndLabel">Award or Honor Name ${requiredHint}</label>
<input class="acSelector" size="50" type="text" id="award" acGroupName="award" name="awardLabel" value="${awardLabelValue}"> <input class="acSelector" size="50" type="text" id="award" acGroupName="award" name="awardLabel" value="${awardLabelValue}">
<input class="display" type="hidden" id="awardDisplay" acGroupName="award" name="awardLabelDisplay" value="${awardLabelDisplayValue}">
</p> </p>
<div class="acSelection" acGroupName="award"> <div class="acSelection" acGroupName="award" id="awardAcSelection">
<p class="inline"> <p class="inline">
<label>Selected Award:</label> <label>Selected Award:</label>
<span class="acSelectionInfo"></span> <span class="acSelectionInfo"></span>
<a href="" class="verifyMatch" title="verify match">(Verify this match</a> or <a href="" class="verifyMatch" title="verify match">(Verify this match</a> or
<a href="#" class="changeSelection" id="changeSelection">change selection)</a> <a href="#" class="changeSelection" id="changeSelection">change selection)</a>
</p> </p>
<input class="acUriReceiver" type="hidden" id="awardUri" name="award" value="${awardValue}" /> <input class="acUriReceiver" type="hidden" id="awardUri" name="existingAward" value="${awardValue}" ${flagClearLabelForExisting}="true" />
</div> </div>
<p> <p>
<label for="org">Conferred by</label> <label for="org">Conferred by</label>
<input class="acSelector" size="50" acGroupName="org" type="text" id="org" name="orgLabel" value="${orgLabelValue}" /> <input class="acSelector" size="50" acGroupName="org" type="text" id="org" name="orgLabel" value="${orgLabelValue}" />
<input class="display" type="hidden" id="orgDisplay" acGroupName="org" name="orgLabelDisplay" value="${orgLabelDisplayValue}" />
</p> </p>
<div class="acSelection" acGroupName="org">
<div class="acSelection" acGroupName="org" id="orgAcSelection">
<p class="inline"> <p class="inline">
<label>Selected Conferrer:</label> <label>Selected Conferrer:</label>
<span class="acSelectionInfo"></span> <span class="acSelectionInfo"></span>
<a href="" class="verifyMatch" title="verify match">(Verify this match</a> or <a href="" class="verifyMatch" title="verify match">(Verify this match</a> or
<a href="#" class="changeSelection" id="changeSelection">change selection)</a> <a href="#" class="changeSelection" id="changeSelection">change selection)</a>
</p> </p>
<input class="acUriReceiver" type="hidden" id="orgUri" name="org" value="${orgValue}" /> <input class="acUriReceiver" type="hidden" id="orgUri" name="existingOrg" value="${orgValue}" ${flagClearLabelForExisting}="true"/>
</div> </div>
<#if editMode == "edit">
<div class="hidden" id="hiddenOrgLabel">
<p class="inline">
<label>Selected Conferrer: </label>
<span class="readOnly">${orgLabelValue}</span>
</p>
</div>
</#if>
<p> <p>
<label for="description">Description</label> <label for="description">Description</label>
<input size="50" type="text" id="description" name="description" value="${descriptionValue}" /> <input size="50" type="text" id="description" name="description" value="${descriptionValue}" />
@ -118,7 +140,7 @@
<#assign htmlForElements = editConfiguration.pageData.htmlForElements /> <#assign htmlForElements = editConfiguration.pageData.htmlForElements />
<p> <p>
<label for="yearAwardedDisplay" id="yearAwarded">Year Awarded</label> <label for="yearAwardedDisplay" id="yearAwarded">Year Awarded</label>
<input size="4" type="text" id="yearAwardedDisplay" name="yearAwardedDisplay" value="" /> ${yearHint} <input size="4" type="text" id="yearAwardedDisplay" name="yearAwardedDisplay" value="${yearAwardedDisplayValue}" /> ${yearHint}
</p> </p>
<p> <p>
<h4>Years Inclusive <span class="hint">&nbsp;(e.g., for multi-year awards)</span></h4> <h4>Years Inclusive <span class="hint">&nbsp;(e.g., for multi-year awards)</span></h4>
@ -165,17 +187,17 @@ var customFormData = {
defaultTypeName: 'award', defaultTypeName: 'award',
multipleTypeNames: {award: 'award', org: 'organization'}, multipleTypeNames: {award: 'award', org: 'organization'},
baseHref: '${urls.base}/individual?uri=', baseHref: '${urls.base}/individual?uri=',
newUriSentinel : '${newUriSentinel}' blankSentinel: '${blankSentinel}',
}; flagClearLabelForExisting: '${flagClearLabelForExisting}'};
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
awardReceiptUtils.onLoad('${editMode}', '${editConfiguration.subjectName}'); awardReceiptUtils.onLoad('${editMode}', '${editConfiguration.subjectName}', '${urls.base}/individual?uri=');
}); });
</script> </script>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')} ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customForm.css" />')} ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customForm.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css" />')} ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css" />')}

View file

@ -26,7 +26,7 @@ public class PersonHasAdviseesValidator implements N3ValidatorVTwo {
Map<String,String> errors = new HashMap<String,String>(); Map<String,String> errors = new HashMap<String,String>();
List<String> adviseeUri = urisFromForm.get("advisee"); List<String> adviseeUri = urisFromForm.get("existingAdvisee");
if (allListElementsEmpty(adviseeUri)) { if (allListElementsEmpty(adviseeUri)) {
adviseeUri = null; adviseeUri = null;
} }

View file

@ -0,0 +1,68 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.hp.hpl.jena.rdf.model.Literal;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.N3ValidatorVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.MultiValueEditSubmission;
public class PersonHasAwardOrHonorValidator implements N3ValidatorVTwo {
private static String MISSING_AWARD_LABEL_ERROR = "You must select an existing award or type the name of a new award.";
;
@Override
public Map<String, String> validate(EditConfigurationVTwo editConfig,
MultiValueEditSubmission editSub) {
Map<String,List<String>> urisFromForm = editSub.getUrisFromForm();
Map<String,List<Literal>> literalsFromForm = editSub.getLiteralsFromForm();
Map<String,String> errors = new HashMap<String,String>();
List<String> awardUri = urisFromForm.get("existingAward");
if (allListElementsEmpty(awardUri)) {
awardUri = null;
}
// If there's an awardUri, then we're done. If not, check to see if the label exists.
// If that's null, too, it's an error.
if (awardUri != null) {
return null;
}
else {
List<String> awardLabel = urisFromForm.get("awardLabel");
if (allListElementsEmpty(awardLabel)) {
awardLabel = null;
}
if (awardLabel != null) {
return null;
}
else {
errors.put("awardLabel", MISSING_AWARD_LABEL_ERROR);
}
}
return errors.size() != 0 ? errors : null;
}
private boolean allListElementsEmpty(List<String> checkList) {
if(checkList == null)
return true;
if(checkList.isEmpty()) {
return true;
}
boolean allEmpty = true;
for(String s: checkList) {
if(s.length() != 0){
allEmpty = false;
break;
}
}
return allEmpty;
}
}

View file

@ -67,8 +67,8 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
conf.setN3Required( Arrays.asList( n3ForNewAdvisingRelationship, conf.setN3Required( Arrays.asList( n3ForNewAdvisingRelationship,
advisingRelLabelAssertion, advisingRelLabelAssertion,
advisingRelTypeAssertion ) ); advisingRelTypeAssertion ) );
conf.setN3Optional( Arrays.asList( n3ForAdviseeAssertion, conf.setN3Optional( Arrays.asList( n3ForNewAdviseeAssertion,
adviseeLabelAssertion, n3ForExistingAdviseeAssertion,
degreeAssertion, degreeAssertion,
firstNameAssertion, firstNameAssertion,
lastNameAssertion, lastNameAssertion,
@ -78,7 +78,7 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
n3ForEnd ) ); n3ForEnd ) );
conf.addNewResource("advisingRelationship", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("advisingRelationship", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("advisee", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("newAdvisee", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("newSubjArea", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("newSubjArea", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("intervalNode", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("intervalNode", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("startNode", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("startNode", DEFAULT_NS_FOR_NEW_RESOURCE);
@ -87,21 +87,18 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
//uris in scope: none //uris in scope: none
//literals in scope: none //literals in scope: none
conf.setUrisOnform(Arrays.asList("advisingRelType", "existingSubjArea", "degree", "advisee")); conf.setUrisOnform(Arrays.asList("advisingRelType", "existingSubjArea", "degree", "existingAdvisee"));
conf.setLiteralsOnForm(Arrays.asList("advisingRelLabel", "subjAreaLabel", "adviseeLabel", "firstName", "lastName" )); conf.setLiteralsOnForm(Arrays.asList("advisingRelLabel", "subjAreaLabel", "adviseeLabel", "firstName", "lastName", "subjAreaLabelDisplay", "adviseeLabelDisplay" ));
conf.addSparqlForExistingLiteral("advisingRelLabel", advisingRelLabelQuery); conf.addSparqlForExistingLiteral("advisingRelLabel", advisingRelLabelQuery);
conf.addSparqlForExistingLiteral("adviseeLabel", adviseeLabelQuery); conf.addSparqlForExistingLiteral("adviseeLabel", adviseeLabelQuery);
// may not need these two because in edit mode the display will be an acSelection div
// conf.addSparqlForExistingLiteral("firstName", firstNameQuery);
// conf.addSparqlForExistingLiteral("lastName", lastNameQuery);
conf.addSparqlForExistingLiteral("subjAreaLabel", subjAreaLabelQuery); conf.addSparqlForExistingLiteral("subjAreaLabel", subjAreaLabelQuery);
conf.addSparqlForExistingLiteral("startField-value", existingStartDateQuery); conf.addSparqlForExistingLiteral("startField-value", existingStartDateQuery);
conf.addSparqlForExistingLiteral("endField-value", existingEndDateQuery); conf.addSparqlForExistingLiteral("endField-value", existingEndDateQuery);
conf.addSparqlForExistingUris("advisingRelType", advisingRelTypeQuery); conf.addSparqlForExistingUris("advisingRelType", advisingRelTypeQuery);
conf.addSparqlForExistingUris("existingSubjArea", subjAreaQuery); conf.addSparqlForExistingUris("existingSubjArea", subjAreaQuery);
conf.addSparqlForExistingUris("advisee", adviseeQuery); conf.addSparqlForExistingUris("existingAdvisee", adviseeQuery);
conf.addSparqlForExistingUris("degree", degreeQuery); conf.addSparqlForExistingUris("degree", degreeQuery);
conf.addSparqlForExistingUris("intervalNode",existingIntervalNodeQuery); conf.addSparqlForExistingUris("intervalNode",existingIntervalNodeQuery);
conf.addSparqlForExistingUris("startNode", existingStartNodeQuery); conf.addSparqlForExistingUris("startNode", existingStartNodeQuery);
@ -153,7 +150,7 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
); );
conf.addField( new FieldVTwo(). conf.addField( new FieldVTwo().
setName("advisee"). setName("existingAdvisee").
setOptionsType(FieldVTwo.OptionsType.INDIVIDUALS_VIA_VCLASS). setOptionsType(FieldVTwo.OptionsType.INDIVIDUALS_VIA_VCLASS).
setObjectClassUri( adviseeClass ) setObjectClassUri( adviseeClass )
); );
@ -164,6 +161,18 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
setValidators( list("datatype:" + XSD.xstring.toString()) ) setValidators( list("datatype:" + XSD.xstring.toString()) )
); );
conf.addField( new FieldVTwo().
setName("subjAreaLabelDisplay").
setRangeDatatypeUri(XSD.xstring.toString() ).
setValidators( list("datatype:" + XSD.xstring.toString()) )
);
conf.addField( new FieldVTwo().
setName("adviseeLabelDisplay").
setRangeDatatypeUri(XSD.xstring.toString() ).
setValidators( list("datatype:" + XSD.xstring.toString()) )
);
conf.addField( new FieldVTwo().setName("startField"). conf.addField( new FieldVTwo().setName("startField").
setEditElement( setEditElement(
new DateTimeWithPrecisionVTwo(null, new DateTimeWithPrecisionVTwo(null,
@ -203,27 +212,27 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
final static String advisingRelTypeAssertion = final static String advisingRelTypeAssertion =
"?advisingRelationship a ?advisingRelType ."; "?advisingRelationship a ?advisingRelType .";
final static String n3ForAdviseeAssertion = final static String n3ForNewAdviseeAssertion =
"?advisingRelationship <" + adviseePred + "> ?advisee . \n" + "?advisingRelationship <" + adviseePred + "> ?newAdvisee . \n" +
"?advisee <" + adviseeInPred + "> ?advisingRelationship . "; "?newAdvisee <" + adviseeInPred + "> ?advisingRelationship . \n" +
"?newAdvisee <" + label + "> ?adviseeLabel . \n" +
"?newAdvisee a <" + adviseeClass + "> . ";
final static String adviseeLabelAssertion = final static String n3ForExistingAdviseeAssertion =
"?advisee <" + label + "> ?adviseeLabel ."; "?advisingRelationship <" + adviseePred + "> ?existingAdvisee . \n" +
"?existingAdvisee <" + adviseeInPred + "> ?advisingRelationship . ";
final static String firstNameAssertion = final static String firstNameAssertion =
"@prefix foaf: <" + foaf + "> . \n" + "@prefix foaf: <" + foaf + "> . \n" +
"?advisee foaf:firstName ?firstName ."; "?newAdvisee foaf:firstName ?firstName .";
final static String lastNameAssertion = final static String lastNameAssertion =
"@prefix foaf: <" + foaf + "> . \n" + "@prefix foaf: <" + foaf + "> . \n" +
"?advisee foaf:lastName ?lastName ."; "?newAdvisee foaf:lastName ?lastName .";
final static String degreeAssertion = final static String degreeAssertion =
"?advisingRelationship <"+ degreePred +"> ?degree ."; "?advisingRelationship <"+ degreePred +"> ?degree .";
final static String n3ForSubjAreaType =
"?subjArea a <" + subjAreaClass + "> . ";
//This is for an existing subject area //This is for an existing subject area
//Where we only need the existing subject area label //Where we only need the existing subject area label
final static String n3ForExistingSubjAreaAssertion = final static String n3ForExistingSubjAreaAssertion =
@ -273,21 +282,6 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
" ?existingAdvisee <" + label + "> ?existingAdviseeLabel . \n" + " ?existingAdvisee <" + label + "> ?existingAdviseeLabel . \n" +
"}"; "}";
/* May not need these
final static String firstNameQuery =
"prefix foaf: <" + foaf + "> \n" +
"SELECT ?existingFirstName WHERE { \n" +
" ?advisingRelationship <" + adviseePred + "> ?existingAdvisee . \n" +
" ?existingAdvisee foaf:firstName ?existingFirstName . \n" +
"}";
final static String lastNameQuery =
"prefix foaf: <" + foaf + "> \n" +
"SELECT ?existingLastName WHERE { \n" +
" ?advisingRelationship <" + adviseePred + "> ?existingAdvisee . \n" +
" ?existingAdvisee foaf:lastName ?existingLastName . \n" +
"}";
*/
final static String subjAreaQuery = final static String subjAreaQuery =
"SELECT ?existingSubjArea WHERE { \n" + "SELECT ?existingSubjArea WHERE { \n" +
" ?advisingRelationship <" + subjAreaPred + "> ?existingSubjArea . \n" + " ?advisingRelationship <" + subjAreaPred + "> ?existingSubjArea . \n" +

View file

@ -22,6 +22,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils; import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode; import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils; import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.PersonHasAwardOrHonorValidator;
public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
EditConfigurationGenerator { EditConfigurationGenerator {
@ -65,18 +66,20 @@ public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
conf.setN3Required( Arrays.asList( n3ForNewAwardReceipt, conf.setN3Required( Arrays.asList( n3ForNewAwardReceipt,
awardReceiptLabelAssertion ) ); awardReceiptLabelAssertion ) );
conf.setN3Optional( Arrays.asList( n3ForReceiptToAward, conf.setN3Optional( Arrays.asList( n3ForNewAwardAssertion,
n3ForAwardToReceipt, n3ForExistingAwardAssertion,
descriptionAssertion, descriptionAssertion,
n3ForOrgAssertion, n3ForNewOrgNewAwardAssertion,
awardLabelAssertion, n3ForExistingOrgNewAwardAssertion,
n3ForNewOrgExistingAwardAssertion,
n3ForExistingOrgExistingAwardAssertion,
n3ForYearAwarded, n3ForYearAwarded,
n3ForStart, n3ForStart,
n3ForEnd ) ); n3ForEnd ) );
conf.addNewResource("award", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("award", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("awardReceipt", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("awardReceipt", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("org", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("newOrg", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("yearAwardedNode", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("yearAwardedNode", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("intervalNode", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("intervalNode", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("startNode", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("startNode", DEFAULT_NS_FOR_NEW_RESOURCE);
@ -85,8 +88,8 @@ public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
//uris in scope: none //uris in scope: none
//literals in scope: none //literals in scope: none
conf.setUrisOnform(Arrays.asList("award", "org")); conf.setUrisOnform(Arrays.asList("existingAward", "existingOrg"));
conf.setLiteralsOnForm(Arrays.asList("description", "awardReceiptLabel", "awardLabel", "orgLabel" )); conf.setLiteralsOnForm(Arrays.asList("description", "awardReceiptLabel", "awardLabel", "orgLabel", "yearAwardedDisplay", "orgLabelDisplay", "awardLabelDisplay" ));
conf.addSparqlForExistingLiteral("awardReceiptLabel", awardReceiptLabelQuery); conf.addSparqlForExistingLiteral("awardReceiptLabel", awardReceiptLabelQuery);
conf.addSparqlForExistingLiteral("awardLabel", awardLabelQuery); conf.addSparqlForExistingLiteral("awardLabel", awardLabelQuery);
@ -96,8 +99,8 @@ public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
conf.addSparqlForExistingLiteral("startField-value", existingStartDateQuery); conf.addSparqlForExistingLiteral("startField-value", existingStartDateQuery);
conf.addSparqlForExistingLiteral("endField-value", existingEndDateQuery); conf.addSparqlForExistingLiteral("endField-value", existingEndDateQuery);
conf.addSparqlForExistingUris("award", awardQuery); conf.addSparqlForExistingUris("existingAward", existingAwardQuery);
conf.addSparqlForExistingUris("org", orgQuery); conf.addSparqlForExistingUris("existingOrg", existingOrgQuery);
conf.addSparqlForExistingUris("yearAwardedNode",existingYearAwardedNodeQuery); conf.addSparqlForExistingUris("yearAwardedNode",existingYearAwardedNodeQuery);
conf.addSparqlForExistingUris("intervalNode",existingIntervalNodeQuery); conf.addSparqlForExistingUris("intervalNode",existingIntervalNodeQuery);
conf.addSparqlForExistingUris("startNode", existingStartNodeQuery); conf.addSparqlForExistingUris("startNode", existingStartNodeQuery);
@ -113,13 +116,13 @@ public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
); );
conf.addField( new FieldVTwo(). conf.addField( new FieldVTwo().
setName("org"). setName("existingOrg").
setOptionsType(FieldVTwo.OptionsType.INDIVIDUALS_VIA_VCLASS). setOptionsType(FieldVTwo.OptionsType.INDIVIDUALS_VIA_VCLASS).
setObjectClassUri( orgClass ) setObjectClassUri( orgClass )
); );
conf.addField( new FieldVTwo(). conf.addField( new FieldVTwo().
setName("award"). setName("existingAward").
setOptionsType(FieldVTwo.OptionsType.INDIVIDUALS_VIA_VCLASS). setOptionsType(FieldVTwo.OptionsType.INDIVIDUALS_VIA_VCLASS).
setObjectClassUri( awardClass ) setObjectClassUri( awardClass )
); );
@ -139,7 +142,25 @@ public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
conf.addField( new FieldVTwo(). conf.addField( new FieldVTwo().
setName("awardLabel"). setName("awardLabel").
setRangeDatatypeUri(XSD.xstring.toString() ). setRangeDatatypeUri(XSD.xstring.toString() ).
setValidators( list("nonempty") ) setValidators( list("datatype:" + XSD.xstring.toString()))
);
conf.addField( new FieldVTwo().
setName("yearAwardedDisplay").
setRangeDatatypeUri(XSD.xstring.toString() ).
setValidators( list("datatype:" + XSD.xstring.toString()))
);
conf.addField( new FieldVTwo().
setName("orgLabelDisplay").
setRangeDatatypeUri(XSD.xstring.toString() ).
setValidators( list("datatype:" + XSD.xstring.toString()))
);
conf.addField( new FieldVTwo().
setName("awardLabelDisplay").
setRangeDatatypeUri(XSD.xstring.toString() ).
setValidators( list("datatype:" + XSD.xstring.toString()))
); );
conf.addField( new FieldVTwo().setName("yearAwarded"). conf.addField( new FieldVTwo().setName("yearAwarded").
@ -168,7 +189,7 @@ public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField")); conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField"));
conf.addValidator(new AntiXssValidation()); conf.addValidator(new AntiXssValidation());
conf.addValidator(new PersonHasAwardOrHonorValidator());
prepare(vreq, conf); prepare(vreq, conf);
return conf; return conf;
} }
@ -179,30 +200,43 @@ public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
"@prefix vivo: <" + vivoCore + "> . \n\n" + "@prefix vivo: <" + vivoCore + "> . \n\n" +
"?person <" + awardReceiptPred + "> ?awardReceipt . \n" + "?person <" + awardReceiptPred + "> ?awardReceipt . \n" +
"?awardReceipt a <" + awardReceiptClass + "> . \n" + "?awardReceipt a <" + awardReceiptClass + "> . \n" +
"?awardReceipt <" + awardForPred + "> ?person . \n" + "?awardReceipt <" + awardForPred + "> ?person . " ;
"?awardReceipt <" + receiptOfPred + "> ?award . \n" +
"?award a <" + awardClass + "> . " ;
final static String awardReceiptLabelAssertion = final static String awardReceiptLabelAssertion =
"?awardReceipt <"+ label + "> ?awardReceiptLabel ."; "?awardReceipt <"+ label + "> ?awardReceiptLabel .";
final static String n3ForReceiptToAward = final static String n3ForNewAwardAssertion =
"?awardReceipt <" + receiptOfPred + "> ?award ."; "?awardReceipt <" + receiptOfPred + "> ?award . \n" +
"?award a <" + awardClass + "> . \n" +
final static String awardLabelAssertion = "?award <" + receiptPred + "> ?awardReceipt . \n" +
"?award <"+ label + "> ?awardLabel ."; "?award <"+ label + "> ?awardLabel .";
final static String n3ForAwardToReceipt = final static String n3ForExistingAwardAssertion =
"?award <" + receiptPred + "> ?awardReceipt ."; "?awardReceipt <" + receiptOfPred + "> ?existingAward . \n" +
"?existingAward <" + receiptPred + "> ?awardReceipt . " ;
final static String descriptionAssertion = final static String descriptionAssertion =
"?awardReceipt <"+ descriptionPred +"> ?description ."; "?awardReceipt <"+ descriptionPred +"> ?description .";
final static String n3ForOrgAssertion = final static String n3ForExistingOrgNewAwardAssertion =
"?award <" + awardConferredByPred +"> ?org . \n" + "?award <" + awardConferredByPred +"> ?existingOrg . \n" +
"?org a <" + orgClass + "> . \n" + "?existingOrg <" + awardConferredPred + "> ?award . ";
"?org <" + awardConferredPred + "> ?award . \n" +
"?org <"+ label + "> ?orgLabel ."; final static String n3ForExistingOrgExistingAwardAssertion =
"?existingAward <" + awardConferredByPred +"> ?existingOrg . \n" +
"?existingOrg <" + awardConferredPred + "> ?existingAward . ";
final static String n3ForNewOrgNewAwardAssertion =
"?newOrg a <" + orgClass + "> . \n" +
"?award <" + awardConferredByPred +"> ?newOrg . \n" +
"?newOrg <" + awardConferredPred + "> ?award . \n" +
"?newOrg <"+ label + "> ?orgLabel .";
final static String n3ForNewOrgExistingAwardAssertion =
"?newOrg a <" + orgClass + "> . \n" +
"?existingAward <" + awardConferredByPred +"> ?newOrg . \n" +
"?newOrg <" + awardConferredPred + "> ?existingAward . \n" +
"?newOrg <"+ label + "> ?orgLabel .";
final static String n3ForYearAwarded = final static String n3ForYearAwarded =
"?awardReceipt <" + yearAwardedPred + "> ?yearAwardedNode . \n" + "?awardReceipt <" + yearAwardedPred + "> ?yearAwardedNode . \n" +
@ -228,15 +262,16 @@ public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
/* Queries for editing an existing entry */ /* Queries for editing an existing entry */
final static String awardQuery = final static String existingAwardQuery =
"SELECT ?existingAward WHERE { \n" + "SELECT ?existingAward WHERE { \n" +
" ?awardReceipt <" + receiptOfPred + "> ?existingAward . \n" + " ?awardReceipt <" + receiptOfPred + "> ?existingAward . \n" +
"}"; "}";
final static String orgQuery = final static String existingOrgQuery =
"SELECT ?existingOrg WHERE { \n" + "SELECT ?existingOrg WHERE { \n" +
" ?award <" + awardConferredByPred + "> ?existingOrg . \n" + " ?awardReceipt <" + receiptOfPred + "> ?existingAward . \n" +
" ?existingOrg <" + awardConferredPred + "> ?award . }"; " ?existingAward<" + awardConferredByPred + "> ?existingOrg . \n" +
" ?existingOrg <" + awardConferredPred + "> ?existingAward . }";
final static String awardReceiptLabelQuery = final static String awardReceiptLabelQuery =
"SELECT ?existingAwardReceiptLabel WHERE { \n" + "SELECT ?existingAwardReceiptLabel WHERE { \n" +