From 902fbbc4cdfd412fbf5f80a0af068c45b25b2a53 Mon Sep 17 00:00:00 2001 From: tworrall Date: Wed, 16 Oct 2013 15:54:44 -0400 Subject: [PATCH] VIVO-370: fixed incorrect middleName property uri --- .../listViewConfig-authorInAuthorship.xml | 3 ++ .../config/listViewConfig-fullName.xml | 8 +++-- .../individual/propStatement-fullName.ftl | 5 ++- .../edit/forms/addFullNameToPerson.ftl | 8 +++-- .../freemarker/lib/lib-home-page.ftl | 2 +- ...AuthorsToInformationResourceGenerator.java | 6 ++-- ...EditorsToInformationResourceGenerator.java | 6 ++-- .../AddFullNameToPersonGenerator.java | 32 ++++++++++++++++--- .../NewIndividualFormGenerator.java | 10 +++--- 9 files changed, 59 insertions(+), 21 deletions(-) diff --git a/productMods/config/listViewConfig-authorInAuthorship.xml b/productMods/config/listViewConfig-authorInAuthorship.xml index 2d03b3f7..401eaad6 100644 --- a/productMods/config/listViewConfig-authorInAuthorship.xml +++ b/productMods/config/listViewConfig-authorInAuthorship.xml @@ -43,6 +43,7 @@ ?publisherObj rdfs:label ?publisher } OPTIONAL { ?infoResource core:relatedBy ?editorship . + ?editorship a core:Editorship . ?editorship core:relates ?editorObj . ?editorObj rdfs:label ?editor } @@ -89,6 +90,7 @@ PREFIX bibo: <http://purl.org/ontology/bibo/> CONSTRUCT { ?subject ?property ?authorship . + ?authorship a core:Authorship . ?authorship ?authorshipProperty ?authorshipValue . ?authorship core:relates ?infoResource . ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . @@ -196,6 +198,7 @@ ?authorship core:relates ?infoResource . ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> . ?infoResource core:relatedBy ?editorship . + ?editorship a core:Editorship . ?editorship core:relates ?editorObj . ?editorObj rdfs:label ?editor } UNION { diff --git a/productMods/config/listViewConfig-fullName.xml b/productMods/config/listViewConfig-fullName.xml index c986c87c..98953c4e 100644 --- a/productMods/config/listViewConfig-fullName.xml +++ b/productMods/config/listViewConfig-fullName.xml @@ -6,18 +6,22 @@ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> + PREFIX core: <http://vivoweb.org/ontology/core#> SELECT DISTINCT ?vcard ?fullName ?firstName ?middleName ?lastName + ?suffix + ?prefix WHERE { ?subject ?property ?vcard . ?vcard vcard:hasName ?fullName OPTIONAL { ?fullName vcard:givenName ?firstName } - OPTIONAL { ?fullName vcard:middleName ?middleName } + OPTIONAL { ?fullName core:middleName ?middleName } OPTIONAL { ?fullName vcard:familyName ?lastName } - + OPTIONAL { ?fullName vcard:honorificSuffix ?suffix } + OPTIONAL { ?fullName vcard:honorificPrefix ?prefix } } diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-fullName.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-fullName.ftl index 8352bf1a..a684bb48 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-fullName.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-fullName.ftl @@ -11,7 +11,10 @@ <#macro showFullName statement> <#if statement.fullName?has_content> - ${statement.firstName!} ${statement.middleName!} ${statement.lastName!} + <#if statement.prefix??>${statement.prefix!} + ${statement.firstName!} + ${statement.middleName!} + ${statement.lastName!}<#if statement.suffix??>, ${statement.suffix!} \ No newline at end of file diff --git a/productMods/templates/freemarker/edit/forms/addFullNameToPerson.ftl b/productMods/templates/freemarker/edit/forms/addFullNameToPerson.ftl index 5f448533..3956993c 100644 --- a/productMods/templates/freemarker/edit/forms/addFullNameToPerson.ftl +++ b/productMods/templates/freemarker/edit/forms/addFullNameToPerson.ftl @@ -19,6 +19,8 @@ <#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName") /> <#assign middleNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "middleName") /> <#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName") /> +<#assign suffixValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "suffix") /> +<#assign prefixValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "prefix") /> <#--If edit submission exists, then retrieve validation errors if they exist--> @@ -63,13 +65,15 @@

- + +

- + +

diff --git a/productMods/templates/freemarker/lib/lib-home-page.ftl b/productMods/templates/freemarker/lib/lib-home-page.ftl index eeb7415d..f105863c 100644 --- a/productMods/templates/freemarker/lib/lib-home-page.ftl +++ b/productMods/templates/freemarker/lib/lib-home-page.ftl @@ -125,7 +125,7 @@ <#if (group.individualCount > 0) && group.displayName == "research" > <#assign foundClassGroup = true /> <#list group.classes as class> - <#if (class.individualCount > 0) && (class.name == "Academic Article" || class.name == "Book" || class.name == "Chapter" ||class.name == "Conference Paper" || class.name == "Proceedings" || class.name == "Report") > + <#if (class.individualCount > 0) && (class.uri?contains("Academic Article") || class.uri?contains("Book") || class.uri?contains("Chapter") ||class.uri?contains("Conference Paper") || class.uri?contains("Proceedings") || class.uri?contains("Report")) >

  • ${class.individualCount!}  diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java index 2ab6f06f..4429a079 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java @@ -153,10 +153,10 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator "@prefix vcard: . \n" + "?newPerson ?vcardPerson . \n" + "?vcardPerson ?newPerson . \n" + - "?vcardPerson a . \n" + + "?vcardPerson a vcard:Individual . \n" + "?vcardPerson vcard:hasName ?vcardName . \n" + - "?vcardName a . \n" + - "?vcardName vcard:middleName ?middleName ."; + "?vcardName a vcard:Name . \n" + + "?vcardName ?middleName ."; } private String getN3NewPersonLastName() { diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditorsToInformationResourceGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditorsToInformationResourceGenerator.java index 030bc915..56ebd820 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditorsToInformationResourceGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditorsToInformationResourceGenerator.java @@ -149,10 +149,10 @@ public class AddEditorsToInformationResourceGenerator extends VivoBaseGenerator "@prefix vcard: . \n" + "?newPerson ?vcardPerson . \n" + "?vcardPerson ?newPerson . \n" + - "?vcardPerson a . \n" + + "?vcardPerson a vcard:Individual . \n" + "?vcardPerson vcard:hasName ?vcardName . \n" + - "?vcardName a . \n" + - "?vcardName vcard:middleName ?middleName ."; + "?vcardName a vcard:Name . \n" + + "?vcardName ?middleName ."; } private String getN3NewPersonLastName() { diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddFullNameToPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddFullNameToPersonGenerator.java index 172d49ac..f748555b 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddFullNameToPersonGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddFullNameToPersonGenerator.java @@ -47,16 +47,18 @@ public class AddFullNameToPersonGenerator extends VivoBaseGenerator implements conf.setVarNameForObject("individualVcard"); conf.setN3Required( Arrays.asList( n3ForNewName ) ); - conf.setN3Optional( Arrays.asList( firstNameAssertion, middleNameAssertion, lastNameAssertion ) ); + conf.setN3Optional( Arrays.asList( firstNameAssertion, middleNameAssertion, lastNameAssertion, suffixAssertion, prefixAssertion ) ); conf.addNewResource("fullName", DEFAULT_NS_FOR_NEW_RESOURCE); conf.addNewResource("individualVcard", DEFAULT_NS_FOR_NEW_RESOURCE); - conf.setLiteralsOnForm(Arrays.asList("firstName", "middleName", "lastName" )); + conf.setLiteralsOnForm(Arrays.asList("firstName", "middleName", "lastName", "suffix", "prefix" )); conf.addSparqlForExistingLiteral("firstName", firstNameQuery); conf.addSparqlForExistingLiteral("middleName", middleNameQuery); conf.addSparqlForExistingLiteral("lastName", lastNameQuery); + conf.addSparqlForExistingLiteral("suffix", suffixQuery); + conf.addSparqlForExistingLiteral("prefix", prefixQuery); conf.addSparqlForAdditionalUrisInScope("individualVcard", individualVcardQuery); if ( conf.isUpdate() ) { @@ -79,6 +81,14 @@ public class AddFullNameToPersonGenerator extends VivoBaseGenerator implements .setRangeDatatypeUri( XSD.xstring.toString() ). setValidators( list("nonempty") )); + conf.addField( new FieldVTwo(). + setName("suffix") + .setRangeDatatypeUri( XSD.xstring.toString()) ); + + conf.addField( new FieldVTwo(). + setName("prefix") + .setRangeDatatypeUri( XSD.xstring.toString()) ); + conf.addValidator(new AntiXssValidation()); prepare(vreq, conf); @@ -98,11 +108,17 @@ public class AddFullNameToPersonGenerator extends VivoBaseGenerator implements "?fullName ?firstName ."; final static String middleNameAssertion = - "?fullName ?middleName ."; + "?fullName ?middleName ."; final static String lastNameAssertion = "?fullName ?lastName ."; + final static String suffixAssertion = + "?fullName ?suffix ."; + + final static String prefixAssertion = + "?fullName ?prefix ."; + /* Queries for editing an existing entry */ final static String individualVcardQuery = @@ -116,12 +132,20 @@ public class AddFullNameToPersonGenerator extends VivoBaseGenerator implements final static String middleNameQuery = "SELECT ?existingMiddleName WHERE {\n"+ - "?fullName ?existingMiddleName . }"; + "?fullName ?existingMiddleName . }"; final static String lastNameQuery = "SELECT ?existingLastName WHERE {\n"+ "?fullName ?existingLastName . }"; + final static String suffixQuery = + "SELECT ?existingSuffix WHERE {\n"+ + "?fullName ?existingSuffix . }"; + + final static String prefixQuery = + "SELECT ?existingPrefix WHERE {\n"+ + "?fullName ?existingPrefix . }"; + private String getFullNameUri(VitroRequest vreq) { String fullNameUri = vreq.getParameter("fullNameUri"); diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/NewIndividualFormGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/NewIndividualFormGenerator.java index 51b929a8..4ebe249a 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/NewIndividualFormGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/NewIndividualFormGenerator.java @@ -46,12 +46,12 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i N3_PREFIX + "@prefix vcard: .\n" + " ?newInd ?newVcardInd . \n" + " ?newVcardInd ?newInd . \n" - + " ?newVcardInd a . \n" + + " ?newVcardInd a vcard:Individual . \n" + " ?newVcardInd vcard:hasName ?newVcardName . \n" - + " ?newVcardName a . \n" + + " ?newVcardName a vcard:Name . \n" + " ?newVcardName vcard:givenName ?firstName . \n" - + " ?newVcardName vcard:familyName ?lastName .", - "?newVcardName ?middleName .", + + " ?newVcardName vcard:familyName ?lastName . \n" + + " ?newVcardName ?middleName .", N3_PREFIX + " ?newInd <" + RDFS.label.getURI() + "> ?label ." )); @@ -90,7 +90,7 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i //This combines the first and last name into the rdfs:label // currently being done via javascript in the template. May use this again - // when/if updated to IFS ontology. tlw72 + // when/if updated to ISF ontology. tlw72 // config.addModelChangePreprocessor(new FoafNameToRdfsLabelPreprocessor()); String formUrl = EditConfigurationUtils.getFormUrlWithoutContext(vreq);