From 791db61269a0f828ea4a5b2966303dd0fb7b8a4a Mon Sep 17 00:00:00 2001 From: tworrall Date: Thu, 3 Oct 2013 13:13:49 -0400 Subject: [PATCH] VIVO-112 ongoing updates and VIVO-256 ORCID iD changes --- .../listViewConfig-authorInAuthorship.xml | 34 +++--- .../listViewConfig-educationalTraining.xml | 58 +++++++--- productMods/config/listViewConfig-orcidId.xml | 28 +++++ .../individual/propStatement-orcidId.ftl | 17 +++ .../edit/forms/addOrcidIdToPerson.ftl | 87 +++++++++++++++ .../edit/forms/js/addOrcidIdToPersonUtils.js | 39 +++++++ .../edit/forms/js/awardReceiptUtils.js | 1 - .../forms/personHasEducationalTraining.ftl | 10 +- rdf/display/everytime/PropertyConfig.n3 | 30 ++--- rdf/display/everytime/vivoListViewConfig.rdf | 4 + .../AddEditorshipToPersonGenerator.java | 6 +- .../AddOrcidIdToPersonGenerator.java | 81 ++++++++++++++ .../PersonHasEducationalTraining.java | 104 ++++++++---------- 13 files changed, 386 insertions(+), 113 deletions(-) create mode 100644 productMods/config/listViewConfig-orcidId.xml create mode 100644 productMods/templates/freemarker/body/partials/individual/propStatement-orcidId.ftl create mode 100644 productMods/templates/freemarker/edit/forms/addOrcidIdToPerson.ftl create mode 100644 productMods/templates/freemarker/edit/forms/js/addOrcidIdToPersonUtils.js create mode 100644 src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddOrcidIdToPersonGenerator.java diff --git a/productMods/config/listViewConfig-authorInAuthorship.xml b/productMods/config/listViewConfig-authorInAuthorship.xml index 2d328285..874cf2dc 100644 --- a/productMods/config/listViewConfig-authorInAuthorship.xml +++ b/productMods/config/listViewConfig-authorInAuthorship.xml @@ -29,7 +29,7 @@ WHERE { ?subject ?property ?authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource rdfs:label ?infoResourceName . OPTIONAL { ?infoResource bibo:volume ?volume } @@ -72,13 +72,13 @@ ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource vitro:mostSpecificType ?subclass } WHERE { ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource vitro:mostSpecificType ?subclass } @@ -91,7 +91,7 @@ ?subject ?property ?authorship . ?authorship ?authorshipProperty ?authorshipValue . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource rdfs:label ?infoResourceName . ?infoResource core:hasPublicationVenue ?publishedIn . ?publishedIn rdfs:label ?journal @@ -108,24 +108,24 @@ ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> } UNION { ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource rdfs:label ?infoResourceName } UNION { ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource core:hasPublicationVenue ?publishedIn } UNION { ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource core:hasPublicationVenue ?publishedIn . ?publishedIn rdfs:label ?journal } @@ -143,7 +143,7 @@ ?authorship a core:Authorship . ?authorship ?authorshipProperty ?authorshipValue . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource ?infoResourceProperty ?infoResourceValue . ?infoResource bibo:reproducedIn ?appearsInObj . ?infoResource core:publisher ?publisherObj . @@ -169,32 +169,32 @@ ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . } UNION { ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource ?infoResourceProperty ?infoResourceValue } UNION { ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource bibo:reproducedIn ?appearsInObj . ?appearsInObj rdfs:label ?appearsIn } UNION { ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource core:publisher ?publisherObj . ?publisherObj rdfs:label ?publisher } UNION { ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource core:relatedBy ?editorship . ?editorship core:relates ?editorObj . ?editorObj rdfs:label ?editor @@ -202,7 +202,7 @@ ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource core:partOf ?partOfObj . ?partOfObj rdfs:label ?partOf } @@ -217,14 +217,14 @@ ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource core:dateTimeValue ?dateTimeValue . ?dateTimeValue core:dateTime ?dateTime } WHERE { ?subject ?property ?authorship . ?authorship a core:Authorship . ?authorship core:relates ?infoResource . - ?infoResource a bibo:Document . + ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource core:dateTimeValue ?dateTimeValue . ?dateTimeValue core:dateTime ?dateTime } diff --git a/productMods/config/listViewConfig-educationalTraining.xml b/productMods/config/listViewConfig-educationalTraining.xml index 5334d50d..20d78be3 100644 --- a/productMods/config/listViewConfig-educationalTraining.xml +++ b/productMods/config/listViewConfig-educationalTraining.xml @@ -13,7 +13,6 @@ SELECT DISTINCT ?subclass ?edTraining - ?trainingType ?typeName ?org ?orgName ?degreeName ?degreeAbbr @@ -22,7 +21,7 @@ WHERE { ?subject ?property ?edTraining . ?edTraining a core:EducationalProcess - OPTIONAL {?edTraining vitro:mostSpecificType ?trainingType . + OPTIONAL {?edTraining vitro:mostSpecificType ?subclass . ?trainingType rdfs:subClassOf core:EducationalProcess . ?trainingType rdfs:label ?typeName } @@ -32,13 +31,9 @@ OPTIONAL { ?degree rdfs:label ?degreeName } OPTIONAL { ?degree core:abbreviation ?degreeAbbr } } - OPTIONAL { ?awardedDegree core:assignedBy ?org . + OPTIONAL { ?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?org . + ?org a foaf:Organization . ?org rdfs:label ?orgName - - OPTIONAL { ?org vitro:mostSpecificType ?subclass . - ?subclass rdfs:subClassOf foaf:Organization - } - } OPTIONAL { ?edTraining core:majorField ?majorField } OPTIONAL { ?edTraining core:departmentOrSchool ?deptOrSchool } @@ -57,12 +52,11 @@ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX foaf: <http://xmlns.com/foaf/0.1/> CONSTRUCT { - ?subclass rdfs:subClassOf foaf:Organization . + ?subclass rdfs:subClassOf core:EducationalProcess . } WHERE { - ?subclass rdfs:subClassOf foaf:Organization . + ?subclass rdfs:subClassOf core:EducationalProcess . } @@ -75,8 +69,6 @@ ?edTraining a core:EducationalProcess . ?edTraining ?edTrainingProp ?edTrainingValue . ?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?awardedDegree . - ?awardedDegree core:assignedBy ?org . - ?org rdfs:label ?orgName . ?awardedDegree core:relates ?degree . ?edTraining core:dateTimeInterval ?dateTimeInterval } WHERE { @@ -98,8 +90,6 @@ ?subject ?property ?edTraining . ?edTraining a core:EducationalProcess . ?edTraining <http://purl.obolibrary.org/obo/RO_0002234> ?awardedDegree . - ?awardedDegree core:assignedBy ?org . - ?org rdfs:label ?orgName } UNION { ?subject ?property ?edTraining . @@ -115,6 +105,44 @@ } + + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX foaf: <http://xmlns.com/foaf/0.1/> + + CONSTRUCT { + ?subject ?property ?edTraining . + ?edTraining a core:EducationalProcess . + ?edTraining ?edTrainingProp ?edTrainingValue . + ?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?org . + ?org a foaf:Organization . + ?org rdfs:label ?orgName . + } WHERE { + { + ?subject ?property ?edTraining . + ?edTraining a core:EducationalProcess + } + UNION { + ?subject ?property ?edTraining . + ?edTraining a core:EducationalProcess . + ?edTraining ?edTrainingProp ?edTrainingValue + } + UNION { + ?subject ?property ?edTraining . + ?edTraining a core:EducationalProcess . + ?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?org . + ?org a foaf:Organization . + } + UNION { + ?subject ?property ?edTraining . + ?edTraining a core:EducationalProcess . + ?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?org . + ?org a foaf:Organization . + ?org rdfs:label ?orgName + } + } + + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX core: <http://vivoweb.org/ontology/core#> diff --git a/productMods/config/listViewConfig-orcidId.xml b/productMods/config/listViewConfig-orcidId.xml new file mode 100644 index 00000000..dbbee33a --- /dev/null +++ b/productMods/config/listViewConfig-orcidId.xml @@ -0,0 +1,28 @@ + + + + + + + + PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> + SELECT ?value ?localName + WHERE { + ?subject ?property ?value + LET (?localName := afn:localname(?value)) + } LIMIT 1 + + + + + CONSTRUCT { + ?subject ?property ?value + } WHERE { + ?subject ?property ?value + } + + + + diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-orcidId.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-orcidId.ftl new file mode 100644 index 00000000..58a68936 --- /dev/null +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-orcidId.ftl @@ -0,0 +1,17 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- VIVO-specific default data property statement template. + + This template must be self-contained and not rely on other variables set for the individual page, because it + is also used to generate the property statement during a deletion. + --> +<@showStatement statement /> + +<#macro showStatement statement> + ${statement.localName!statement.value!} + + + + + + diff --git a/productMods/templates/freemarker/edit/forms/addOrcidIdToPerson.ftl b/productMods/templates/freemarker/edit/forms/addOrcidIdToPerson.ftl new file mode 100644 index 00000000..d4d5d4f2 --- /dev/null +++ b/productMods/templates/freemarker/edit/forms/addOrcidIdToPerson.ftl @@ -0,0 +1,87 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- this is in request.subject.name --> + +<#-- leaving this edit/add mode code in for reference in case we decide we need it --> + +<#import "lib-vivo-form.ftl" as lvf> + +<#--Retrieve certain edit configuration information--> +<#if editConfiguration.objectUri?has_content> + <#assign editMode = "edit"> +<#else> + <#assign editMode = "add"> + + +<#assign htmlForElements = editConfiguration.pageData.htmlForElements /> + +<#--Retrieve variables needed--> +<#assign orcidIdFromConf = lvf.getFormFieldValue(editSubmission, editConfiguration, "orcidId") /> +<#assign orcidIdValue = orcidIdFromConf?replace("http://www.orcid.org/","") /> +<#--If edit submission exists, then retrieve validation errors if they exist--> +<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content> + <#assign submissionErrors = editSubmission.validationErrors/> + + +<#if editMode == "edit"> + <#assign titleVerb="${i18n().edit_capitalized}"> + <#assign submitButtonText="${titleVerb}" + " ORCID iD"> + <#assign disabledVal="disabled"> +<#else> + <#assign titleVerb="${i18n().create_capitalized}"> + <#assign submitButtonText="${titleVerb}" + " ORCID iD"> + <#assign disabledVal=""/> + + +<#assign requiredHint = " *" /> + +

${titleVerb} ORCID iD ${i18n().for} ${editConfiguration.subjectName}

+ +<#--Display error messages if any--> +<#if submissionErrors?has_content> + + + +<@lvf.unsupportedBrowser urls.base /> + +
+ +
+ +

+ + +

+ + + +

+ ${i18n().or} + ${i18n().cancel_link} +

+ +

* ${i18n().required_fields}

+ +
+ +
+ +${stylesheets.add('')} +${stylesheets.add('')} +${stylesheets.add('')} + +${scripts.add('', + '', + '', + '', + '')} + + diff --git a/productMods/templates/freemarker/edit/forms/js/addOrcidIdToPersonUtils.js b/productMods/templates/freemarker/edit/forms/js/addOrcidIdToPersonUtils.js new file mode 100644 index 00000000..5a9cffad --- /dev/null +++ b/productMods/templates/freemarker/edit/forms/js/addOrcidIdToPersonUtils.js @@ -0,0 +1,39 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + + +var addOrcidIdToPersonUtils = { + + onLoad: function() { + this.initObjectReferences(); + this.bindEventListeners(); + }, + + initObjectReferences: function() { + + this.form = $('#personHasOrcidId'); + this.orcidId = $('#orcidId'); + + }, + + bindEventListeners: function() { + + this.form.submit(function() { + addOrcidIdToPersonUtils.buildOrcidIdURL(); + }); + + }, + + buildOrcidIdURL: function() { + + var orcidBase = "http://www.orcid.org/"; + var orcidIdVal = ""; + if ( this.orcidId.val().length > 0 ) { + orcidIdVal = orcidBase + this.orcidId.val(); + this.orcidId.val(orcidIdVal); + } + }, + +} +$(document).ready(function() { + addOrcidIdToPersonUtils.onLoad(); +}); diff --git a/productMods/templates/freemarker/edit/forms/js/awardReceiptUtils.js b/productMods/templates/freemarker/edit/forms/js/awardReceiptUtils.js index 8f10a968..f8183a18 100644 --- a/productMods/templates/freemarker/edit/forms/js/awardReceiptUtils.js +++ b/productMods/templates/freemarker/edit/forms/js/awardReceiptUtils.js @@ -105,7 +105,6 @@ var awardReceiptUtils = { rdfsLabel += " (" + this.subjectName + ")"; } this.recLabel.val(rdfsLabel); - alert(this.recLabel.val()); }, setYearAwardedValue: function() { diff --git a/productMods/templates/freemarker/edit/forms/personHasEducationalTraining.ftl b/productMods/templates/freemarker/edit/forms/personHasEducationalTraining.ftl index d7ab5d20..51402c88 100644 --- a/productMods/templates/freemarker/edit/forms/personHasEducationalTraining.ftl +++ b/productMods/templates/freemarker/edit/forms/personHasEducationalTraining.ftl @@ -37,9 +37,10 @@ Set this flag on the input acUriReceiver where you would like this behavior to o <#assign awardedDegreeLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "awardedDegreeLabel") /> <#assign existingOrgValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingOrg") /> <#assign trainingTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "trainingType")/> -<#assign existingADLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingAwardedDegreeLabel") /> - -<#--If edit submission exists, then retrieve validation errors if they exist--> +<#-- + <#assign existingADLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "existingAwardedDegreeLabel") /> +--> +<#-- If edit submission exists, then retrieve validation errors if they exist--> <#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content> <#assign submissionErrors = editSubmission.validationErrors/> @@ -164,12 +165,15 @@ Set this flag on the input acUriReceiver where you would like this behavior to o +<#-- <#if editMode == "edit" || editMode == "repair"> <#else> +--> +

diff --git a/rdf/display/everytime/PropertyConfig.n3 b/rdf/display/everytime/PropertyConfig.n3 index 80fa8df4..27f1eca4 100644 --- a/rdf/display/everytime/PropertyConfig.n3 +++ b/rdf/display/everytime/PropertyConfig.n3 @@ -358,6 +358,21 @@ local:informationResourceInEditorshipConfig a :ObjectPropertyDisplayConfig ; vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddEditorsToInformationResourceGenerator"^^ ; :propertyGroup . +local:editorOfContext a :ConfigContext ; + :hasConfiguration local:editorOfConfig ; + :configContextFor ; + :qualifiedByDomain ; + :qualifiedBy . + +local:editorOfConfig a :ObjectPropertyDisplayConfig ; + :listViewConfigFile "listViewConfig-editorship.xml"^^xsd:string ; + :displayName "editor of" ; + vitro:displayRankAnnot 20; + vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ; + vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ; + vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddEditorshipToPersonGenerator"^^ ; + :propertyGroup . + ### vcard properties ### local:mailingAddressContext a :ConfigContext ; @@ -450,21 +465,6 @@ local:fullNameConfig a :ObjectPropertyDisplayConfig ; vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddFullNameToPersonGenerator"^^ ; :propertyGroup . -local:editorOfContext a :ConfigContext ; - :hasConfiguration local:editorOfConfig ; - :configContextFor ; - :qualifiedByDomain ; - :qualifiedBy . - -local:editorOfConfig a :ObjectPropertyDisplayConfig ; - :listViewConfigFile "listViewConfig-editorship.xml"^^xsd:string ; - :displayName "editor of" ; - vitro:displayRankAnnot 20; - vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ; - vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ; - vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddEditorshipToPersonGenerator"^^ ; - :propertyGroup . - ### properties using default editing form ## local:eventWithinContext a :ConfigContext ; diff --git a/rdf/display/everytime/vivoListViewConfig.rdf b/rdf/display/everytime/vivoListViewConfig.rdf index 4e11905f..5edf3469 100644 --- a/rdf/display/everytime/vivoListViewConfig.rdf +++ b/rdf/display/everytime/vivoListViewConfig.rdf @@ -96,6 +96,10 @@ listViewConfig-hasAssociatedConcept.xml + + listViewConfig-orcidId.xml + +