NIHVIVO-2622, added training type field to custom form so that the subclasses could be selected; updated the list view as well to display the training type when relevant
This commit is contained in:
parent
0a2bf638b5
commit
aedb1305a1
6 changed files with 69 additions and 30 deletions
|
@ -13,12 +13,18 @@
|
|||
|
||||
SELECT DISTINCT <collated> ?subclass </collated>
|
||||
?edTraining
|
||||
?trainingType
|
||||
?typeName
|
||||
?org ?orgName
|
||||
?degreeName ?degreeAbbr
|
||||
?majorField ?deptOrSchool ?info
|
||||
?dateTimeStart ?dateTimeEnd
|
||||
WHERE {
|
||||
?subject ?property ?edTraining
|
||||
OPTIONAL {?edTraining vitro:mostSpecificType ?trainingType .
|
||||
?trainingType rdfs:subClassOf core:EducationalTraining .
|
||||
?trainingType rdfs:label ?typeName
|
||||
}
|
||||
OPTIONAL { ?edTraining core:trainingAtOrganization ?org .
|
||||
?org rdfs:label ?orgName
|
||||
<collated>
|
||||
|
@ -92,6 +98,30 @@
|
|||
}
|
||||
</query-construct>
|
||||
|
||||
<query-construct>
|
||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||
PREFIX core: <http://vivoweb.org/ontology/core#>
|
||||
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
|
||||
CONSTRUCT {
|
||||
?subject ?property ?edTraining .
|
||||
?edTraining vitro:mostSpecificType ?trainingType .
|
||||
?trainingType rdfs:subClassOf core:EducationalTraining .
|
||||
?trainingType rdfs:label ?typeName
|
||||
} WHERE {
|
||||
{
|
||||
?subject ?property ?edTraining .
|
||||
?edTraining vitro:mostSpecificType ?trainingType .
|
||||
?trainingType rdfs:subClassOf core:EducationalTraining
|
||||
} UNION
|
||||
{
|
||||
?subject ?property ?edTraining .
|
||||
?edTraining vitro:mostSpecificType ?trainingType .
|
||||
?trainingType rdfs:subClassOf core:EducationalTraining .
|
||||
?trainingType rdfs:label ?typeName
|
||||
}
|
||||
}
|
||||
</query-construct>
|
||||
|
||||
<query-construct>
|
||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||
PREFIX core: <http://vivoweb.org/ontology/core#>
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
<@s.join [ statement.degreeAbbr!statement.degreeName, statement.majorField! ], " in " /> -->
|
||||
${statement.degreeAbbr!statement.degreeName}
|
||||
<#if statement.majorField??> in ${statement.majorField}</#if>
|
||||
<#elseif statement.typeName??>
|
||||
${statement.typeName!}
|
||||
</#if>
|
||||
</#local>
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<#assign majorFieldValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "majorField") />
|
||||
<#assign degreeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "degree") />
|
||||
<#assign existingOrgValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "org") />
|
||||
<#assign trainingTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "trainingType")/>
|
||||
|
||||
<#--If edit submission exists, then retrieve validation errors if they exist-->
|
||||
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
|
||||
|
@ -116,6 +117,14 @@
|
|||
|
||||
<@lvf.acSelection urls.base "org" "org" existingOrgValue/>
|
||||
|
||||
<label for="positionType">Type of Educational Training ${requiredHint}</label>
|
||||
<#assign trainingTypeOpts = editConfiguration.pageData.trainingType />
|
||||
<select name="trainingType" style="margin-top:-2px" >
|
||||
<option value="" <#if trainingTypeValue == "">selected</#if>>Select one</option>
|
||||
<#list trainingTypeOpts?keys as key>
|
||||
<option value="${key}" <#if trainingTypeValue == key>selected</#if>>${trainingTypeOpts[key]}</option>
|
||||
</#list>
|
||||
</select>
|
||||
<p>
|
||||
<label for="dept">Department or School Name within the ###</label>
|
||||
<input size="60" type="text" id="dept" name="dept" value="${deptValue}" />
|
||||
|
|
|
@ -86,7 +86,7 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
conf.setVarNameForPredicate("predicate");
|
||||
conf.setVarNameForObject("edTraining");
|
||||
|
||||
conf.setN3Required( Arrays.asList( n3ForNewEdTraining, orgLabelAssertion, orgTypeAssertion ) );
|
||||
conf.setN3Required( Arrays.asList( n3ForNewEdTraining, orgLabelAssertion, orgTypeAssertion, trainingTypeAssertion ) );
|
||||
conf.setN3Optional(Arrays.asList(
|
||||
n3ForEdTrainingToOrg, majorFieldAssertion, degreeAssertion,
|
||||
deptAssertion, infoAssertion,
|
||||
|
@ -101,7 +101,7 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
//uris in scope: none
|
||||
//literals in scope: none
|
||||
|
||||
conf.setUrisOnform( Arrays.asList( "org", "orgType", "degree"));
|
||||
conf.setUrisOnform( Arrays.asList( "org", "orgType", "degree", "trainingType"));
|
||||
conf.setLiteralsOnForm( Arrays.asList("orgLabel","majorField","dept","info"));
|
||||
|
||||
conf.addSparqlForExistingLiteral("orgLabel", orgLabelQuery);
|
||||
|
@ -114,6 +114,7 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
|
||||
conf.addSparqlForExistingUris("org", orgQuery);
|
||||
conf.addSparqlForExistingUris("orgType", orgTypeQuery);
|
||||
conf.addSparqlForExistingUris("trainingType", trainingTypeQuery);
|
||||
conf.addSparqlForExistingUris("degree", degreeQuery);
|
||||
conf.addSparqlForExistingUris("intervalNode",existingIntervalNodeQuery);
|
||||
conf.addSparqlForExistingUris("startNode", existingStartNodeQuery);
|
||||
|
@ -151,6 +152,13 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
setValidators( list("nonempty")));
|
||||
//setLiteralOptions( [ "Select one" ] )
|
||||
|
||||
conf.addField( new FieldVTwo().
|
||||
setName("trainingType").
|
||||
setOptionsType(FieldVTwo.OptionsType.CHILD_VCLASSES_WITH_PARENT).
|
||||
setObjectClassUri(trainingClass).
|
||||
setValidators( list("nonempty") )
|
||||
);
|
||||
|
||||
conf.addField( new FieldVTwo().
|
||||
setName("dept").
|
||||
setRangeDatatypeUri( XSD.xstring.toString() ).
|
||||
|
@ -195,6 +203,9 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
final static String orgLabelAssertion =
|
||||
"?org <"+ label +"> ?orgLabel .";
|
||||
|
||||
final static String trainingTypeAssertion =
|
||||
"?edTraining a ?trainingType .";
|
||||
|
||||
final static String degreeAssertion =
|
||||
"?edTraining <"+ degreeEarned +"> ?degree .\n"+
|
||||
"?degree <"+ degreeOutcomeOf +"> ?edTraining .";
|
||||
|
@ -259,6 +270,11 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
|||
"?existingOrgType rdfs:subClassOf <"+ orgClass +"> .\n"+
|
||||
"}";
|
||||
|
||||
final static String trainingTypeQuery =
|
||||
"PREFIX vitro: <" + VitroVocabulary.vitroURI + "> \n" +
|
||||
"SELECT ?existingTrainingType WHERE { \n" +
|
||||
" ?edTraining vitro:mostSpecificType ?existingTrainingType . }";
|
||||
|
||||
final static String degreeQuery =
|
||||
"SELECT ?existingDegree WHERE {\n"+
|
||||
"?edTraining <"+ degreeEarned +"> ?existingDegree . }";
|
||||
|
|
|
@ -38,21 +38,6 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
|
|||
|
||||
public PersonHasMailingAddressGenerator() {}
|
||||
|
||||
// There are 4 modes that this form can be in:
|
||||
// 1. Add. There is a subject and a predicate but no position and
|
||||
// nothing else.
|
||||
//
|
||||
// 2. Normal edit where everything should already be filled out.
|
||||
// There is a subject, a object and an individual on
|
||||
// the other end of the object's core:personInOrganization stmt.
|
||||
//
|
||||
// 3. Repair a bad role node. There is a subject, predicate and object
|
||||
// but there is no individual on the other end of the object's
|
||||
// core:personInOrganization stmt. This should be similar to an add
|
||||
// but the form should be expanded.
|
||||
//
|
||||
// 4. Really bad node. multiple core:personInOrganization statements.
|
||||
|
||||
@Override
|
||||
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
|
||||
HttpSession session) {
|
||||
|
@ -154,11 +139,12 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
|
|||
return conf;
|
||||
}
|
||||
|
||||
/* N3 assertions */
|
||||
|
||||
final static String n3ForNewAddress =
|
||||
"@prefix vivo: <" + vivoCore + "> . \n\n" +
|
||||
"?person vivo:mailingAddress ?address . \n" +
|
||||
"?address a vivo:Address . \n" +
|
||||
// "?address a ?addressType . \n" +
|
||||
"?address vivo:mailingAddressFor ?person . \n" ;
|
||||
|
||||
final static String addrLineOneAssertion =
|
||||
|
@ -188,45 +174,40 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
|
|||
final static String addressTypeAssertion =
|
||||
"?address a ?addressType .";
|
||||
|
||||
|
||||
/* Queries for editing an existing entry */
|
||||
|
||||
final static String addrLabelQuery =
|
||||
"SELECT ?existingAddrLabel WHERE { \n" +
|
||||
// " ?person <"+ mailingAddressPred +"> ?address . \n" +
|
||||
" ?address <" + label + "> ?existingAddrLabel . \n" +
|
||||
"}";
|
||||
|
||||
final static String addrLineOneQuery =
|
||||
"SELECT ?existingaddrLineOne WHERE {\n"+
|
||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
||||
"?address <"+ addrLine1Pred +"> ?existingaddrLineOne . }";
|
||||
|
||||
final static String addrLineTwoQuery =
|
||||
"SELECT ?existingaddrLineTwo WHERE {\n"+
|
||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
||||
"?address <"+ addrLine2Pred +"> ?existingaddrLineTwo . }";
|
||||
|
||||
final static String addrLineThreeQuery =
|
||||
"SELECT ?existingaddrLineThree WHERE {\n"+
|
||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
||||
"?address <"+ addrLine3Pred +"> ?existingaddrLineThree . }";
|
||||
|
||||
final static String cityQuery =
|
||||
"SELECT ?existingCity WHERE {\n"+
|
||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
||||
"?address <"+ cityPred +"> ?existingCity . }";
|
||||
|
||||
final static String stateQuery =
|
||||
"SELECT ?existingState WHERE {\n"+
|
||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
||||
"?address <"+ statePred +"> ?existingState . }";
|
||||
|
||||
final static String postalCodeQuery =
|
||||
"SELECT ?existingPostalCode WHERE {\n"+
|
||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
||||
"?address <"+ postalCodePred +"> ?existingPostalCode . }";
|
||||
|
||||
final static String countryQuery =
|
||||
"SELECT ?existingCountry WHERE {\n"+
|
||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
||||
"?address <"+ countryPred +"> ?existingCountry . }";
|
||||
|
||||
final static String addressTypeQuery =
|
||||
|
|
|
@ -17,6 +17,7 @@ public abstract class VivoBaseGenerator extends BaseEditConfigurationGenerator i
|
|||
final static String type =VitroVocabulary.RDF_TYPE ;
|
||||
final static String label =rdfs+"label" ;
|
||||
|
||||
final static String trainingClass = vivoCore+"EducationalTraining" ;
|
||||
final static String degreeClass =vivoCore+"AcademicDegree" ;
|
||||
final static String majorFieldPred =vivoCore+"majorField" ;
|
||||
final static String deptPred =vivoCore+"departmentOrSchool" ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue