Sprint i18n with main (#215)
* Layer uqam updates onto master (minus trailing whitespace) * Update AddOrganizerRoleToPersonGenerator.java Removed extraneous whitespace * My whitespace (#153) * Update AddPublicationToPersonGenerator.java * Removed extraneous whitespace AND move RootUserPolicy.java from VIVO to Vitro * Fixed whitespace in: AddAttendeeRoleToPersonGenerator.java * Fixed indentations for AddOutreachProviderRoleToPersonGenerator.java * Fixed indentations * Removed extraneous whitespace (#158) * Removed extraneous whitespace * Fix bug introduced in cleaning up whitespace * Tagging UQAM comments with the following tags -Add-Feature -Optimization -Linguistic-Management -Bug-Correction * Update AddReviewerRoleToPersonGenerator.java * Added an internationalization correction to be considered in the vivo-i18n-core that was forgotten when sprint-i18n was created. * Fix typo in AddReviewerRoleToPersonGenerator Resolves: https://jira.lyrasis.org/browse/VIVO-1774 * Fix typo in AddOutreachProviderRoleToPersonGenerator Resolves: https://jira.lyrasis.org/browse/VIVO-1775 * Include language dependencies in build all of the time (#168) Move "LocaleSelectionSetup" higher in the startup list so that the Vitro:RDFFilesLoader has the locale info available on its startup Part of resolution to: https://jira.lyrasis.org/browse/VIVO-1836 Co-authored-by: Andrew Woods <awoods@duraspace.org> * Made modifications to publicationToPersonUtils.js so that multilangua… (#170) * Made modifications to publicationToPersonUtils.js so that multilanguage support will not break the javascript functionalty. Co-authored-by: root <root@vivo-development.hs-mittweida.de> Resolves: https://jira.lyrasis.org/browse/VIVO-1739 * Feature language en_CA (#169) * Changing ontology extensions for n3 & assigning a base IRI to each ontology Co-authored-by: michelheonuqam <heon.michel@uqam.ca> Co-authored-by: michelheon <heon@videotorn.ca> Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1862 * i18n: title tag and headings in capability map are in english in french version (#173) * added multi-language support for ticket VIVO-1846 * fixed swapped properties, added Capability map title to i18n Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1847 * Added i18n support for Capability Map control buttons, JIRA ticket VIVO-1846 * removed redundat files which are now available via Vitro- and VIVO-languages * added i18n support for the capability map, ticket vivo-1892 * Revert non-function RDF changes (#180) Related to: https://jira.lyrasis.org/browse/VIVO-1905 Co-authored-by: Andrew Woods <awoods@duraspace.org> * Ensure 'other' in Individual->Teaching->advisees->type is translated Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1881 * [VIVO-1842] i18n: Added function js_string at i18n variables to handle quotes properly (#181) * added js_string at i18n strings to handle quotes properly, ticket vivo-1842 Partial resolution for: https://jira.lyrasis.org/browse/VIVO-1842 * replace static headings with i18n values (#183) Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1844 * added empty check for getCountry, fixing bug with spanish label (es), ticket vivo-1900 (#182) Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1900 * Issue/vivo 1908 (#185) * Provide fallback language in language-filtered webpage SPARQL query and use existing RDFService-based filtering for ConstantFieldOptions Resolves: https://jira.lyrasis.org/browse/VIVO-1906 * Fix bug of missing toString() (#187) Related to: https://jira.lyrasis.org/browse/VIVO-1906 Co-authored-by: Andrew Woods <awoods@duraspace.org> * Remove files replicated in i18n (#186) Related to: https://jira.lyrasis.org/browse/VIVO-1917 * removed redundant vitroAnnotations, now in VIVO-languages, ticket vivo-1821 * Removed key.png from the template and replaced it with css sprite and… (#184) * Removed key.png from the template and replaced it with css sprite and descriptions in plain text. * * adding height to background images, hopefully fixing issues Partial resolution for: https://jira.lyrasis.org/browse/VIVO-1902 * [VIVO-1915] i18n - removing language select for label management for individuals (#190) * removed the language select for managing multi language labels fpr individuals, ticket vivo-1915 * modified ManageLabelsForPersonGenerator so that you can only add an langauge label if it is not already set, ticket vivo-1915 Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1915 * - added i18n() to hardcoded values * added i18n support to person's domain in capability map, ticket 1867 * [VIVO-1946] - Update ResearcherID description in vivo.owl (#188) * Update ResearcherID description in vivo.owl Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1946 * [VIVO-1936] i18n: updated the language comment in runtime.properties (#203) Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1936 Co-authored-by: Kampe <Benjamin.Kampe@tib.eu> * [VIVO-1924] i18n: @en i18n properties are not loaded during first site startup. (#204) * rearranged startup-listeners fixing bug with language files, ticket VIVO-1924 * Added a comment to prevent future bugs like this, ticket VIVO-1924 * fixed previous comment, ticket VIVO-1924 * Remove duplicate text from dropdown menus * Minor checkstyle correction following: VIVO-1936 (#206) Follow-on to: https://jira.lyrasis.org/browse/VIVO-1936 Co-authored-by: Andrew Woods <awoods@duraspace.org> * follow-up on vivo-1936 - restore default values in example-settings.xml (#210) Co-authored-by: gneissone <mbgross@wustl.edu> * [VIVO-1798] - Internationalize first and last name validation (#207) * Internationalize first and last name validation Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1798 * adding collections process terms (#165) * adding collections process terms No JIRA :( * Non-functional change to comment in example.applicationSetup.n3 Related to: https://jira.lyrasis.org/browse/VIVO-1741 * Update orcidConfirm.ftl (#199) Fix i18n property used on ORCID confirmation step 2 button. Related to https://jira.lyrasis.org/browse/VIVO-1945 * Fix external AGROVOC service URL * URL fix for LCSH service * Remove unnecessary pom.xml 'profile' - Also, uncomment language overlays - Noting that this is not actually necessary, as any 'war' Maven dependencies are automatically overlayed: - https://maven.apache.org/plugins/maven-war-plugin/overlays.html Co-authored-by: Andrew Woods <awoods@duraspace.org> Co-authored-by: Nicolas D <46490666+nicalico@users.noreply.github.com> Co-authored-by: UQAM-VIVO <heon.michel@uqam.ca> Co-authored-by: matthiasluehr <60263380+matthiasluehr@users.noreply.github.com> Co-authored-by: Michel Heon <heon@videotron.ca> Co-authored-by: dofeldsc <dofeldsc@uos.de> Co-authored-by: William Welling <wwelling@library.tamu.edu> Co-authored-by: Brian Lowe <brianjlowe@gmail.com> Co-authored-by: Matthias Lühr <luehr@hs-mittweida.de> Co-authored-by: Ben <mbgross@wustl.edu> Co-authored-by: Benjamin Kampe <benjamin@fehrmanns.net> Co-authored-by: Kampe <Benjamin.Kampe@tib.eu> Co-authored-by: Gross, Benjamin <benjamin.gross@clarivate.com> Co-authored-by: diatomsRcool <annethessen@gmail.com> Co-authored-by: L.O <53535673+lb-ov@users.noreply.github.com>
This commit is contained in:
parent
f97972e5aa
commit
268ffa1cd7
102 changed files with 1253 additions and 9703 deletions
|
@ -58,7 +58,7 @@ public class AgrovocService implements ExternalConceptService {
|
|||
protected final String dbpedia_endpoint = " http://dbpedia.org/sparql";
|
||||
// URL to get all the information for a concept
|
||||
|
||||
protected final String conceptSkosMosBase = "http://agrovoc.uniroma2.it/agrovoc/rest/v1/";
|
||||
protected final String conceptSkosMosBase = "https://agrovoc.uniroma2.it/agrovoc/rest/v1/";
|
||||
protected final String conceptsSkosMosSearch = conceptSkosMosBase + "search?";
|
||||
protected final String conceptSkosMosURL = conceptSkosMosBase + "data?";
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,7 @@ public class LCSHService implements ExternalConceptService {
|
|||
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
private final String skosSuffix = ".skos.rdf";
|
||||
private final String hostUri = "http://id.loc.gov";
|
||||
private final String hostUri = "https://id.loc.gov";
|
||||
private final String schemeUri = hostUri + "/authorities/subjects";
|
||||
private final String baseUri = hostUri + "/search/";
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class LCSHService implements ExternalConceptService {
|
|||
bestMatch = "false";
|
||||
}
|
||||
log.debug("-" + uri + "-");
|
||||
//This is the URL for retrieving the concept - the pattern is http://id.loc.gov/authorities/subjects/sh85014203.skos.rdf
|
||||
//This is the URL for retrieving the concept - the pattern is https://id.loc.gov/authorities/subjects/sh85014203.skos.rdf
|
||||
//This is not the URI itself which would be http://id.loc.gov/authorities/subjects/sh85014203
|
||||
String conceptURLString = getSKOSURL(uri);
|
||||
String baseConceptURI = uri;
|
||||
|
@ -152,7 +152,7 @@ public class LCSHService implements ExternalConceptService {
|
|||
|
||||
|
||||
private String getSKOSURL(String uri) {
|
||||
String skosURI = uri + skosSuffix;
|
||||
String skosURI = uri.replaceFirst("http://", "https://") + skosSuffix;
|
||||
|
||||
return skosURI;
|
||||
}
|
||||
|
|
|
@ -11,15 +11,18 @@ import org.apache.jena.rdf.model.Literal;
|
|||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.N3ValidatorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.MultiValueEditSubmission;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
|
||||
|
||||
public class FirstAndLastNameValidator implements N3ValidatorVTwo {
|
||||
|
||||
private static String MISSING_FIRST_NAME_ERROR = "You must enter a value in the First Name field.";
|
||||
private static String MISSING_LAST_NAME_ERROR = "You must enter a value in the Last Name field.";
|
||||
private static String MALFORMED_LAST_NAME_ERROR = "The last name field may not contain a comma. Please enter first name in First Name field.";
|
||||
private static String MISSING_FIRST_NAME_ERROR = "first_name_empty_msg";
|
||||
private static String MISSING_LAST_NAME_ERROR = "last_name_empty_msg";
|
||||
private static String MALFORMED_LAST_NAME_ERROR = "malformed_last_name_msg";
|
||||
private I18nBundle i18n;
|
||||
private String uriReceiver;
|
||||
|
||||
public FirstAndLastNameValidator(String uriReceiver) {
|
||||
public FirstAndLastNameValidator(String uriReceiver, I18nBundle i18n) {
|
||||
this.i18n = i18n;
|
||||
this.uriReceiver = uriReceiver;
|
||||
}
|
||||
|
||||
|
@ -68,14 +71,14 @@ public class FirstAndLastNameValidator implements N3ValidatorVTwo {
|
|||
}
|
||||
|
||||
if (lastName == null) {
|
||||
errors.put("lastName", MISSING_LAST_NAME_ERROR);
|
||||
errors.put("lastName", i18n.text(MISSING_LAST_NAME_ERROR));
|
||||
// Don't reject space in the last name: de Vries, etc.
|
||||
} else if (lastNameValue.contains(",")) {
|
||||
errors.put("lastName", MALFORMED_LAST_NAME_ERROR);
|
||||
errors.put("lastName", i18n.text(MALFORMED_LAST_NAME_ERROR));
|
||||
}
|
||||
|
||||
if (firstName == null) {
|
||||
errors.put("firstName", MISSING_FIRST_NAME_ERROR);
|
||||
errors.put("firstName", i18n.text(MISSING_FIRST_NAME_ERROR));
|
||||
}
|
||||
|
||||
return errors.size() != 0 ? errors : null;
|
||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class AddAttendeeRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
|
@ -21,28 +22,28 @@ public class AddAttendeeRoleToPersonGenerator extends AddRoleToPersonTwoStageGen
|
|||
/** Editor role involves hard-coded options for the "right side" of the role or activity. */
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return new ConstantFieldOptions(
|
||||
"", "Select type",
|
||||
"http://purl.org/NET/c4dm/event.owl#Event", "Event",
|
||||
"http://vivoweb.org/ontology/core#Competition", "Competition",
|
||||
"http://purl.org/ontology/bibo/Conference", "Conference",
|
||||
"http://vivoweb.org/ontology/core#Course", "Course",
|
||||
"http://vivoweb.org/ontology/core#Exhibit", "Exhibit",
|
||||
"http://purl.org/ontology/bibo/Hearing", "Hearing",
|
||||
"http://purl.org/ontology/bibo/Interview", "Interview",
|
||||
"http://vivoweb.org/ontology/core#Meeting", "Meeting",
|
||||
"http://purl.org/ontology/bibo/Performance", "Performance",
|
||||
"http://vivoweb.org/ontology/core#Presentation", "Presentation",
|
||||
"http://vivoweb.org/ontology/core#InvitedTalk", "Invited Talk",
|
||||
"http://purl.org/ontology/bibo/Workshop", "Workshop",
|
||||
"http://vivoweb.org/ontology/core#EventSeries", "Event Series",
|
||||
"http://vivoweb.org/ontology/core#ConferenceSeries", "Conference Series",
|
||||
"http://vivoweb.org/ontology/core#SeminarSeries", "Seminar Series",
|
||||
"http://vivoweb.org/ontology/core#WorkshopSeries", "Workshop Series"
|
||||
);
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(), "",
|
||||
I18n.bundle(vreq).text("select_type"),
|
||||
"http://purl.org/NET/c4dm/event.owl#Event",
|
||||
"http://vivoweb.org/ontology/core#Competition",
|
||||
"http://purl.org/ontology/bibo/Conference",
|
||||
"http://vivoweb.org/ontology/core#Course",
|
||||
"http://vivoweb.org/ontology/core#Exhibit",
|
||||
"http://purl.org/ontology/bibo/Hearing",
|
||||
"http://purl.org/ontology/bibo/Interview",
|
||||
"http://vivoweb.org/ontology/core#Meeting",
|
||||
"http://purl.org/ontology/bibo/Performance",
|
||||
"http://vivoweb.org/ontology/core#Presentation",
|
||||
"http://vivoweb.org/ontology/core#InvitedTalk",
|
||||
"http://purl.org/ontology/bibo/Workshop",
|
||||
"http://vivoweb.org/ontology/core#EventSeries",
|
||||
"http://vivoweb.org/ontology/core#ConferenceSeries",
|
||||
"http://vivoweb.org/ontology/core#SeminarSeries",
|
||||
"http://vivoweb.org/ontology/core#WorkshopSeries"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField() {
|
||||
return false;
|
||||
}
|
||||
|
@ -65,3 +66,4 @@ public class AddAttendeeRoleToPersonGenerator extends AddRoleToPersonTwoStageGen
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class AddClinicalRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
|
@ -22,22 +23,21 @@ public class AddClinicalRoleToPersonGenerator extends AddRoleToPersonTwoStageGen
|
|||
}
|
||||
|
||||
/** Clinical role involves hard-coded options for the "right side" of the role or activity. */
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return new ConstantFieldOptions(
|
||||
"", "Select one",
|
||||
"http://vivoweb.org/ontology/core#Project", "Project",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000005", "Service"
|
||||
);
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(), "",
|
||||
I18n.bundle(vreq).text("select_type"),
|
||||
"http://vivoweb.org/ontology/core#Project",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000005" /* Service */
|
||||
);
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
@Override
|
||||
boolean isShowRoleLabelField(){
|
||||
boolean isShowRoleLabelField(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Use the methods below to change the date/time precision in the
|
||||
* custom form associated with this generator. When not used, the
|
||||
|
|
|
@ -5,6 +5,8 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
|
||||
/**
|
||||
* Generates the edit configuration for adding a Role to a Person.
|
||||
|
||||
|
@ -46,8 +48,13 @@ public class AddEditorRoleToPersonGenerator extends AddRoleToPersonTwoStageGener
|
|||
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
// UQAM-Linguistic-Management Managing linguistic context
|
||||
I18nBundle i18n = I18n.bundle(vreq);
|
||||
String i18nSelectType = i18n.text("select_type");
|
||||
String selectType = (i18nSelectType == null || i18nSelectType.isEmpty()) ? "Select type" : i18nSelectType ;
|
||||
|
||||
return new ChildVClassesOptions(OPTION_CLASS_URI)
|
||||
.setDefaultOptionLabel("Select type");
|
||||
.setDefaultOptionLabel(selectType);
|
||||
}
|
||||
|
||||
/** Do not show the role label field for the AddEditorRoleToPerson form */
|
||||
|
|
|
@ -32,6 +32,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUti
|
|||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
/**
|
||||
* This is a slightly unusual generator that is used by Manage Editors on
|
||||
|
@ -83,7 +84,7 @@ public class AddEditorsToInformationResourceGenerator extends VivoBaseGenerator
|
|||
//template file
|
||||
editConfiguration.setTemplate("addEditorsToInformationResource.ftl");
|
||||
//add validators
|
||||
editConfiguration.addValidator(new FirstAndLastNameValidator("personUri"));
|
||||
editConfiguration.addValidator(new FirstAndLastNameValidator("personUri", I18n.bundle(vreq)));
|
||||
|
||||
//Adding additional data, specifically edit mode
|
||||
addFormSpecificData(editConfiguration, vreq);
|
||||
|
|
|
@ -23,9 +23,10 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
|
||||
|
@ -108,8 +109,8 @@ public class AddEditorshipToPersonGenerator extends VivoBaseGenerator implements
|
|||
conf.addField( new FieldVTwo().
|
||||
setName("documentType").
|
||||
setValidators( list("nonempty") ).
|
||||
setOptions( new ConstantFieldOptions("documentType", getDocumentTypeLiteralOptions() ))
|
||||
);
|
||||
// UQAM-Linguistic-Management vreq for linguistic context
|
||||
setOptions( getDocumentTypeLiteralOptions(vreq) ) );
|
||||
|
||||
conf.addField( new FieldVTwo().
|
||||
setName("documentLabel").
|
||||
|
@ -203,21 +204,22 @@ public class AddEditorshipToPersonGenerator extends VivoBaseGenerator implements
|
|||
return null;
|
||||
}
|
||||
|
||||
private List<List<String>> getDocumentTypeLiteralOptions() {
|
||||
List<List<String>> literalOptions = new ArrayList<List<String>>();
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Book", "Book"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Chapter", "Chapter"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/EditedBook", "Edited Book"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Film", "Film"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Magazine", "Magazine"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Newsletter", "Newsletter"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Newspaper", "Newspaper"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#NewsRelease", "News Release"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Report", "Report"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Video", "Video"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Webpage", "Webpage"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Website", "Website"));
|
||||
return literalOptions;
|
||||
private FieldOptions getDocumentTypeLiteralOptions(VitroRequest vreq) throws Exception {
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(), "",
|
||||
I18n.bundle(vreq).text("select_type"),
|
||||
"http://purl.org/ontology/bibo/Book",
|
||||
"http://purl.org/ontology/bibo/Chapter",
|
||||
"http://purl.org/ontology/bibo/EditedBook",
|
||||
"http://purl.org/ontology/bibo/Film",
|
||||
"http://purl.org/ontology/bibo/Magazine",
|
||||
"http://vivoweb.org/ontology/core#Newsletter",
|
||||
"http://purl.org/ontology/bibo/Newspaper",
|
||||
"http://vivoweb.org/ontology/core#NewsRelease",
|
||||
"http://purl.org/ontology/bibo/Report",
|
||||
"http://vivoweb.org/ontology/core#Video",
|
||||
"http://purl.org/ontology/bibo/Webpage",
|
||||
"http://purl.org/ontology/bibo/Website");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
|
||||
|
||||
public class AddHeadOfRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
|
@ -25,10 +27,14 @@ public class AddHeadOfRoleToPersonGenerator extends AddRoleToPersonTwoStageGener
|
|||
/** Head Of role involves hard-coded options for the "right side" of the role or activity */
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
// UQAM-Linguistic-Management Taking into account the linguistic context
|
||||
I18nBundle i18n = I18n.bundle(vreq);
|
||||
String i18nSelectType = i18n.text("select_type");
|
||||
String selectType = (i18nSelectType == null || i18nSelectType.isEmpty()) ? "Select type" : i18nSelectType ;
|
||||
|
||||
return new
|
||||
ChildVClassesOptions(OPTION_CLASS_URI)
|
||||
.setDefaultOptionLabel("Select type");
|
||||
.setDefaultOptionLabel(selectType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,9 +2,28 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.jena.query.Query;
|
||||
import org.apache.jena.query.QueryExecution;
|
||||
import org.apache.jena.query.QueryExecutionFactory;
|
||||
import org.apache.jena.query.QueryFactory;
|
||||
import org.apache.jena.query.QuerySolution;
|
||||
import org.apache.jena.query.ResultSet;
|
||||
import org.apache.jena.rdf.model.AnonId;
|
||||
import org.apache.jena.rdf.model.Model;
|
||||
import org.apache.jena.rdf.model.ModelFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.selection.SelectedLocale;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceUtils;
|
||||
|
||||
public class AddMemberRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
|
@ -20,44 +39,45 @@ public class AddMemberRoleToPersonGenerator extends AddRoleToPersonTwoStageGener
|
|||
return "http://vivoweb.org/ontology/core#MemberRole";
|
||||
}
|
||||
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return new ConstantFieldOptions(
|
||||
"","Select type",
|
||||
"http://vivoweb.org/ontology/core#AcademicDepartment","Academic Department",
|
||||
"http://vivoweb.org/ontology/core#Association","Association",
|
||||
"http://vivoweb.org/ontology/core#Center","Center",
|
||||
"http://vivoweb.org/ontology/core#ClinicalOrganization","Clinical Organization",
|
||||
"http://vivoweb.org/ontology/core#College","College",
|
||||
"http://vivoweb.org/ontology/core#Committee","Committee",
|
||||
"http://vivoweb.org/ontology/core#Company","Company",
|
||||
"http://vivoweb.org/ontology/core#Consortium","Consortium",
|
||||
"http://vivoweb.org/ontology/core#CoreLaboratory","Core Laboratory",
|
||||
"http://vivoweb.org/ontology/core#Department","Department",
|
||||
"http://vivoweb.org/ontology/core#Division","Division",
|
||||
"http://vivoweb.org/ontology/core#ExtensionUnit","Extension Unit",
|
||||
"http://vivoweb.org/ontology/core#Foundation","Foundation",
|
||||
"http://vivoweb.org/ontology/core#FundingOrganization","Funding Organization",
|
||||
"http://vivoweb.org/ontology/core#GovernmentAgency","Government Agency",
|
||||
"http://xmlns.com/foaf/0.1/Group","Group",
|
||||
"http://vivoweb.org/ontology/core#Hospital","Hospital",
|
||||
"http://vivoweb.org/ontology/core#Institute","Institute",
|
||||
"http://vivoweb.org/ontology/core#Laboratory","Laboratory",
|
||||
"http://vivoweb.org/ontology/core#Library","Library",
|
||||
"http://purl.obolibrary.org/obo/OBI_0000835","Manufacturer",
|
||||
"http://vivoweb.org/ontology/core#Museum","Museum",
|
||||
"http://xmlns.com/foaf/0.1/Organization","Organization",
|
||||
"http://vivoweb.org/ontology/core#PrivateCompany","Private Company",
|
||||
"http://vivoweb.org/ontology/core#Program","Program",
|
||||
"http://vivoweb.org/ontology/core#Publisher","Publisher",
|
||||
"http://vivoweb.org/ontology/core#ResearchOrganization","Research Organization",
|
||||
"http://vivoweb.org/ontology/core#School","School",
|
||||
"http://vivoweb.org/ontology/core#Team","Team",
|
||||
"http://vivoweb.org/ontology/core#ServiceProvidingLaboratory","Service Providing Lab",
|
||||
"http://vivoweb.org/ontology/core#StudentOrganization","Student Organization",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000565","Technology Transfer Office",
|
||||
"http://vivoweb.org/ontology/core#University","University");
|
||||
}
|
||||
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(), "",
|
||||
I18n.bundle(vreq).text("select_type"),
|
||||
"http://vivoweb.org/ontology/core#AcademicDepartment",
|
||||
"http://vivoweb.org/ontology/core#Association",
|
||||
"http://vivoweb.org/ontology/core#Center",
|
||||
"http://vivoweb.org/ontology/core#ClinicalOrganization",
|
||||
"http://vivoweb.org/ontology/core#College",
|
||||
"http://vivoweb.org/ontology/core#Committee",
|
||||
"http://vivoweb.org/ontology/core#Company",
|
||||
"http://vivoweb.org/ontology/core#Consortium",
|
||||
"http://vivoweb.org/ontology/core#CoreLaboratory",
|
||||
"http://vivoweb.org/ontology/core#Department",
|
||||
"http://vivoweb.org/ontology/core#Division",
|
||||
"http://vivoweb.org/ontology/core#ExtensionUnit",
|
||||
"http://vivoweb.org/ontology/core#Foundation",
|
||||
"http://vivoweb.org/ontology/core#FundingOrganization",
|
||||
"http://vivoweb.org/ontology/core#GovernmentAgency",
|
||||
"http://xmlns.com/foaf/0.1/Group",
|
||||
"http://vivoweb.org/ontology/core#Hospital",
|
||||
"http://vivoweb.org/ontology/core#Institute",
|
||||
"http://vivoweb.org/ontology/core#Laboratory",
|
||||
"http://vivoweb.org/ontology/core#Library",
|
||||
"http://purl.obolibrary.org/obo/OBI_0000835" /* Manufacturer */,
|
||||
"http://vivoweb.org/ontology/core#Museum",
|
||||
"http://xmlns.com/foaf/0.1/Organization",
|
||||
"http://vivoweb.org/ontology/core#PrivateCompany",
|
||||
"http://vivoweb.org/ontology/core#Program",
|
||||
"http://vivoweb.org/ontology/core#Publisher",
|
||||
"http://vivoweb.org/ontology/core#ResearchOrganization",
|
||||
"http://vivoweb.org/ontology/core#School",
|
||||
"http://vivoweb.org/ontology/core#Team",
|
||||
"http://vivoweb.org/ontology/core#ServiceProvidingLaboratory",
|
||||
"http://vivoweb.org/ontology/core#StudentOrganization",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000565" /* Technology Transfer Office */,
|
||||
"http://vivoweb.org/ontology/core#University");
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField(){return true;}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class AddOrganizerRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
|
@ -22,26 +22,27 @@ public class AddOrganizerRoleToPersonGenerator extends AddRoleToPersonTwoStageGe
|
|||
}
|
||||
|
||||
//Organizer role involves hard-coded options for the "right side" of the role or activity
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return new ConstantFieldOptions(
|
||||
"","Select type",
|
||||
"http://vivoweb.org/ontology/core#Competition", "Competition",
|
||||
"http://purl.org/ontology/bibo/Conference", "Conference",
|
||||
"http://vivoweb.org/ontology/core#Course", "Course",
|
||||
"http://purl.org/NET/c4dm/event.owl#Event", "Event",
|
||||
"http://vivoweb.org/ontology/core#Exhibit", "Exhibit",
|
||||
"http://purl.org/ontology/bibo/Hearing", "Hearing",
|
||||
"http://purl.org/ontology/bibo/Interview", "Interview",
|
||||
"http://vivoweb.org/ontology/core#InvitedTalk", "Invited Talk",
|
||||
"http://vivoweb.org/ontology/core#Meeting", "Meeting",
|
||||
"http://purl.org/ontology/bibo/Performance", "Performance",
|
||||
"http://vivoweb.org/ontology/core#Presentation", "Presentation",
|
||||
"http://purl.org/ontology/bibo/Workshop", "Workshop",
|
||||
"http://vivoweb.org/ontology/core#ConferenceSeries", "Conference Series",
|
||||
"http://vivoweb.org/ontology/core#EventSeries", "Event Series",
|
||||
"http://vivoweb.org/ontology/core#SeminarSeries", "Seminar Series",
|
||||
"http://vivoweb.org/ontology/core#WorkshopSeries", "Workshop Series");
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(),
|
||||
"", I18n.bundle(vreq).text("select_type"),
|
||||
"http://vivoweb.org/ontology/core#Competition",
|
||||
"http://purl.org/ontology/bibo/Conference",
|
||||
"http://vivoweb.org/ontology/core#Course",
|
||||
"http://purl.org/NET/c4dm/event.owl#Event",
|
||||
"http://vivoweb.org/ontology/core#Exhibit",
|
||||
"http://purl.org/ontology/bibo/Hearing",
|
||||
"http://purl.org/ontology/bibo/Interview",
|
||||
"http://vivoweb.org/ontology/core#InvitedTalk",
|
||||
"http://vivoweb.org/ontology/core#Meeting",
|
||||
"http://purl.org/ontology/bibo/Performance",
|
||||
"http://vivoweb.org/ontology/core#Presentation",
|
||||
"http://purl.org/ontology/bibo/Workshop",
|
||||
"http://vivoweb.org/ontology/core#ConferenceSeries",
|
||||
"http://vivoweb.org/ontology/core#EventSeries",
|
||||
"http://vivoweb.org/ontology/core#SeminarSeries",
|
||||
"http://vivoweb.org/ontology/core#WorkshopSeries");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class AddOutreachProviderRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
|
@ -22,59 +22,60 @@ public class AddOutreachProviderRoleToPersonGenerator extends AddRoleToPersonTwo
|
|||
}
|
||||
|
||||
//Outreach Provider role involves hard-coded options for the "right side" of the role or activity
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return new ConstantFieldOptions(
|
||||
"","Select type",
|
||||
"http://vivoweb.org/ontology/core#AcademicDepartment","Academic Department",
|
||||
"http://vivoweb.org/ontology/core#Association","Association",
|
||||
"http://vivoweb.org/ontology/core#Center","Center",
|
||||
"http://vivoweb.org/ontology/core#ClinicalOrganization","Clinical Organization",
|
||||
"http://vivoweb.org/ontology/core#College","College",
|
||||
"http://vivoweb.org/ontology/core#Committee","Committee",
|
||||
"http://vivoweb.org/ontology/core#Company","Company",
|
||||
"http://vivoweb.org/ontology/core#Competition", "Competition",
|
||||
"http://purl.org/ontology/bibo/Conference", "Conference",
|
||||
"http://vivoweb.org/ontology/core#ConferenceSeries", "Conference Series",
|
||||
"http://vivoweb.org/ontology/core#Consortium","Consortium",
|
||||
"http://vivoweb.org/ontology/core#CoreLaboratory","Core Laboratory",
|
||||
"http://vivoweb.org/ontology/core#Course", "Course",
|
||||
"http://vivoweb.org/ontology/core#Department","Department",
|
||||
"http://vivoweb.org/ontology/core#Division","Division",
|
||||
"http://purl.org/NET/c4dm/event.owl#Event","Event",
|
||||
"http://vivoweb.org/ontology/core#EventSeries", "Event Series",
|
||||
"http://vivoweb.org/ontology/core#Exhibit", "Exhibit",
|
||||
"http://vivoweb.org/ontology/core#ExtensionUnit","Extension Unit",
|
||||
"http://vivoweb.org/ontology/core#Foundation","Foundation",
|
||||
"http://vivoweb.org/ontology/core#FundingOrganization","Funding Organization",
|
||||
"http://vivoweb.org/ontology/core#GovernmentAgency","Government Agency",
|
||||
"http://xmlns.com/foaf/0.1/Group","Group",
|
||||
"http://purl.org/ontology/bibo/Hearing", "Hearing",
|
||||
"http://vivoweb.org/ontology/core#Hospital","Hospital",
|
||||
"http://vivoweb.org/ontology/core#Institute","Institute",
|
||||
"http://purl.org/ontology/bibo/Interview", "Interview",
|
||||
"http://vivoweb.org/ontology/core#InvitedTalk", "Invited Talk",
|
||||
"http://vivoweb.org/ontology/core#Laboratory","Laboratory",
|
||||
"http://vivoweb.org/ontology/core#Library","Library",
|
||||
"http://purl.obolibrary.org/obo/OBI_0000835","Manufacturer",
|
||||
"http://vivoweb.org/ontology/core#Meeting", "Meeting",
|
||||
"http://vivoweb.org/ontology/core#Museum","Museum",
|
||||
"http://xmlns.com/foaf/0.1/Organization","Organization",
|
||||
"http://purl.org/ontology/bibo/Performance", "Performance",
|
||||
"http://vivoweb.org/ontology/core#Presentation", "Presentation",
|
||||
"http://vivoweb.org/ontology/core#PrivateCompany","Private Company",
|
||||
"http://vivoweb.org/ontology/core#Program","Program",
|
||||
"http://vivoweb.org/ontology/core#Publisher","Publisher",
|
||||
"http://vivoweb.org/ontology/core#ResearchOrganization","Research Organization",
|
||||
"http://vivoweb.org/ontology/core#School","School",
|
||||
"http://vivoweb.org/ontology/core#SeminarSeries", "Seminar Series",
|
||||
"http://vivoweb.org/ontology/core#Team","Team",
|
||||
"http://vivoweb.org/ontology/core#ServiceProvidingLaboratory","Service Providing Lab",
|
||||
"http://vivoweb.org/ontology/core#StudentOrganization","Student Organization",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000565","Technology Transfer Office",
|
||||
"http://vivoweb.org/ontology/core#University","University",
|
||||
"http://purl.org/ontology/bibo/Workshop", "Workshop",
|
||||
"http://vivoweb.org/ontology/core#WorkshopSeries", "Workshop Series");
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(), "",
|
||||
I18n.bundle(vreq).text("select_type"),
|
||||
"http://vivoweb.org/ontology/core#AcademicDepartment",
|
||||
"http://vivoweb.org/ontology/core#Association",
|
||||
"http://vivoweb.org/ontology/core#Center",
|
||||
"http://vivoweb.org/ontology/core#ClinicalOrganization",
|
||||
"http://vivoweb.org/ontology/core#College",
|
||||
"http://vivoweb.org/ontology/core#Committee",
|
||||
"http://vivoweb.org/ontology/core#Company",
|
||||
"http://vivoweb.org/ontology/core#Competition",
|
||||
"http://purl.org/ontology/bibo/Conference",
|
||||
"http://vivoweb.org/ontology/core#ConferenceSeries",
|
||||
"http://vivoweb.org/ontology/core#Consortium",
|
||||
"http://vivoweb.org/ontology/core#CoreLaboratory",
|
||||
"http://vivoweb.org/ontology/core#Course",
|
||||
"http://vivoweb.org/ontology/core#Department",
|
||||
"http://vivoweb.org/ontology/core#Division",
|
||||
"http://purl.org/NET/c4dm/event.owl#Event",
|
||||
"http://vivoweb.org/ontology/core#EventSeries",
|
||||
"http://vivoweb.org/ontology/core#Exhibit",
|
||||
"http://vivoweb.org/ontology/core#ExtensionUnit",
|
||||
"http://vivoweb.org/ontology/core#Foundation",
|
||||
"http://vivoweb.org/ontology/core#FundingOrganization",
|
||||
"http://vivoweb.org/ontology/core#GovernmentAgency",
|
||||
"http://xmlns.com/foaf/0.1/Group",
|
||||
"http://purl.org/ontology/bibo/Hearing",
|
||||
"http://vivoweb.org/ontology/core#Hospital",
|
||||
"http://vivoweb.org/ontology/core#Institute",
|
||||
"http://purl.org/ontology/bibo/Interview",
|
||||
"http://vivoweb.org/ontology/core#InvitedTalk",
|
||||
"http://vivoweb.org/ontology/core#Laboratory",
|
||||
"http://vivoweb.org/ontology/core#Library",
|
||||
"http://purl.obolibrary.org/obo/OBI_0000835" /* Manufacturer */,
|
||||
"http://vivoweb.org/ontology/core#Meeting",
|
||||
"http://vivoweb.org/ontology/core#Museum",
|
||||
"http://xmlns.com/foaf/0.1/Organization",
|
||||
"http://purl.org/ontology/bibo/Performance",
|
||||
"http://vivoweb.org/ontology/core#Presentation",
|
||||
"http://vivoweb.org/ontology/core#PrivateCompany",
|
||||
"http://vivoweb.org/ontology/core#Program",
|
||||
"http://vivoweb.org/ontology/core#Publisher",
|
||||
"http://vivoweb.org/ontology/core#ResearchOrganization",
|
||||
"http://vivoweb.org/ontology/core#School",
|
||||
"http://vivoweb.org/ontology/core#SeminarSeries",
|
||||
"http://vivoweb.org/ontology/core#Team",
|
||||
"http://vivoweb.org/ontology/core#ServiceProvidingLaboratory",
|
||||
"http://vivoweb.org/ontology/core#StudentOrganization",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000565" /*Technology Transfer Office*/,
|
||||
"http://vivoweb.org/ontology/core#University",
|
||||
"http://purl.org/ontology/bibo/Workshop",
|
||||
"http://vivoweb.org/ontology/core#WorkshopSeries");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,8 +29,10 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisio
|
|||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
|
||||
|
@ -624,7 +626,8 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
|
|||
|
||||
private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq) throws Exception {
|
||||
setTitleField(editConfiguration);
|
||||
setPubTypeField(editConfiguration);
|
||||
//UQAM-Linguistic-Management needs for getting appropriated value in the linguistic context
|
||||
setPubTypeField(editConfiguration, vreq);
|
||||
setPubUriField(editConfiguration);
|
||||
setCollectionLabelField(editConfiguration);
|
||||
setCollectionDisplayField(editConfiguration);
|
||||
|
@ -664,13 +667,14 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
|
|||
setRangeDatatypeUri(stringDatatypeUri));
|
||||
}
|
||||
|
||||
private void setPubTypeField(EditConfigurationVTwo editConfiguration) throws Exception {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName("pubType").
|
||||
setValidators( list("nonempty") ).
|
||||
setOptions( new ConstantFieldOptions("pubType", getPublicationTypeLiteralOptions() ))
|
||||
);
|
||||
}
|
||||
//UQAM-Linguistic-Management add vreq to get linguistic context
|
||||
private void setPubTypeField(EditConfigurationVTwo editConfiguration, VitroRequest vreq) throws Exception {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName("pubType").
|
||||
setValidators( list("nonempty") ).
|
||||
setOptions( getPublicationTypeLiteralOptions(vreq) )
|
||||
);
|
||||
}
|
||||
|
||||
private void setPubUriField(EditConfigurationVTwo editConfiguration) {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
|
@ -886,39 +890,40 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
|
|||
);
|
||||
}
|
||||
|
||||
private List<List<String>> getPublicationTypeLiteralOptions() {
|
||||
List<List<String>> literalOptions = new ArrayList<List<String>>();
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Abstract", "Abstract"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/AcademicArticle", "Academic Article"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Article", "Article"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/AudioDocument", "Audio Document"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#BlogPosting", "Blog Posting"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Book", "Book"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#CaseStudy", "Case Study"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Catalog", "Catalog"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Chapter", "Chapter"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#ConferencePaper", "Conference Paper"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#ConferencePoster", "Conference Poster"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Database", "Database"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Dataset", "Dataset"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/EditedBook", "Edited Book"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#EditorialArticle", "Editorial Article"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Film", "Film"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Newsletter", "Newsletter"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#NewsRelease", "News Release"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Patent", "Patent"));
|
||||
literalOptions.add(list("http://purl.obolibrary.org/obo/OBI_0000272", "Protocol"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Report", "Report"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#ResearchProposal", "Research Proposal"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Review", "Review"));
|
||||
literalOptions.add(list("http://purl.obolibrary.org/obo/ERO_0000071 ", "Software"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Speech", "Speech"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Thesis", "Thesis"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#Video", "Video"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Webpage", "Webpage"));
|
||||
literalOptions.add(list("http://purl.org/ontology/bibo/Website", "Website"));
|
||||
literalOptions.add(list("http://vivoweb.org/ontology/core#WorkingPaper", "Working Paper"));
|
||||
return literalOptions;
|
||||
private FieldOptions getPublicationTypeLiteralOptions(VitroRequest vreq) throws Exception {
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(), "",
|
||||
I18n.bundle(vreq).text("select_type"),
|
||||
"http://vivoweb.org/ontology/core#Abstract",
|
||||
"http://purl.org/ontology/bibo/AcademicArticle",
|
||||
"http://purl.org/ontology/bibo/Article",
|
||||
"http://purl.org/ontology/bibo/AudioDocument",
|
||||
"http://vivoweb.org/ontology/core#BlogPosting",
|
||||
"http://purl.org/ontology/bibo/Book",
|
||||
"http://vivoweb.org/ontology/core#CaseStudy",
|
||||
"http://vivoweb.org/ontology/core#Catalog",
|
||||
"http://purl.org/ontology/bibo/Chapter",
|
||||
"http://vivoweb.org/ontology/core#ConferencePaper",
|
||||
"http://vivoweb.org/ontology/core#ConferencePoster",
|
||||
"http://vivoweb.org/ontology/core#Database",
|
||||
"http://vivoweb.org/ontology/core#Dataset",
|
||||
"http://purl.org/ontology/bibo/EditedBook",
|
||||
"http://vivoweb.org/ontology/core#EditorialArticle",
|
||||
"http://purl.org/ontology/bibo/Film",
|
||||
"http://vivoweb.org/ontology/core#Newsletter",
|
||||
"http://vivoweb.org/ontology/core#NewsRelease",
|
||||
"http://purl.org/ontology/bibo/Patent",
|
||||
"http://purl.obolibrary.org/obo/OBI_0000272",
|
||||
"http://purl.org/ontology/bibo/Report",
|
||||
"http://vivoweb.org/ontology/core#ResearchProposal",
|
||||
"http://vivoweb.org/ontology/core#Review",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000071 ",
|
||||
"http://vivoweb.org/ontology/core#Speech",
|
||||
"http://purl.org/ontology/bibo/Thesis",
|
||||
"http://vivoweb.org/ontology/core#Video",
|
||||
"http://purl.org/ontology/bibo/Webpage",
|
||||
"http://purl.org/ontology/bibo/Website",
|
||||
"http://vivoweb.org/ontology/core#WorkingPaper");
|
||||
}
|
||||
|
||||
//Form specific data
|
||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class AddResearcherRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
|
@ -23,12 +24,13 @@ public class AddResearcherRoleToPersonGenerator extends AddRoleToPersonTwoStageG
|
|||
/** Researcher role involves hard-coded options for the "right side" of the role or activity. */
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return new ConstantFieldOptions(
|
||||
"", "Select one",
|
||||
"http://vivoweb.org/ontology/core#Grant", "Grant",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000015", "Human Study",
|
||||
"http://vivoweb.org/ontology/core#Project", "Project",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000014", "Research Project");
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(), "",
|
||||
I18n.bundle(vreq).text("select_type"),
|
||||
"http://vivoweb.org/ontology/core#Grant",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000015" /* Human Study" */,
|
||||
"http://vivoweb.org/ontology/core#Project",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000014" /* Research Project */);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class AddReviewerRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
|
@ -32,80 +33,80 @@ public class AddReviewerRoleToPersonGenerator extends AddRoleToPersonTwoStageGen
|
|||
* Each subclass generator will return its own type of option here:
|
||||
* whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||
*/
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return new ConstantFieldOptions(
|
||||
"", "Select type",
|
||||
"http://purl.org/ontology/bibo/AcademicArticle", "Academic Article",
|
||||
"http://purl.org/ontology/bibo/Article", "Article",
|
||||
"http://purl.org/ontology/bibo/AudioDocument", "Audio Document",
|
||||
"http://purl.org/ontology/bibo/AudioVisualDocument", "Audio-Visual Document",
|
||||
"http://purl.org/ontology/bibo/Bill", "Bill",
|
||||
"http://vivoweb.org/ontology/core#Blog", "Blog",
|
||||
"http://vivoweb.org/ontology/core#BlogPosting", "Blog Posting",
|
||||
"http://purl.org/ontology/bibo/Book", "Book",
|
||||
"http://purl.org/ontology/bibo/BookSection", "Book Section",
|
||||
"http://purl.org/ontology/bibo/Brief", "Brief",
|
||||
"http://vivoweb.org/ontology/core#CaseStudy", "Case Study",
|
||||
"http://vivoweb.org/ontology/core#Catalog", "Catalog",
|
||||
"http://purl.org/ontology/bibo/Chapter", "Chapter",
|
||||
"http://purl.org/spar/fabio/ClinicalGuideline", "Clinical Guideline",
|
||||
"http://purl.org/ontology/bibo/Code", "Code",
|
||||
"http://purl.org/ontology/bibo/CollectedDocument", "Collected Document",
|
||||
"http://purl.org/spar/fabio/Comment", "Comment",
|
||||
"http://vivoweb.org/ontology/core#ConferencePaper", "Conference Paper",
|
||||
"http://vivoweb.org/ontology/core#ConferencePoster", "Conference Poster",
|
||||
"http://purl.org/ontology/bibo/CourtReporter", "Court Reporter",
|
||||
"http://vivoweb.org/ontology/core#Database", "Database",
|
||||
"http://purl.org/ontology/bibo/LegalDecision", "Decision",
|
||||
"http://purl.org/ontology/bibo/DocumentPart", "Document Part",
|
||||
"http://purl.org/ontology/bibo/EditedBook", "Edited Book",
|
||||
"http://vivoweb.org/ontology/core#EditorialArticle", "Editorial Article",
|
||||
"http://purl.org/spar/fabio/Erratum", "Erratum",
|
||||
"http://purl.org/ontology/bibo/Excerpt", "Excerpt",
|
||||
"http://purl.org/ontology/bibo/Film", "Film",
|
||||
"http://purl.org/ontology/bibo/Image", "Image",
|
||||
"http://purl.org/ontology/bibo/Issue", "Issue",
|
||||
"http://purl.org/ontology/bibo/Journal", "Journal",
|
||||
"http://purl.obolibrary.org/obo/IAO_0000013", "Journal Article",
|
||||
"http://purl.org/ontology/bibo/LegalCaseDocument", "Legal Case Document",
|
||||
"http://purl.org/ontology/bibo/LegalDocument", "Legal Document",
|
||||
"http://purl.org/ontology/bibo/Legislation", "Legislation",
|
||||
"http://purl.org/ontology/bibo/Letter", "Letter",
|
||||
"http://purl.org/ontology/bibo/Magazine", "Magazine",
|
||||
"http://purl.org/ontology/bibo/Manual", "Manual",
|
||||
"http://purl.org/ontology/bibo/Manuscript", "Manuscript",
|
||||
"http://purl.org/ontology/bibo/Map", "Map",
|
||||
"http://vivoweb.org/ontology/core#Newsletter", "Newsletter",
|
||||
"http://purl.org/ontology/bibo/Newspaper", "Newspaper",
|
||||
"http://vivoweb.org/ontology/core#NewsRelease", "News Release",
|
||||
"http://purl.org/ontology/bibo/Note", "Note",
|
||||
"http://purl.org/ontology/bibo/Patent", "Patent",
|
||||
"http://purl.org/ontology/bibo/Periodical", "Periodical",
|
||||
"http://purl.org/ontology/bibo/PersonalCommunicationDocument", "Personal Communication Document",
|
||||
"http://purl.org/ontology/bibo/Proceedings", "Proceedings",
|
||||
"http://purl.obolibrary.org/obo/OBI_0000272", "protocol",
|
||||
"http://purl.org/ontology/bibo/Quote", "Quote",
|
||||
"http://purl.org/ontology/bibo/ReferenceSource", "Reference Source",
|
||||
"http://purl.org/ontology/bibo/Report", "Report",
|
||||
"http://vivoweb.org/ontology/core#ResearchProposal", "Research Proposal",
|
||||
"http://vivoweb.org/ontology/core#Review", "Review",
|
||||
"http://vivoweb.org/ontology/core#Score", "Score",
|
||||
"http://vivoweb.org/ontology/core#Screenplay", "Screenplay",
|
||||
"http://purl.org/ontology/bibo/Series", "Series",
|
||||
"http://purl.org/ontology/bibo/Slide", "Slide",
|
||||
"http://purl.org/ontology/bibo/Slideshow", "Slideshow",
|
||||
"http://vivoweb.org/ontology/core#Speech", "Speech",
|
||||
"http://purl.org/ontology/bibo/Standard", "Standard",
|
||||
"http://purl.org/ontology/bibo/Statute", "Statute",
|
||||
"http://purl.org/ontology/bibo/Thesis", "Thesis",
|
||||
"http://vivoweb.org/ontology/core#Translation", "Translation",
|
||||
"http://vivoweb.org/ontology/core#Video", "Video",
|
||||
"http://purl.org/ontology/bibo/Webpage", "Webpage",
|
||||
"http://purl.org/ontology/bibo/Website", "Website",
|
||||
"http://vivoweb.org/ontology/core#WorkingPaper", "Working Paper"
|
||||
);
|
||||
}
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(), "",
|
||||
I18n.bundle(vreq).text("select_type"),
|
||||
"http://purl.org/ontology/bibo/AcademicArticle",
|
||||
"http://purl.org/ontology/bibo/Article",
|
||||
"http://purl.org/ontology/bibo/AudioDocument",
|
||||
"http://purl.org/ontology/bibo/AudioVisualDocument",
|
||||
"http://purl.org/ontology/bibo/Bill",
|
||||
"http://vivoweb.org/ontology/core#Blog",
|
||||
"http://vivoweb.org/ontology/core#BlogPosting",
|
||||
"http://purl.org/ontology/bibo/Book",
|
||||
"http://purl.org/ontology/bibo/BookSection",
|
||||
"http://purl.org/ontology/bibo/Brief",
|
||||
"http://vivoweb.org/ontology/core#CaseStudy",
|
||||
"http://vivoweb.org/ontology/core#Catalog",
|
||||
"http://purl.org/ontology/bibo/Chapter",
|
||||
"http://purl.org/spar/fabio/ClinicalGuideline",
|
||||
"http://purl.org/ontology/bibo/Code",
|
||||
"http://purl.org/ontology/bibo/CollectedDocument",
|
||||
"http://purl.org/spar/fabio/Comment",
|
||||
"http://vivoweb.org/ontology/core#ConferencePaper",
|
||||
"http://vivoweb.org/ontology/core#ConferencePoster",
|
||||
"http://purl.org/ontology/bibo/CourtReporter",
|
||||
"http://vivoweb.org/ontology/core#Database",
|
||||
"http://purl.org/ontology/bibo/LegalDecision",
|
||||
"http://purl.org/ontology/bibo/DocumentPart",
|
||||
"http://purl.org/ontology/bibo/EditedBook",
|
||||
"http://vivoweb.org/ontology/core#EditorialArticle",
|
||||
"http://purl.org/spar/fabio/Erratum",
|
||||
"http://purl.org/ontology/bibo/Excerpt",
|
||||
"http://purl.org/ontology/bibo/Film",
|
||||
"http://purl.org/ontology/bibo/Image",
|
||||
"http://purl.org/ontology/bibo/Issue",
|
||||
"http://purl.org/ontology/bibo/Journal",
|
||||
"http://purl.obolibrary.org/obo/IAO_0000013" /* "Journal Article" */,
|
||||
"http://purl.org/ontology/bibo/LegalCaseDocument",
|
||||
"http://purl.org/ontology/bibo/LegalDocument",
|
||||
"http://purl.org/ontology/bibo/Legislation",
|
||||
"http://purl.org/ontology/bibo/Letter",
|
||||
"http://purl.org/ontology/bibo/Magazine",
|
||||
"http://purl.org/ontology/bibo/Manual",
|
||||
"http://purl.org/ontology/bibo/Manuscript",
|
||||
"http://purl.org/ontology/bibo/Map",
|
||||
"http://vivoweb.org/ontology/core#Newsletter",
|
||||
"http://purl.org/ontology/bibo/Newspaper",
|
||||
"http://vivoweb.org/ontology/core#NewsRelease",
|
||||
"http://purl.org/ontology/bibo/Note",
|
||||
"http://purl.org/ontology/bibo/Patent",
|
||||
"http://purl.org/ontology/bibo/Periodical",
|
||||
"http://purl.org/ontology/bibo/PersonalCommunicationDocument",
|
||||
"http://purl.org/ontology/bibo/Proceedings",
|
||||
"http://purl.obolibrary.org/obo/OBI_0000272" /* Protocol" */,
|
||||
"http://purl.org/ontology/bibo/Quote",
|
||||
"http://purl.org/ontology/bibo/ReferenceSource",
|
||||
"http://purl.org/ontology/bibo/Report",
|
||||
"http://vivoweb.org/ontology/core#ResearchProposal",
|
||||
"http://vivoweb.org/ontology/core#Review",
|
||||
"http://vivoweb.org/ontology/core#Score",
|
||||
"http://vivoweb.org/ontology/core#Screenplay",
|
||||
"http://purl.org/ontology/bibo/Series",
|
||||
"http://purl.org/ontology/bibo/Slide",
|
||||
"http://purl.org/ontology/bibo/Slideshow",
|
||||
"http://vivoweb.org/ontology/core#Speech",
|
||||
"http://purl.org/ontology/bibo/Standard",
|
||||
"http://purl.org/ontology/bibo/Statute",
|
||||
"http://purl.org/ontology/bibo/Thesis",
|
||||
"http://vivoweb.org/ontology/core#Translation",
|
||||
"http://vivoweb.org/ontology/core#Video",
|
||||
"http://purl.org/ontology/bibo/Webpage",
|
||||
"http://purl.org/ontology/bibo/Website",
|
||||
"http://vivoweb.org/ontology/core#WorkingPaper");
|
||||
}
|
||||
|
||||
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||
public boolean isShowRoleLabelField() {
|
||||
|
|
|
@ -415,7 +415,7 @@ public abstract class AddRoleToPersonTwoStageGenerator extends BaseEditConfigura
|
|||
|
||||
//make list of type URIs from options, this can be called with null since
|
||||
//ConstantFieldOptions doesn't use any of the arguments.
|
||||
Map<String,String> options = fieldOptions.getOptions(null, null, null) ;
|
||||
Map<String,String> options = fieldOptions.getOptions(null, null, null, null) ;
|
||||
|
||||
if (options != null && options.size() > 0) {
|
||||
List<String> typeUris = new ArrayList<String>();
|
||||
|
|
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class AddServiceProviderRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||
|
||||
|
@ -17,63 +18,63 @@ public class AddServiceProviderRoleToPersonGenerator extends AddRoleToPersonTwoS
|
|||
String getRoleType() {
|
||||
return "http://purl.obolibrary.org/obo/ERO_0000012";
|
||||
}
|
||||
|
||||
/** Service Provider role involves hard-coded options for the
|
||||
* "right side" of the role or activity. */
|
||||
|
||||
@Override
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return new ConstantFieldOptions(
|
||||
"","Select type",
|
||||
"http://vivoweb.org/ontology/core#AcademicDepartment","Academic Department",
|
||||
"http://vivoweb.org/ontology/core#Association","Association",
|
||||
"http://vivoweb.org/ontology/core#Center","Center",
|
||||
"http://vivoweb.org/ontology/core#ClinicalOrganization","Clinical Organization",
|
||||
"http://vivoweb.org/ontology/core#College","College",
|
||||
"http://vivoweb.org/ontology/core#Committee","Committee",
|
||||
"http://vivoweb.org/ontology/core#Company","Company",
|
||||
"http://vivoweb.org/ontology/core#Competition", "Competition",
|
||||
"http://purl.org/ontology/bibo/Conference", "Conference",
|
||||
"http://vivoweb.org/ontology/core#ConferenceSeries", "Conference Series",
|
||||
"http://vivoweb.org/ontology/core#Consortium","Consortium",
|
||||
"http://vivoweb.org/ontology/core#CoreLaboratory","Core Laboratory",
|
||||
"http://vivoweb.org/ontology/core#Course", "Course",
|
||||
"http://vivoweb.org/ontology/core#Department","Department",
|
||||
"http://vivoweb.org/ontology/core#Division","Division",
|
||||
"http://purl.org/NET/c4dm/event.owl#Event","Event",
|
||||
"http://vivoweb.org/ontology/core#EventSeries", "Event Series",
|
||||
"http://vivoweb.org/ontology/core#Exhibit", "Exhibit",
|
||||
"http://vivoweb.org/ontology/core#ExtensionUnit","Extension Unit",
|
||||
"http://vivoweb.org/ontology/core#Foundation","Foundation",
|
||||
"http://vivoweb.org/ontology/core#FundingOrganization","Funding Organization",
|
||||
"http://vivoweb.org/ontology/core#GovernmentAgency","Government Agency",
|
||||
"http://xmlns.com/foaf/0.1/Group","Group",
|
||||
"http://purl.org/ontology/bibo/Hearing", "Hearing",
|
||||
"http://vivoweb.org/ontology/core#Hospital","Hospital",
|
||||
"http://vivoweb.org/ontology/core#Institute","Institute",
|
||||
"http://purl.org/ontology/bibo/Interview", "Interview",
|
||||
"http://vivoweb.org/ontology/core#InvitedTalk", "Invited Talk",
|
||||
"http://vivoweb.org/ontology/core#Laboratory","Laboratory",
|
||||
"http://vivoweb.org/ontology/core#Library","Library",
|
||||
"http://purl.obolibrary.org/obo/OBI_0000835","Manufacturer",
|
||||
"http://vivoweb.org/ontology/core#Meeting", "Meeting",
|
||||
"http://vivoweb.org/ontology/core#Museum","Museum",
|
||||
"http://xmlns.com/foaf/0.1/Organization","Organization",
|
||||
"http://purl.org/ontology/bibo/Performance", "Performance",
|
||||
"http://vivoweb.org/ontology/core#Presentation", "Presentation",
|
||||
"http://vivoweb.org/ontology/core#PrivateCompany","Private Company",
|
||||
"http://vivoweb.org/ontology/core#Program","Program",
|
||||
"http://vivoweb.org/ontology/core#Publisher","Publisher",
|
||||
"http://vivoweb.org/ontology/core#ResearchOrganization","Research Organization",
|
||||
"http://vivoweb.org/ontology/core#School","School",
|
||||
"http://vivoweb.org/ontology/core#SeminarSeries", "Seminar Series",
|
||||
"http://vivoweb.org/ontology/core#Team","Team",
|
||||
"http://vivoweb.org/ontology/core#ServiceProvidingLaboratory","Service Providing Lab",
|
||||
"http://vivoweb.org/ontology/core#StudentOrganization","Student Organization",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000565","Technology Transfer Office",
|
||||
"http://vivoweb.org/ontology/core#University","University",
|
||||
"http://purl.org/ontology/bibo/Workshop", "Workshop",
|
||||
"http://vivoweb.org/ontology/core#WorkshopSeries", "Workshop Series");
|
||||
}
|
||||
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
|
||||
return GeneratorUtil.buildResourceAndLabelFieldOptions(
|
||||
vreq.getRDFService(), vreq.getWebappDaoFactory(), "",
|
||||
I18n.bundle(vreq).text("select_type"),
|
||||
"","Select type",
|
||||
"http://vivoweb.org/ontology/core#AcademicDepartment",
|
||||
"http://vivoweb.org/ontology/core#Association",
|
||||
"http://vivoweb.org/ontology/core#Center",
|
||||
"http://vivoweb.org/ontology/core#ClinicalOrganization",
|
||||
"http://vivoweb.org/ontology/core#College",
|
||||
"http://vivoweb.org/ontology/core#Committee",
|
||||
"http://vivoweb.org/ontology/core#Company",
|
||||
"http://vivoweb.org/ontology/core#Competition",
|
||||
"http://purl.org/ontology/bibo/Conference",
|
||||
"http://vivoweb.org/ontology/core#ConferenceSeries",
|
||||
"http://vivoweb.org/ontology/core#Consortium",
|
||||
"http://vivoweb.org/ontology/core#CoreLaboratory",
|
||||
"http://vivoweb.org/ontology/core#Course",
|
||||
"http://vivoweb.org/ontology/core#Department",
|
||||
"http://vivoweb.org/ontology/core#Division",
|
||||
"http://purl.org/NET/c4dm/event.owl#Event",
|
||||
"http://vivoweb.org/ontology/core#EventSeries",
|
||||
"http://vivoweb.org/ontology/core#Exhibit",
|
||||
"http://vivoweb.org/ontology/core#ExtensionUnit",
|
||||
"http://vivoweb.org/ontology/core#Foundation",
|
||||
"http://vivoweb.org/ontology/core#FundingOrganization",
|
||||
"http://vivoweb.org/ontology/core#GovernmentAgency",
|
||||
"http://xmlns.com/foaf/0.1/Group",
|
||||
"http://purl.org/ontology/bibo/Hearing",
|
||||
"http://vivoweb.org/ontology/core#Hospital",
|
||||
"http://vivoweb.org/ontology/core#Institute",
|
||||
"http://purl.org/ontology/bibo/Interview",
|
||||
"http://vivoweb.org/ontology/core#InvitedTalk",
|
||||
"http://vivoweb.org/ontology/core#Laboratory",
|
||||
"http://vivoweb.org/ontology/core#Library",
|
||||
"http://purl.obolibrary.org/obo/OBI_0000835" /* Manufacturer */,
|
||||
"http://vivoweb.org/ontology/core#Meeting",
|
||||
"http://vivoweb.org/ontology/core#Museum",
|
||||
"http://xmlns.com/foaf/0.1/Organization",
|
||||
"http://purl.org/ontology/bibo/Performance",
|
||||
"http://vivoweb.org/ontology/core#Presentation",
|
||||
"http://vivoweb.org/ontology/core#PrivateCompany",
|
||||
"http://vivoweb.org/ontology/core#Program",
|
||||
"http://vivoweb.org/ontology/core#Publisher",
|
||||
"http://vivoweb.org/ontology/core#ResearchOrganization",
|
||||
"http://vivoweb.org/ontology/core#School",
|
||||
"http://vivoweb.org/ontology/core#SeminarSeries",
|
||||
"http://vivoweb.org/ontology/core#Team",
|
||||
"http://vivoweb.org/ontology/core#ServiceProvidingLaboratory",
|
||||
"http://vivoweb.org/ontology/core#StudentOrganization",
|
||||
"http://purl.obolibrary.org/obo/ERO_0000565" /* Technology Transfer Office" */,
|
||||
"http://vivoweb.org/ontology/core#University",
|
||||
"http://purl.org/ontology/bibo/Workshop",
|
||||
"http://vivoweb.org/ontology/core#WorkshopSeries");
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isShowRoleLabelField(){return true;}
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.jena.iri.IRI;
|
||||
import org.apache.jena.iri.IRIFactory;
|
||||
import org.apache.jena.query.QuerySolution;
|
||||
import org.apache.jena.vocabulary.RDFS;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.ResultSetConsumer;
|
||||
|
||||
public class GeneratorUtil {
|
||||
|
||||
private static final Log log = LogFactory.getLog(GeneratorUtil.class);
|
||||
|
||||
/**
|
||||
* Build a field options list of resource URIs paired with their labels as
|
||||
* retrieved from the supplied RDFService.
|
||||
*
|
||||
* @param rdfService from which to retrieve labels: this should typically
|
||||
* be a LanguageFilteringRDFService.
|
||||
*
|
||||
* @param webappDaoFactory may be null. If non-null, labels for classes will be
|
||||
* returned from here first before consulting
|
||||
* rdfService.
|
||||
*
|
||||
* @param headerValue optional value for first value/label pair in the
|
||||
* options list before appending the URIs with their
|
||||
* labels. May be null. Example: empty string
|
||||
*
|
||||
* @param headerLabel optional label for first value/label pair in the
|
||||
* options list before appending the URIs with their
|
||||
* labels. May be null. Example: "Select type"
|
||||
*
|
||||
* @param resourceURIs variable list of resource URI strings
|
||||
*
|
||||
* @return empty ConstantFieldOptions list if resourceURIs is null or empty or
|
||||
* if rdfService is null
|
||||
* @throws RDFServiceException from the supplied rdfService
|
||||
* @throws Exception from ConstantFieldOptions constructor
|
||||
*/
|
||||
public static ConstantFieldOptions buildResourceAndLabelFieldOptions(
|
||||
RDFService rdfService, WebappDaoFactory webappDaoFactory, String headerValue,
|
||||
String headerLabel, String ... resourceURIs) throws Exception {
|
||||
if(resourceURIs == null || resourceURIs.length == 0 || rdfService == null) {
|
||||
return new ConstantFieldOptions();
|
||||
}
|
||||
List<String> options = new ArrayList<String>();
|
||||
if(headerValue != null && headerLabel != null) {
|
||||
options.add(headerValue);
|
||||
options.add(headerLabel);
|
||||
}
|
||||
IRIFactory iriFactory = IRIFactory.iriImplementation();
|
||||
for(String resourceURI : resourceURIs) {
|
||||
IRI iri = iriFactory.create(resourceURI);
|
||||
if(iri.hasViolation(false)) {
|
||||
log.warn("Not adding invalid URI " + resourceURI
|
||||
+ " to field options list");
|
||||
} else {
|
||||
String label = getLabel(iri, rdfService, webappDaoFactory);
|
||||
if(!StringUtils.isEmpty(label)) {
|
||||
options.add(iri.toString());
|
||||
options.add(label);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ConstantFieldOptions(options.toArray(
|
||||
new String[options.size()]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve label for iri from webappDaoFactory if available and iri is
|
||||
* for a VClass, otherwise retrieve lowest-sorting rdfs:label for iri from
|
||||
* rdfService
|
||||
* @param iri may not be null
|
||||
* @param rdfService may not be null
|
||||
*/
|
||||
private static String getLabel(IRI iri, RDFService rdfService,
|
||||
WebappDaoFactory webappDaoFactory) throws RDFServiceException {
|
||||
// Try the WebappDaoFactory for class labels that exist only in
|
||||
// "everytime" and do not show up in the RDFService.
|
||||
if(webappDaoFactory != null) {
|
||||
VClass vclass = webappDaoFactory.getVClassDao().getVClassByURI(
|
||||
iri.toString());
|
||||
if(vclass != null) {
|
||||
return vclass.getLabel();
|
||||
}
|
||||
}
|
||||
StringBuilder select = new StringBuilder("SELECT ?label WHERE { \n");
|
||||
select.append(" <" + iri + "> <" + RDFS.label.getURI() + "> ?label \n");
|
||||
select.append("} ORDER BY ?label");
|
||||
LabelConsumer labelConsumer = new LabelConsumer();
|
||||
rdfService.sparqlSelectQuery(select.toString(), labelConsumer);
|
||||
return labelConsumer.getLabel();
|
||||
}
|
||||
|
||||
private static class LabelConsumer extends ResultSetConsumer {
|
||||
|
||||
private String label;
|
||||
|
||||
@Override
|
||||
protected void processQuerySolution(QuerySolution qsoln) {
|
||||
if(label != null) {
|
||||
return;
|
||||
// keep only the first value returned in the result set
|
||||
}
|
||||
if(qsoln.contains("label") && qsoln.get("label").isLiteral()) {
|
||||
label = qsoln.getLiteral("label").getLexicalForm();
|
||||
}
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -19,6 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
|||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class GrantHasContributorGenerator extends VivoBaseGenerator implements EditConfigurationGenerator{
|
||||
|
||||
|
@ -92,7 +93,7 @@ public class GrantHasContributorGenerator extends VivoBaseGenerator implements
|
|||
|
||||
//Add validator
|
||||
conf.addValidator(new AntiXssValidation());
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingPerson"));
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingPerson", I18n.bundle(vreq)));
|
||||
|
||||
//Adding additional data, specifically edit mode
|
||||
addFormSpecificData(conf, vreq);
|
||||
|
|
|
@ -267,6 +267,19 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
|
|||
config.addFormSpecificData("selectLocale",availableLocalesForAdd);
|
||||
config.addFormSpecificData("displayRemoveLink", (numberExistingLabels > 1));
|
||||
|
||||
// get current selected locale
|
||||
String rangeLang = vreq.getLocale().getLanguage();
|
||||
if (!vreq.getLocale().getCountry().isEmpty()) {
|
||||
rangeLang += "-" + vreq.getLocale().getCountry();
|
||||
}
|
||||
|
||||
// check if locale already has an entry (label)
|
||||
boolean localeEntryExisting = true;
|
||||
for (HashMap<String, String> tmp : availableLocalesForAdd) {
|
||||
if (tmp.get("code").equals(rangeLang)) localeEntryExisting = false;
|
||||
}
|
||||
config.addFormSpecificData("localeEntryExisting", localeEntryExisting);
|
||||
config.addFormSpecificData("currentSelectedLocale", rangeLang);
|
||||
|
||||
//How do we edit? Will need to see
|
||||
config.addFormSpecificData("deleteWebpageUrl", "/edit/primitiveDelete");
|
||||
|
|
|
@ -3,20 +3,20 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.jena.query.QueryExecution;
|
||||
import org.apache.jena.query.QueryExecutionFactory;
|
||||
import org.apache.jena.rdf.model.Model;
|
||||
import org.apache.jena.rdf.model.ModelFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.apache.jena.query.ParameterizedSparqlString;
|
||||
import org.apache.jena.query.QueryExecution;
|
||||
import org.apache.jena.query.QueryExecutionFactory;
|
||||
import org.apache.jena.query.QuerySolution;
|
||||
import org.apache.jena.query.ResultSet;
|
||||
import org.apache.jena.rdf.model.Model;
|
||||
import org.apache.jena.rdf.model.ModelFactory;
|
||||
import org.apache.jena.rdf.model.RDFNode;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
|
@ -26,6 +26,8 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMa
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.selection.SelectedLocale;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
|
||||
/**
|
||||
* This is an odd controller that is just drawing a page with links on it.
|
||||
|
@ -153,16 +155,36 @@ public class ManageWebpagesForIndividualGenerator extends BaseEditConfigurationG
|
|||
+ "PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> \n"
|
||||
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
|
||||
+ "PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> \n"
|
||||
+ "SELECT DISTINCT ?vcard ?link ?url ?rank ?typeLabel (group_concat(distinct ?linkLabel;separator=\"/\") as ?label) WHERE { \n"
|
||||
+ "SELECT DISTINCT ?vcard ?link ?url (MIN(?rank_) AS ?rank) \n"
|
||||
+ "(MIN(?typeLabel_) AS ?typeLabel) \n"
|
||||
+ "(group_concat(distinct ?linkLabel;separator=\"/\") as ?label) WHERE { \n"
|
||||
+ " ?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?vcard . \n"
|
||||
+ " ?vcard vcard:hasURL ?link . \n"
|
||||
+ " ?link a vcard:URL \n"
|
||||
+ " OPTIONAL { ?link vcard:url ?url } \n"
|
||||
+ " OPTIONAL { ?link rdfs:label ?linkLabel } \n"
|
||||
+ " OPTIONAL { ?link core:rank ?rank } \n"
|
||||
+ " OPTIONAL { ?link core:rank ?rank_ } \n"
|
||||
+ " OPTIONAL { ?link vitro:mostSpecificType ?type } \n"
|
||||
+ " OPTIONAL { ?type rdfs:label ?typeLabel } \n"
|
||||
+ "} GROUP BY ?rank ?vcard ?link ?url ?typeLabel \n"
|
||||
// UQAM-Linguistic-Management Add linguistic control on label
|
||||
// Try full locale
|
||||
+ " OPTIONAL { ?type rdfs:label ?typeLabelPrimary . \n"
|
||||
+ " FILTER (LANG(?typeLabelPrimary) = ?locale) \n"
|
||||
+ " } \n"
|
||||
// Try language only
|
||||
+ " OPTIONAL { ?type rdfs:label ?typeLabelSecondary . \n"
|
||||
+ " FILTER (LANG(?typeLabelSecondary) = ?language) \n"
|
||||
+ " } \n"
|
||||
// Try the same language in another other locale
|
||||
+ " OPTIONAL { ?type rdfs:label ?typeLabelTertiary . \n"
|
||||
+ " FILTER (STRBEFORE(STR(LANG(?typeLabelTertiary)), \"-\") = ?language) \n"
|
||||
+ " } \n"
|
||||
// Try any other available label
|
||||
+ " OPTIONAL { ?type rdfs:label ?typeLabelFallback . \n"
|
||||
+ " FILTER (LANG(?typeLabelFallback) != ?locale \n"
|
||||
+ " && LANG(?typeLabelFallback) != ?language) \n"
|
||||
+ " } \n"
|
||||
+ " BIND(COALESCE(?typeLabelPrimary, ?typeLabelSecondary, ?typeLabelTertiary, ?typeLabelFallback) AS ?typeLabel_) \n"
|
||||
+ "} GROUP BY ?vcard ?link ?url \n"
|
||||
+ " ORDER BY ?rank";
|
||||
|
||||
|
||||
|
@ -175,8 +197,10 @@ public class ManageWebpagesForIndividualGenerator extends BaseEditConfigurationG
|
|||
|
||||
Model constructedModel = ModelFactory.createDefaultModel();
|
||||
rdfService.sparqlConstructQuery(constructStr, constructedModel);
|
||||
|
||||
String queryStr = QueryUtils.subUriForQueryVar(this.getQuery(), "subject", subjectUri);
|
||||
/*
|
||||
* UQAM-Linguistic-Management Adjust the getQuery signature for managing the linguistic context
|
||||
*/
|
||||
String queryStr = QueryUtils.subUriForQueryVar(this.getQuery(vreq), "subject", subjectUri);
|
||||
log.debug("Query string is: " + queryStr);
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(queryStr, constructedModel);
|
||||
|
@ -205,8 +229,16 @@ public class ManageWebpagesForIndividualGenerator extends BaseEditConfigurationG
|
|||
return AddEditWebpageFormGenerator.class.getName();
|
||||
}
|
||||
|
||||
protected String getQuery() {
|
||||
return WEBPAGE_QUERY;
|
||||
protected String getQuery(VitroRequest vreq) {
|
||||
/*
|
||||
* UQAM-Linguistic-Management Adjust the query to the linguistic context
|
||||
*/
|
||||
Locale locale = SelectedLocale.getCurrentLocale(vreq);
|
||||
ParameterizedSparqlString queryPstr = new ParameterizedSparqlString(
|
||||
WEBPAGE_QUERY);
|
||||
queryPstr.setLiteral("locale", locale.toString().replace("_", "-"));
|
||||
queryPstr.setLiteral("language", locale.getLanguage());
|
||||
return queryPstr.toString();
|
||||
}
|
||||
|
||||
protected String getTemplate() {
|
||||
|
|
|
@ -22,6 +22,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsVi
|
|||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class OrganizationForTrainingGenerator extends VivoBaseGenerator implements EditConfigurationGenerator{
|
||||
|
||||
|
@ -166,7 +167,7 @@ public class OrganizationForTrainingGenerator extends VivoBaseGenerator impleme
|
|||
//Add validator
|
||||
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField"));
|
||||
conf.addValidator(new AntiXssValidation());
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingPerson"));
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingPerson", I18n.bundle(vreq)));
|
||||
|
||||
//Adding additional data, specifically edit mode
|
||||
addFormSpecificData(conf, vreq);
|
||||
|
|
|
@ -17,6 +17,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisio
|
|||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesWithParent;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
|
||||
implements EditConfigurationGenerator {
|
||||
|
@ -256,7 +257,7 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
|
|||
conf.addField(endField.setEditElement(new DateTimeWithPrecisionVTwo(
|
||||
endField, URI_PRECISION_YEAR, URI_PRECISION_NONE)));
|
||||
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingPerson"));
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingPerson", I18n.bundle(vreq)));
|
||||
conf.addValidator(new AntiXssValidation());
|
||||
conf.addValidator(new DateTimeIntervalValidationVTwo("startField",
|
||||
"endField"));
|
||||
|
|
|
@ -20,6 +20,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClasses
|
|||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaVClassOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class PersonHasAdviseeRelationshipGenerator extends VivoBaseGenerator implements
|
||||
EditConfigurationGenerator {
|
||||
|
@ -184,7 +185,7 @@ public class PersonHasAdviseeRelationshipGenerator extends VivoBaseGenerator imp
|
|||
|
||||
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField"));
|
||||
conf.addValidator(new AntiXssValidation());
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingAdvisor"));
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingAdvisor", I18n.bundle(vreq)));
|
||||
addFormSpecificData(conf, vreq);
|
||||
|
||||
prepare(vreq, conf);
|
||||
|
|
|
@ -20,6 +20,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClasses
|
|||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaVClassOptions;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator implements
|
||||
EditConfigurationGenerator {
|
||||
|
@ -184,7 +185,7 @@ public class PersonHasAdvisorRelationshipGenerator extends VivoBaseGenerator imp
|
|||
|
||||
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField"));
|
||||
conf.addValidator(new AntiXssValidation());
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingAdvisee"));
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingAdvisee", I18n.bundle(vreq)));
|
||||
addFormSpecificData(conf, vreq);
|
||||
|
||||
prepare(vreq, conf);
|
||||
|
|
|
@ -17,6 +17,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
|||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
||||
public class ProjectHasParticipantGenerator extends VivoBaseGenerator implements EditConfigurationGenerator{
|
||||
|
||||
|
@ -92,7 +93,7 @@ public class ProjectHasParticipantGenerator extends VivoBaseGenerator implement
|
|||
|
||||
//Add validator
|
||||
conf.addValidator(new AntiXssValidation());
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingPerson"));
|
||||
conf.addValidator(new FirstAndLastNameValidator("existingPerson", I18n.bundle(vreq)));
|
||||
|
||||
//Adding additional data, specifically edit mode
|
||||
addFormSpecificData(conf, vreq);
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.utilities;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.jena.ontology.OntModel;
|
||||
import org.apache.jena.rdf.model.ModelFactory;
|
||||
import org.apache.jena.rdf.model.RDFNode;
|
||||
import org.apache.jena.rdf.model.ResourceFactory;
|
||||
import org.apache.jena.rdf.model.Statement;
|
||||
import org.apache.jena.rdf.model.StmtIterator;
|
||||
import org.apache.jena.vocabulary.RDFS;
|
||||
|
||||
|
||||
public class Describe {
|
||||
private static final Log log = LogFactory.getLog(Describe.class.getName());
|
||||
|
||||
public static void main(String[] args) {
|
||||
OntModel model = ModelFactory.createOntologyModel();
|
||||
model.read("C:\\VIVO-Trad-ecosysteme\\vivo\\home\\rdf\\applicationMetadata\\firsttime\\classgroups_fr_CA.rdf") ;
|
||||
model.read("C:\\VIVO-Trad-ecosysteme\\vivo\\home\\rdf\\applicationMetadata\\firsttime\\classgroups.rdf") ;
|
||||
Describe.showVitroClassGroupequipmentLabels(model,"test");
|
||||
System.out.println("Done!");
|
||||
}
|
||||
|
||||
private static void showVitroClassGroupequipmentLabels(OntModel model, String message) {
|
||||
String uri = "http://vivoweb.org/ontology#vitroClassGroupequipment";
|
||||
List<Statement> stmts = model.listStatements(ResourceFactory.createResource(uri), RDFS.label, (RDFNode)null).toList();
|
||||
for (Iterator iterator = stmts.iterator(); iterator.hasNext();) {
|
||||
Statement statement = (Statement) iterator.next();
|
||||
log.debug("\t\t"+message + " " +statement);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -54,10 +54,16 @@ public class CapabilityMapRequestHandler implements VisualizationRequestHandler
|
|||
|
||||
@Override
|
||||
public Object generateAjaxVisualization(VitroRequest vitroRequest, Log log, Dataset dataSource) throws MalformedQueryParametersException, JsonProcessingException {
|
||||
ConceptLabelMap conceptLabelMap = VisualizationCaches.conceptToLabel.getNoWait(vitroRequest.getRDFService());
|
||||
ConceptPeopleMap conceptPeopleMap = VisualizationCaches.conceptToPeopleMap.getNoWait(vitroRequest.getRDFService());
|
||||
OrganizationPeopleMap organizationPeopleMap = VisualizationCaches.organisationToPeopleMap.getNoWait(vitroRequest.getRDFService());
|
||||
Map<String, String> organizationLabels = VisualizationCaches.organizationLabels.getNoWait(vitroRequest.getRDFService());
|
||||
RDFService rdfService = vitroRequest.getRDFService();
|
||||
rdfService.setVitroRequest(vitroRequest);
|
||||
// VisualizationCaches.rebuildAll(rdfService);
|
||||
// VisualizationCaches.conceptToLabel.build(rdfService);
|
||||
// ConceptLabelMap conceptLabelMap = VisualizationCaches.conceptToLabel.getNoWait(rdfService);
|
||||
// UQAM-Bug-Correction Refresh all memory models with appropriate liguistic labels
|
||||
ConceptLabelMap conceptLabelMap = VisualizationCaches.conceptToLabel.get(rdfService, true, true);
|
||||
ConceptPeopleMap conceptPeopleMap = VisualizationCaches.conceptToPeopleMap.getNoWait(rdfService);
|
||||
OrganizationPeopleMap organizationPeopleMap = VisualizationCaches.organisationToPeopleMap.getNoWait(rdfService);
|
||||
Map<String, String> organizationLabels = VisualizationCaches.organizationLabels.getNoWait(rdfService);
|
||||
|
||||
String data = vitroRequest.getParameter("data");
|
||||
if (!StringUtils.isEmpty(data)) {
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.utilities;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.threads.VitroBackgroundThread;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.model.ConceptLabelMap;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -85,7 +87,69 @@ public class CachingRDFServiceExecutor<T> {
|
|||
if (backgroundTask != null && backgroundTask.isDone()) {
|
||||
completeBackgroundTask();
|
||||
}
|
||||
// If we have cached results
|
||||
if (cachedResults != null) {
|
||||
// If the background service exists, and the cache is considered invalid
|
||||
|
||||
if (backgroundRDFService != null && resultBuilder.invalidateCache(System.currentTimeMillis() - lastCacheTime)) {
|
||||
// In most cases, only wait for half a second
|
||||
long waitFor = 500;
|
||||
|
||||
if (backgroundTask == null) {
|
||||
// Start the background task to refresh the cache
|
||||
startBackgroundTask(backgroundRDFService);
|
||||
|
||||
// As we've just started the background task, allow a wait time of 1 second
|
||||
waitFor = 1000;
|
||||
}
|
||||
|
||||
// See if we expect it to complete in time, and if so, wait for it
|
||||
if (allowWaits && isExpectedToCompleteIn(waitFor)) {
|
||||
completeBackgroundTask(waitFor);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// No cached results, so fetch the results using any available RDF service
|
||||
if (rdfService != null) {
|
||||
startBackgroundTask(rdfService);
|
||||
} else if (backgroundRDFService != null) {
|
||||
startBackgroundTask(backgroundRDFService);
|
||||
} else {
|
||||
throw new RuntimeException("Can't execute without an RDF Service");
|
||||
}
|
||||
|
||||
// As there are no cached results, wait for an answer regardless of the RDF service used
|
||||
completeBackgroundTask();
|
||||
}
|
||||
return cachedResults;
|
||||
}
|
||||
|
||||
public synchronized T get(RDFService rdfService, boolean allowWaits, boolean force) {
|
||||
/*
|
||||
* UQAM-Bug-Correction
|
||||
* Forces the regeneration of the result
|
||||
*/
|
||||
if (force) {
|
||||
try {
|
||||
String backLang = backgroundRDFService.getVitroRequest().getLocale().getLanguage();
|
||||
String srvLang = rdfService.getVitroRequest().getLocale().getLanguage();
|
||||
if (!backLang.equals(srvLang)) {
|
||||
backgroundRDFService.setVitroRequest(rdfService.getVitroRequest());
|
||||
startBackgroundTask(rdfService);
|
||||
completeBackgroundTask();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
backgroundRDFService.setVitroRequest(rdfService.getVitroRequest());
|
||||
startBackgroundTask(rdfService);
|
||||
completeBackgroundTask();
|
||||
}
|
||||
return cachedResults;
|
||||
}
|
||||
// First, check if there are results from the previous background task, and update the cache
|
||||
if (backgroundTask != null && backgroundTask.isDone()) {
|
||||
completeBackgroundTask();
|
||||
}
|
||||
// If we have cached results
|
||||
if (cachedResults != null) {
|
||||
// If the background service exists, and the cache is considered invalid
|
||||
|
|
|
@ -9,6 +9,8 @@ import org.apache.jena.rdf.model.Literal;
|
|||
import org.apache.jena.rdf.model.Model;
|
||||
import org.apache.jena.rdf.model.ModelFactory;
|
||||
import org.apache.jena.rdf.model.Resource;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.ResultSetConsumer;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
||||
|
@ -232,13 +234,37 @@ final public class VisualizationCaches {
|
|||
new CachingRDFServiceExecutor.RDFServiceCallable<Map<String, String>>(visualizationAffinity) {
|
||||
@Override
|
||||
protected Map<String, String> callWithService(RDFService rdfService) throws Exception {
|
||||
// get current selected language tag
|
||||
VitroRequest vreq = rdfService.getVitroRequest();
|
||||
String langCtx = "en-US"; // set default
|
||||
String language = "en"; // set fallback language
|
||||
try {
|
||||
langCtx = language = vreq.getLocale().getLanguage();
|
||||
if (!vreq.getLocale().getCountry().isEmpty()) {
|
||||
langCtx += "-" + vreq.getLocale().getCountry();
|
||||
}
|
||||
} catch (Exception e) { }
|
||||
|
||||
String query = QueryConstants.getSparqlPrefixQuery() +
|
||||
"SELECT ?org ?orgLabel\n" +
|
||||
"SELECT ?org (Min(?orgLabel_) AS ?orgLabel) \n" +
|
||||
"WHERE\n" +
|
||||
"{\n" +
|
||||
" ?org a foaf:Organization .\n" +
|
||||
" ?org rdfs:label ?orgLabel .\n" +
|
||||
"}\n";
|
||||
" ?org a foaf:Organization \n" +
|
||||
" OPTIONAL { ?org rdfs:label ?orgLabelPrimary . \n" +
|
||||
" FILTER (LANG(?orgLabelPrimary) = '" + langCtx + "') \n" +
|
||||
"} \n" +
|
||||
" OPTIONAL { ?org rdfs:label ?orgLabelSecondary . \n" +
|
||||
" FILTER (LANG(?orgLabelSecondary) = '" + language + "') \n" +
|
||||
"} \n" +
|
||||
" OPTIONAL { ?org rdfs:label ?orgLabelTertiary .\n" +
|
||||
" FILTER (STRBEFORE(STR(LANG(?orgLabelTertiary)), '-') = '" + language + "') \n" +
|
||||
"} \n" +
|
||||
" OPTIONAL { ?org rdfs:label ?orgLabelFallback .\n" +
|
||||
" FILTER (LANG(?orgLabelFallback) != '" + langCtx + "' \n" +
|
||||
" && LANG(?orgLabelFallback) != '" + language + "' ) \n" +
|
||||
"} \n" +
|
||||
"BIND(COALESCE(?orgLabelPrimary, ?orgLabelSecondary, ?orgLabelTertiary, ?orgLabelFallback) AS ?orgLabel_) \n" +
|
||||
"} GROUP BY ?org \n";
|
||||
|
||||
final Map<String, String> map = new HashMap<>();
|
||||
|
||||
|
@ -390,6 +416,16 @@ final public class VisualizationCaches {
|
|||
new CachingRDFServiceExecutor.RDFServiceCallable<ConceptLabelMap>() {
|
||||
@Override
|
||||
protected ConceptLabelMap callWithService(RDFService rdfService) throws Exception {
|
||||
VitroRequest vreq = rdfService.getVitroRequest();
|
||||
String langCtx = "en-US";
|
||||
// UQAM-Optimization Adjust to linguistic context
|
||||
try {
|
||||
langCtx = vreq.getLocale().getLanguage();
|
||||
if (!vreq.getLocale().getCountry().isEmpty()) {
|
||||
langCtx += "-" + vreq.getLocale().getCountry();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String query = QueryConstants.getSparqlPrefixQuery() +
|
||||
"SELECT ?concept ?label\n" +
|
||||
"WHERE\n" +
|
||||
|
@ -398,13 +434,13 @@ final public class VisualizationCaches {
|
|||
" ?person core:hasResearchArea ?concept .\n" +
|
||||
" ?concept a skos:Concept .\n" +
|
||||
" ?concept rdfs:label ?label .\n" +
|
||||
" FILTER (lang(?label) = '" + langCtx+"' ) \n" +
|
||||
"}\n";
|
||||
|
||||
// final Map<String, String> map = new HashMap<>();
|
||||
final ConceptLabelMap map = new ConceptLabelMap();
|
||||
|
||||
|
||||
rdfService.sparqlSelectQuery(query, new ResultSetConsumer() {
|
||||
@Override
|
||||
protected void processQuerySolution(QuerySolution qs) {
|
||||
String conceptURI = qs.getResource("concept").getURI().intern();
|
||||
String label = qs.getLiteral("label").getString().intern();
|
||||
|
|
|
@ -7,6 +7,12 @@ import edu.cornell.mannlib.vitro.webapp.i18n.VitroResourceBundle;
|
|||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
/**
|
||||
* Configures VIVO to look for i18n properties files prefixed with 'vivo_'.
|
||||
* This listener must be run before any other code that uses resource bundles.
|
||||
* As this listener does not depend on any others, it should be run at or near
|
||||
* the top of the list in startup_listeners.txt.
|
||||
*/
|
||||
public class i18nSetup implements ServletContextListener {
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue