From 715d0c702617dbb579eb5b37d55f53866e1bb898 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Fri, 2 Apr 2010 20:15:08 +0000 Subject: [PATCH] NIHVIVO-194 First draft of educational background form. Degree select doesn't get populated, so committing now so BrianC can take a look. --- .../user/vivo-core-1.0-annotations.rdf | 1 + productMods/edit/forms/css/customForm.css | 1 - .../css/personHasEducationalBackground.css | 9 + .../forms/css/personHasPositionHistory.css | 4 + .../edit/forms/js/customFormTwoStep.js | 4 +- .../forms/personHasEducationalBackground.jsp | 223 +++++++++++------- 6 files changed, 159 insertions(+), 83 deletions(-) create mode 100644 productMods/edit/forms/css/personHasEducationalBackground.css diff --git a/productMods/WEB-INF/ontologies/user/vivo-core-1.0-annotations.rdf b/productMods/WEB-INF/ontologies/user/vivo-core-1.0-annotations.rdf index b9fdfac4..a633d627 100644 --- a/productMods/WEB-INF/ontologies/user/vivo-core-1.0-annotations.rdf +++ b/productMods/WEB-INF/ontologies/user/vivo-core-1.0-annotations.rdf @@ -1606,6 +1606,7 @@ true true + personHasEducationalBackground.jsp diff --git a/productMods/edit/forms/css/customForm.css b/productMods/edit/forms/css/customForm.css index 4168c3de..fcb4beda 100644 --- a/productMods/edit/forms/css/customForm.css +++ b/productMods/edit/forms/css/customForm.css @@ -48,7 +48,6 @@ } #content form p.inline.year input { - margin-left: 12em; margin-top: -1.75em; } diff --git a/productMods/edit/forms/css/personHasEducationalBackground.css b/productMods/edit/forms/css/personHasEducationalBackground.css new file mode 100644 index 00000000..34c36925 --- /dev/null +++ b/productMods/edit/forms/css/personHasEducationalBackground.css @@ -0,0 +1,9 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +#content form #existing { + clear: left; +} + +#content form p.inline.year input { + margin-left: 9em; +} \ No newline at end of file diff --git a/productMods/edit/forms/css/personHasPositionHistory.css b/productMods/edit/forms/css/personHasPositionHistory.css index 5d2adcc0..fc5e76c0 100644 --- a/productMods/edit/forms/css/personHasPositionHistory.css +++ b/productMods/edit/forms/css/personHasPositionHistory.css @@ -2,4 +2,8 @@ #endYearHint { margin-left: 1em; +} + +#content form p.inline.year input { + margin-left: 12em; } \ No newline at end of file diff --git a/productMods/edit/forms/js/customFormTwoStep.js b/productMods/edit/forms/js/customFormTwoStep.js index 3adf42c4..da5e7189 100644 --- a/productMods/edit/forms/js/customFormTwoStep.js +++ b/productMods/edit/forms/js/customFormTwoStep.js @@ -59,8 +59,8 @@ var customFormTwoStep = { // Read values used to control display this.editType = $("input[name='editType']").val(); - this.entryType = $("input[name='entryType']").val().capitalize(); - this.secondaryType = $("input[name='secondaryType']").val().capitalize(); + this.entryType = $("input[name='entryType']").val().capitalizeWords(); + this.secondaryType = $("input[name='secondaryType']").val().capitalizeWords(); }, diff --git a/productMods/edit/forms/personHasEducationalBackground.jsp b/productMods/edit/forms/personHasEducationalBackground.jsp index a0cfb3a8..0afbbbc7 100644 --- a/productMods/edit/forms/personHasEducationalBackground.jsp +++ b/productMods/edit/forms/personHasEducationalBackground.jsp @@ -46,59 +46,106 @@ - + + +<%-- +Classes: +core:EducationalBackground - new entity +foaf:Person +foaf:Organization +core:AcademicDegree +Data properties of EducationalBackground: +core:majorField +core:year +core:departmentOrSchool +core:supplementalInformation + +Object properties (domain : range) + +core:educationalBackground (Person : EducationalBackground) - inverse of educationalBackgroundOf +core:educationalBackgroundOf (EducationalBackground : Person) - inverse of educationalBackground + +core:degreeTypeAwarded (EducationalBackground : AcademicDegree) - inverse of awardedTo +core:awardedTo (AcademicDegree : EducationalBackground) - inverse of degreeTypeAwarded + +core:organizationGrantingDegree (EducationalBackground : Organization) - no inverse + + --%> + + +<%-- Data properties --%> <%-- Then enter a SPARQL query for each field, by convention concatenating the field id with "Existing" to convey that the expression is used to retrieve any existing value for the field in an existing individual. Each of these must then be referenced in the sparqlForExistingLiterals section of the JSON block below and in the literalsOnForm --%> - - - SELECT ?titleExisting WHERE { - ?positionUri <${titlePred}> ?titleExisting } + + + SELECT ?majorFieldExisting WHERE { + ?edBackgroundUri <${majorFieldPred}> ?majorFieldExisting } <%-- Pair the "existing" query with the skeleton of what will be asserted for a new statement involving this field. The actual assertion inserted in the model will be created via string substitution into the ? variables. NOTE the pattern of punctuation (a period after the prefix URI and after the ?field) --%> - - ?positionUri <${titlePred}> ?title . - ?positionUri <${label}> ?title. + + ?edBackgroundUri <${majorFieldPred}> ?majorField . - - - SELECT ?startYearExisting WHERE { - ?positionUri <${startYearPred}> ?startYearExisting } + + + SELECT ?existingYear WHERE { + ?edBackgroundUri <${yearPred}> ?existingYear } - - ?positionUri <${startYearPred}> ?startYear . + + ?edBackgroundUri <${yearPred}> ?year . - - - SELECT ?endYearExisting WHERE { - ?positionUri <${endYearPred}> ?endYearExisting } + + + SELECT ?existingDept WHERE { + ?edBackgroundUri <${deptPred}> ?existingDept } - - ?positionUri <${endYearPred}> ?endYear . + + ?edBackgroundUri <${deptPred}> ?dept . + + + SELECT ?existingInfo WHERE { + ?edBackgroundUri <${infoPred}> ?existingInfo } + + + ?edBackgroundUri <${infoPred}> ?info . + + +<%-- Object properties --%> <%-- Note there is really no difference in how things are set up for an object property except below in the n3ForEdit section, in whether the ..Existing variable goes in SparqlForExistingLiterals or in the SparqlForExistingUris, as well as perhaps in how the options are prepared --%> - - - - SELECT ?existingOrgUri WHERE { - ?positionUri <${positionInOrgPred}> ?existingOrgUri } + + + + SELECT ?existingDegreeUri WHERE { + ?edBackgroundUri <${hasDegree}> ?existingDegreeUri } - - ?positionUri <${positionInOrgPred}> ?organizationUri . - ?organizationUri <${orgForPositionPred}> ?positionUri . + + ?educationalBackgroundUri <${hasDegree}> ?degreeUri . + ?degreeUri <${degreeFor}> ?edBackgroundUri . + +<%-- This property has no inverse --%> + + SELECT ?existingOrgUri WHERE { + ?edBackgroundUri <${orgGrantingDegree}> ?existingOrgUri } + + + ?edBackgroundUri <${orgGrantingDegree}> ?organizationUri . + + +<%-- Do we need anything like this? EducationalBackground has no subtypes SELECT ?existingPositionType WHERE { ?positionUri <${type}> ?existingPositionType } @@ -106,6 +153,7 @@ ?positionUri <${type}> ?positionType . +--%> ?newOrg <${label}> ?newOrgName . @@ -118,22 +166,22 @@ @prefix core: <${vivoCore}> . - ?person core:personInPosition ?positionUri . - ?positionUri core:positionForPerson ?person . - ?positionUri <${type}> ?positionType . - ?positionUri <${type}> <${flagURI}> . + ?person core:educationalBackground ?edBackgroundUri . + ?edBackgroundUri core:educationalBackgroundOf ?person . + ?edBackgroundUri <${type}> core:EducationalBackground . + ?edBackgroundUri <${type}> <${flagURI}> . ?newOrg <${label}> ?newOrgName . ?newOrg <${type}> ?newOrgType . - ?positionUri <${positionInOrgPred}> ?newOrg . - ?newOrg <${orgForPositionPred}> ?positionUri . + ?edBackgroundUri <${orgGrantingDegree}> ?newOrg . ?newOrg <${type}> <${flagURI}> . -${positionClass} +${edBackgroundClass} ${orgClass} +${degreeClass} { @@ -143,57 +191,68 @@ "subject" : ["person", "${subjectUriJson}" ], "predicate" : ["predicate", "${predicateUriJson}" ], - "object" : ["positionUri", "${objectUriJson}", "URI" ], + "object" : ["edBackgroundUri", "${objectUriJson}", "URI" ], - "n3required" : [ "${n3ForStmtToPerson}", "${titleAssertion}", "${startYearAssertion}" ], + "n3required" : [ "${n3ForStmtToPerson}", "${degreeAssertion}", "${majorFieldAssertion}", "${yearAssertion}" ], "n3optional" : [ "${organizationUriAssertion}", "${n3ForNewOrg}", "${newOrgNameAssertion}", "${newOrgTypeAssertion}", - "${endYearAssertion}"], + "${deptAssertion}", "${infoAssertion}" ], - "newResources" : { "positionUri" : "${defaultNamespace}", + "newResources" : { "edBackgroundUri" : "${defaultNamespace}", "newOrg" : "${defaultNamespace}" }, "urisInScope" : { }, "literalsInScope": { }, - "urisOnForm" : [ "organizationUri", "newOrgType", "positionType" ], - "literalsOnForm" : [ "title", "newOrgName", - "startYear", "endYear" ], + "urisOnForm" : [ "organizationUri", "newOrgType", "degreeUri" ], + "literalsOnForm" : [ "majorField", "year", "dept", "info", "newOrgName"], "filesOnForm" : [ ], "sparqlForLiterals" : { }, "sparqlForUris" : { }, "sparqlForExistingLiterals" : { - "title" : "${titleExisting}", - "startYear" : "${startYearExisting}", - "endYear" : "${endYearExisting}" + "majorField" : "${majorFieldExisting}", + "year" : "${yearExisting}", + "dept" : "${deptExisting}", + "info" : "${infoExisting}" }, "sparqlForExistingUris" : { "organizationUri" : "${organizationUriExisting}", - "positionType" : "${positionTypeExisting}" + "degreeUri" : "${degreeExisting}" }, "fields" : { - "title" : { + "degreeUri" : { "newResource" : "false", "validators" : [ "nonempty" ], + "optionsType" : "INDIVIDUALS_VIA_VCLASS", + "literalOptions" : [ "Select one" ], + "predicateUri" : "", + "objectClassUri" : "${degreeClassUriJson}", + "rangeDatatypeUri" : "", + "rangeLang" : "", + "assertions" : [ "${degreeAssertion}" ] + }, + "majorField" : { + "newResource" : "false", + "validators" : [ "nonempty", "datatype:${stringDatatypeUriJson}" ], "optionsType" : "UNDEFINED", "literalOptions" : [ ], "predicateUri" : "", "objectClassUri" : "", "rangeDatatypeUri" : "${stringDatatypeUriJson}", "rangeLang" : "", - "assertions" : [ "${titleAssertion}" ] + "assertions" : [ "${majorFieldAssertion}" ] }, - "positionType" : { + "year" : { "newResource" : "false", - "validators" : [ ], - "optionsType" : "CHILD_VCLASSES_WITH_PARENT", - "literalOptions" : [ "Select one" ], + "validators" : [ "nonempty", "datatype:${gYearDatatypeUriJson}" ], + "optionsType" : "UNDEFINED", + "literalOptions" : [ ], "predicateUri" : "", - "objectClassUri" : "${positionClassUriJson}", - "rangeDatatypeUri" : "", - "rangeLang" : "", - "assertions" : [ "${positionTypeAssertion}" ] - }, + "objectClassUri" : "", + "rangeDatatypeUri" : "${gYearDatatypeUriJson}", + "rangeLang" : "", + "assertions" : ["${yearAssertion}"] + }, "organizationUri" : { "newResource" : "false", "validators" : [ ], @@ -227,28 +286,28 @@ "rangeLang" : "", "assertions" : [ "${newOrgTypeAssertion}" ] }, - "startYear" : { + "dept" : { "newResource" : "false", - "validators" : [ "nonempty", "datatype:${gYearDatatypeUriJson}" ], + "validators" : [ "datatype:${stringDatatypeUriJson}" ], "optionsType" : "UNDEFINED", "literalOptions" : [ ], "predicateUri" : "", "objectClassUri" : "", - "rangeDatatypeUri" : "${gYearDatatypeUriJson}", + "rangeDatatypeUri" : "${stringDatatypeUriJson}", "rangeLang" : "", - "assertions" : ["${startYearAssertion}"] + "assertions" : ["${deptAssertion}"] }, - "endYear" : { + "info" : { "newResource" : "false", - "validators" : [ "datatype:${gYearDatatypeUriJson}" ], + "validators" : [ "datatype:${stringDatatypeUriJson}" ], "optionsType" : "UNDEFINED", "literalOptions" : [ ], "predicateUri" : "", "objectClassUri" : "", - "rangeDatatypeUri" : "${gYearDatatypeUriJson}", + "rangeDatatypeUri" : "${stringDatatypeUriJson}", "rangeLang" : "", - "assertions" : ["${endYearAssertion}"] - } + "assertions" : ["${infoAssertion}"] + } } } @@ -277,16 +336,16 @@ if (objectUri != null) { // editing existing entry %> - + <%-- NB This will be the button text when Javascript is disabled. --%> <% } else { // adding new entry %> - + <%-- NB This will be the button text when Javascript is disabled. --%> - + <% } List customJs = new ArrayList(Arrays.asList("forms/js/customFormOneStep.js" @@ -294,8 +353,8 @@ )); request.setAttribute("customJs", customJs); - List customCss = new ArrayList(Arrays.asList("forms/css/customForm.css" - //, "forms/css/personHasEducationalbackground.css" + List customCss = new ArrayList(Arrays.asList("forms/css/customForm.css", + "forms/css/personHasEducationalBackground.css" )); request.setAttribute("customCss", customCss); %> @@ -308,8 +367,14 @@
" > +
+ + +

+
+
- or + or