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>
|
SELECT DISTINCT <collated> ?subclass </collated>
|
||||||
?edTraining
|
?edTraining
|
||||||
|
?trainingType
|
||||||
|
?typeName
|
||||||
?org ?orgName
|
?org ?orgName
|
||||||
?degreeName ?degreeAbbr
|
?degreeName ?degreeAbbr
|
||||||
?majorField ?deptOrSchool ?info
|
?majorField ?deptOrSchool ?info
|
||||||
?dateTimeStart ?dateTimeEnd
|
?dateTimeStart ?dateTimeEnd
|
||||||
WHERE {
|
WHERE {
|
||||||
?subject ?property ?edTraining
|
?subject ?property ?edTraining
|
||||||
|
OPTIONAL {?edTraining vitro:mostSpecificType ?trainingType .
|
||||||
|
?trainingType rdfs:subClassOf core:EducationalTraining .
|
||||||
|
?trainingType rdfs:label ?typeName
|
||||||
|
}
|
||||||
OPTIONAL { ?edTraining core:trainingAtOrganization ?org .
|
OPTIONAL { ?edTraining core:trainingAtOrganization ?org .
|
||||||
?org rdfs:label ?orgName
|
?org rdfs:label ?orgName
|
||||||
<collated>
|
<collated>
|
||||||
|
@ -92,6 +98,30 @@
|
||||||
}
|
}
|
||||||
</query-construct>
|
</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>
|
<query-construct>
|
||||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
PREFIX core: <http://vivoweb.org/ontology/core#>
|
PREFIX core: <http://vivoweb.org/ontology/core#>
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
<@s.join [ statement.degreeAbbr!statement.degreeName, statement.majorField! ], " in " /> -->
|
<@s.join [ statement.degreeAbbr!statement.degreeName, statement.majorField! ], " in " /> -->
|
||||||
${statement.degreeAbbr!statement.degreeName}
|
${statement.degreeAbbr!statement.degreeName}
|
||||||
<#if statement.majorField??> in ${statement.majorField}</#if>
|
<#if statement.majorField??> in ${statement.majorField}</#if>
|
||||||
|
<#elseif statement.typeName??>
|
||||||
|
${statement.typeName!}
|
||||||
</#if>
|
</#if>
|
||||||
</#local>
|
</#local>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<#assign majorFieldValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "majorField") />
|
<#assign majorFieldValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "majorField") />
|
||||||
<#assign degreeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "degree") />
|
<#assign degreeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "degree") />
|
||||||
<#assign existingOrgValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "org") />
|
<#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 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>
|
||||||
|
@ -116,6 +117,14 @@
|
||||||
|
|
||||||
<@lvf.acSelection urls.base "org" "org" existingOrgValue/>
|
<@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>
|
<p>
|
||||||
<label for="dept">Department or School Name within the ###</label>
|
<label for="dept">Department or School Name within the ###</label>
|
||||||
<input size="60" type="text" id="dept" name="dept" value="${deptValue}" />
|
<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.setVarNameForPredicate("predicate");
|
||||||
conf.setVarNameForObject("edTraining");
|
conf.setVarNameForObject("edTraining");
|
||||||
|
|
||||||
conf.setN3Required( Arrays.asList( n3ForNewEdTraining, orgLabelAssertion, orgTypeAssertion ) );
|
conf.setN3Required( Arrays.asList( n3ForNewEdTraining, orgLabelAssertion, orgTypeAssertion, trainingTypeAssertion ) );
|
||||||
conf.setN3Optional(Arrays.asList(
|
conf.setN3Optional(Arrays.asList(
|
||||||
n3ForEdTrainingToOrg, majorFieldAssertion, degreeAssertion,
|
n3ForEdTrainingToOrg, majorFieldAssertion, degreeAssertion,
|
||||||
deptAssertion, infoAssertion,
|
deptAssertion, infoAssertion,
|
||||||
|
@ -101,7 +101,7 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
||||||
//uris in scope: none
|
//uris in scope: none
|
||||||
//literals 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.setLiteralsOnForm( Arrays.asList("orgLabel","majorField","dept","info"));
|
||||||
|
|
||||||
conf.addSparqlForExistingLiteral("orgLabel", orgLabelQuery);
|
conf.addSparqlForExistingLiteral("orgLabel", orgLabelQuery);
|
||||||
|
@ -114,6 +114,7 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
||||||
|
|
||||||
conf.addSparqlForExistingUris("org", orgQuery);
|
conf.addSparqlForExistingUris("org", orgQuery);
|
||||||
conf.addSparqlForExistingUris("orgType", orgTypeQuery);
|
conf.addSparqlForExistingUris("orgType", orgTypeQuery);
|
||||||
|
conf.addSparqlForExistingUris("trainingType", trainingTypeQuery);
|
||||||
conf.addSparqlForExistingUris("degree", degreeQuery);
|
conf.addSparqlForExistingUris("degree", degreeQuery);
|
||||||
conf.addSparqlForExistingUris("intervalNode",existingIntervalNodeQuery);
|
conf.addSparqlForExistingUris("intervalNode",existingIntervalNodeQuery);
|
||||||
conf.addSparqlForExistingUris("startNode", existingStartNodeQuery);
|
conf.addSparqlForExistingUris("startNode", existingStartNodeQuery);
|
||||||
|
@ -151,6 +152,13 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
||||||
setValidators( list("nonempty")));
|
setValidators( list("nonempty")));
|
||||||
//setLiteralOptions( [ "Select one" ] )
|
//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().
|
conf.addField( new FieldVTwo().
|
||||||
setName("dept").
|
setName("dept").
|
||||||
setRangeDatatypeUri( XSD.xstring.toString() ).
|
setRangeDatatypeUri( XSD.xstring.toString() ).
|
||||||
|
@ -195,6 +203,9 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
||||||
final static String orgLabelAssertion =
|
final static String orgLabelAssertion =
|
||||||
"?org <"+ label +"> ?orgLabel .";
|
"?org <"+ label +"> ?orgLabel .";
|
||||||
|
|
||||||
|
final static String trainingTypeAssertion =
|
||||||
|
"?edTraining a ?trainingType .";
|
||||||
|
|
||||||
final static String degreeAssertion =
|
final static String degreeAssertion =
|
||||||
"?edTraining <"+ degreeEarned +"> ?degree .\n"+
|
"?edTraining <"+ degreeEarned +"> ?degree .\n"+
|
||||||
"?degree <"+ degreeOutcomeOf +"> ?edTraining .";
|
"?degree <"+ degreeOutcomeOf +"> ?edTraining .";
|
||||||
|
@ -259,6 +270,11 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
|
||||||
"?existingOrgType rdfs:subClassOf <"+ orgClass +"> .\n"+
|
"?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 =
|
final static String degreeQuery =
|
||||||
"SELECT ?existingDegree WHERE {\n"+
|
"SELECT ?existingDegree WHERE {\n"+
|
||||||
"?edTraining <"+ degreeEarned +"> ?existingDegree . }";
|
"?edTraining <"+ degreeEarned +"> ?existingDegree . }";
|
||||||
|
|
|
@ -38,21 +38,6 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
|
||||||
|
|
||||||
public PersonHasMailingAddressGenerator() {}
|
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
|
@Override
|
||||||
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
|
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
@ -154,11 +139,12 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* N3 assertions */
|
||||||
|
|
||||||
final static String n3ForNewAddress =
|
final static String n3ForNewAddress =
|
||||||
"@prefix vivo: <" + vivoCore + "> . \n\n" +
|
"@prefix vivo: <" + vivoCore + "> . \n\n" +
|
||||||
"?person vivo:mailingAddress ?address . \n" +
|
"?person vivo:mailingAddress ?address . \n" +
|
||||||
"?address a vivo:Address . \n" +
|
"?address a vivo:Address . \n" +
|
||||||
// "?address a ?addressType . \n" +
|
|
||||||
"?address vivo:mailingAddressFor ?person . \n" ;
|
"?address vivo:mailingAddressFor ?person . \n" ;
|
||||||
|
|
||||||
final static String addrLineOneAssertion =
|
final static String addrLineOneAssertion =
|
||||||
|
@ -188,45 +174,40 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
|
||||||
final static String addressTypeAssertion =
|
final static String addressTypeAssertion =
|
||||||
"?address a ?addressType .";
|
"?address a ?addressType .";
|
||||||
|
|
||||||
|
|
||||||
|
/* Queries for editing an existing entry */
|
||||||
|
|
||||||
final static String addrLabelQuery =
|
final static String addrLabelQuery =
|
||||||
"SELECT ?existingAddrLabel WHERE { \n" +
|
"SELECT ?existingAddrLabel WHERE { \n" +
|
||||||
// " ?person <"+ mailingAddressPred +"> ?address . \n" +
|
|
||||||
" ?address <" + label + "> ?existingAddrLabel . \n" +
|
" ?address <" + label + "> ?existingAddrLabel . \n" +
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
final static String addrLineOneQuery =
|
final static String addrLineOneQuery =
|
||||||
"SELECT ?existingaddrLineOne WHERE {\n"+
|
"SELECT ?existingaddrLineOne WHERE {\n"+
|
||||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
|
||||||
"?address <"+ addrLine1Pred +"> ?existingaddrLineOne . }";
|
"?address <"+ addrLine1Pred +"> ?existingaddrLineOne . }";
|
||||||
|
|
||||||
final static String addrLineTwoQuery =
|
final static String addrLineTwoQuery =
|
||||||
"SELECT ?existingaddrLineTwo WHERE {\n"+
|
"SELECT ?existingaddrLineTwo WHERE {\n"+
|
||||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
|
||||||
"?address <"+ addrLine2Pred +"> ?existingaddrLineTwo . }";
|
"?address <"+ addrLine2Pred +"> ?existingaddrLineTwo . }";
|
||||||
|
|
||||||
final static String addrLineThreeQuery =
|
final static String addrLineThreeQuery =
|
||||||
"SELECT ?existingaddrLineThree WHERE {\n"+
|
"SELECT ?existingaddrLineThree WHERE {\n"+
|
||||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
|
||||||
"?address <"+ addrLine3Pred +"> ?existingaddrLineThree . }";
|
"?address <"+ addrLine3Pred +"> ?existingaddrLineThree . }";
|
||||||
|
|
||||||
final static String cityQuery =
|
final static String cityQuery =
|
||||||
"SELECT ?existingCity WHERE {\n"+
|
"SELECT ?existingCity WHERE {\n"+
|
||||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
|
||||||
"?address <"+ cityPred +"> ?existingCity . }";
|
"?address <"+ cityPred +"> ?existingCity . }";
|
||||||
|
|
||||||
final static String stateQuery =
|
final static String stateQuery =
|
||||||
"SELECT ?existingState WHERE {\n"+
|
"SELECT ?existingState WHERE {\n"+
|
||||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
|
||||||
"?address <"+ statePred +"> ?existingState . }";
|
"?address <"+ statePred +"> ?existingState . }";
|
||||||
|
|
||||||
final static String postalCodeQuery =
|
final static String postalCodeQuery =
|
||||||
"SELECT ?existingPostalCode WHERE {\n"+
|
"SELECT ?existingPostalCode WHERE {\n"+
|
||||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
|
||||||
"?address <"+ postalCodePred +"> ?existingPostalCode . }";
|
"?address <"+ postalCodePred +"> ?existingPostalCode . }";
|
||||||
|
|
||||||
final static String countryQuery =
|
final static String countryQuery =
|
||||||
"SELECT ?existingCountry WHERE {\n"+
|
"SELECT ?existingCountry WHERE {\n"+
|
||||||
// "?person <"+ mailingAddressPred +"> ?address . \n" +
|
|
||||||
"?address <"+ countryPred +"> ?existingCountry . }";
|
"?address <"+ countryPred +"> ?existingCountry . }";
|
||||||
|
|
||||||
final static String addressTypeQuery =
|
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 type =VitroVocabulary.RDF_TYPE ;
|
||||||
final static String label =rdfs+"label" ;
|
final static String label =rdfs+"label" ;
|
||||||
|
|
||||||
|
final static String trainingClass = vivoCore+"EducationalTraining" ;
|
||||||
final static String degreeClass =vivoCore+"AcademicDegree" ;
|
final static String degreeClass =vivoCore+"AcademicDegree" ;
|
||||||
final static String majorFieldPred =vivoCore+"majorField" ;
|
final static String majorFieldPred =vivoCore+"majorField" ;
|
||||||
final static String deptPred =vivoCore+"departmentOrSchool" ;
|
final static String deptPred =vivoCore+"departmentOrSchool" ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue