NIHVIVO-2288: freemarker conversion, templates and generators
This commit is contained in:
parent
827ea6d7e9
commit
e2e7574e1b
12 changed files with 1391 additions and 0 deletions
|
@ -0,0 +1,26 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
<#--Two stage form for service provider role-->
|
||||||
|
|
||||||
|
<#--
|
||||||
|
Required Values to be set for each form that includes addRoleToPersonTwoStage.ftl are:
|
||||||
|
roleDescriptor.
|
||||||
|
The other required values (roleType, optionsType, objectClassUri, and literalOptions are
|
||||||
|
set in the JAVA class corresponding to the form, e.g. AddEditorRoleToPersonGenerator.java.
|
||||||
|
|
||||||
|
Optional values can be set, but each of these has default values
|
||||||
|
set in addRoleToPersonTwoStage.ftl:
|
||||||
|
|
||||||
|
buttonText
|
||||||
|
typeSelectorLabel
|
||||||
|
numDateFields
|
||||||
|
showRoleLAbelField
|
||||||
|
roleExamples-->
|
||||||
|
|
||||||
|
|
||||||
|
<#--Variable assignments for Add Clinical Role To Person-->
|
||||||
|
<#assign roleDescriptor = "collection or series editor role" />
|
||||||
|
<#assign typeSelectorLabel = "editor role in" />
|
||||||
|
|
||||||
|
|
||||||
|
<#--Each of the two stage forms will include the form below-->
|
||||||
|
<#include "addRoleToPersonTwoStage.ftl">
|
|
@ -0,0 +1,26 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
<#--Two stage form for service provider role-->
|
||||||
|
|
||||||
|
<#--
|
||||||
|
Required Values to be set for each form that includes addRoleToPersonTwoStage.ftl are:
|
||||||
|
roleDescriptor.
|
||||||
|
The other required values (roleType, optionsType, objectClassUri, and literalOptions are
|
||||||
|
set in the JAVA class corresponding to the form, e.g. AddReviewerRoleToPersonGenerator.java.
|
||||||
|
|
||||||
|
Optional values can be set, but each of these has default values
|
||||||
|
set in addRoleToPersonTwoStage.ftl:
|
||||||
|
|
||||||
|
buttonText
|
||||||
|
typeSelectorLabel
|
||||||
|
numDateFields
|
||||||
|
showRoleLAbelField
|
||||||
|
roleExamples-->
|
||||||
|
|
||||||
|
|
||||||
|
<#--Variable assignments for Add Clinical Role To Person-->
|
||||||
|
<#assign roleDescriptor = "reviewer of" />
|
||||||
|
<#assign typeSelectorLabel = "reviewer of" />
|
||||||
|
|
||||||
|
|
||||||
|
<#--Each of the two stage forms will include the form below-->
|
||||||
|
<#include "addRoleToPersonTwoStage.ftl">
|
|
@ -0,0 +1,131 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddEditorRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddEditorRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addEditorRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
public String getActivityToRolePredicate(VitroRequest vreq) {
|
||||||
|
return "http://vivoweb.org/ontology/core#linkedRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleToActivityPredicate(VitroRequest vreq) {
|
||||||
|
return "http://vivoweb.org/ontology/core#forInformationResource";
|
||||||
|
}
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#EditorRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.CHILD_VCLASSES;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return "http://purl.org/ontology/bibo/Collection";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Editor role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select type");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
public boolean isShowRoleLabelField(VitroRequest vreq) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddHeadOfRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddHeadOfRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addHeadOfRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#LeaderRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Head Of role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String>literalOptions.put( literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select type");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Association", "Association");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Center", "Center");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ClinicalOrganization", "Clinical Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#College", "College");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Committee", "Committee");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Consortium", "Consortium");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Department", "Department");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Division", "Division");
|
||||||
|
literalOptions.put("http://purl.org/NET/c4dm/event.owl#Event", "Event");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ExtensionUnit", "Extension Unit");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Foundation", "Foundation");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#FundingOrganization", "Funding Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#GovernmentAgency", "Government Agency");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Hospital", "Hospital");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Institute", "Institute");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Laboratory", "Laboratory");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Library", "Library");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Museum", "Museum");
|
||||||
|
literalOptions.put("http://xmlns.com/foaf/0.1/Organization", "Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#PrivateCompany", "Private Company");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Program", "Program");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Project", "Project");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Publisher", "Publisher");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ResearchOrganization", "Research Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#School", "School");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Service","Service");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Team", "Team");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#StudentOrganization", "Student Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#University", "University");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;Member
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddMemberRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddMemberRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addMemberRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#MemberRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.VCLASSGROUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return "http://vivoweb.org/ontology#vitroClassGrouporganizations";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Member role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select type");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddOrganizerRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddOrganizerRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addOrganizerRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#OrganizerRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Organizer role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String>literalOptions.put( literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select type");
|
||||||
|
literalOptions.put("http://purl.org/NET/c4dm/event.owl#Event", "Event");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Competition", "Competition");
|
||||||
|
literalOptions.put("http://purl.org/ontology/bibo/Conference", "Conference");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Course", "Course");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Exhibit", "Exhibit");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Meeting", "Meeting");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Presentation", "Presentation");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#InvitedTalk", "Invited Talk");
|
||||||
|
literalOptions.put("http://purl.org/ontology/bibo/Workshop", "Workshop");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#EventSeries", "Event Series");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ConferenceSeries", "Conference Series");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#SeminarSeries", "Seminar Series");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#WorkshopSeries", "Workshop Series");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
public boolean isShowRoleLabelField(VitroRequest vreq) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddOutreachProviderRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddOutreachProviderRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addOutreachProviderRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#OutreachProviderRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Outreach Provider role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String>literalOptions.put( literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select type");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Association", "Association");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Center", "Center");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ClinicalOrganization", "Clinical Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#College", "College");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Committee", "Committee");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Consortium", "Consortium");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Department", "Department");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Division", "Division");
|
||||||
|
literalOptions.put("http://purl.org/NET/c4dm/event.owl#Event", "Event");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ExtensionUnit", "Extension Unit");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Foundation", "Foundation");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#FundingOrganization", "Funding Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#GovernmentAgency", "Government Agency");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Hospital", "Hospital");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Institute", "Institute");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Laboratory", "Laboratory");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Library", "Library");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Museum", "Museum");
|
||||||
|
literalOptions.put("http://xmlns.com/foaf/0.1/Organization", "Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#PrivateCompany", "Private Company");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Program", "Program");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Project", "Project");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Publisher", "Publisher");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ResearchOrganization", "Research Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Team", "Team");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#School", "School");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Service","Service");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#StudentOrganization", "Student Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#University", "University");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddPresenterRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddPresenterRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addPresenterRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#PresenterRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Presenter role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String>literalOptions.put( literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select type");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Presentation", "Presentation");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#InvitedTalk","Invited Talk");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddResearcherRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddResearcherRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addResearcherRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#ResearcherRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Researcher role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String>literalOptions.put( literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select one");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Grant", "Grant");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Project","Project");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddReviewerRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddReviewerRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addReviewerRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
public String getActivityToRolePredicate(VitroRequest vreq) {
|
||||||
|
return "http://vivoweb.org/ontology/core#linkedRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleToActivityPredicate(VitroRequest vreq) {
|
||||||
|
return "http://vivoweb.org/ontology/core#forInformationResource";
|
||||||
|
}
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#ReviewerRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.CHILD_VCLASSES;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return "http://vivoweb.org/ontology/core#InformationResource";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Reviewer role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select type");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
public boolean isShowRoleLabelField(VitroRequest vreq) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,151 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddServiceProviderRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddServiceProviderRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addServiceProviderRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#ServiceProviderRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Service Provider role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select one");
|
||||||
|
literalOptions.put("http://purl.org/ontology/bibo/Conference", "Conference");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Association", "Association");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Center", "Center");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ClinicalOrganization", "Clinical Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#College", "College");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Committee", "Committee");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Consortium", "Consortium");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Department", "Department");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Division", "Division");
|
||||||
|
literalOptions.put("http://purl.org/NET/c4dm/event.owl#Event", "Event");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ExtensionUnit", "Extension Unit");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Foundation", "Foundation");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#FundingOrganization", "Funding Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#GovernmentAgency", "Government Agency");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Hospital", "Hospital");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Institute", "Institute");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Laboratory", "Laboratory");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Library", "Library");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Museum", "Museum");
|
||||||
|
literalOptions.put("http://xmlns.com/foaf/0.1/Organization", "Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#PrivateCompany", "Private Company");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Program", "Program");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Project", "Project");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Publisher", "Publisher");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#ResearchOrganization", "Research Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Team", "Team");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#School", "School");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Service","Service");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#StudentOrganization", "Student Organization");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#University", "University");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditN3GeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.SelectListGeneratorVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation;
|
||||||
|
/**
|
||||||
|
* Generates the edit configuration for adding a Role to a Person.
|
||||||
|
|
||||||
|
Stage one is selecting the type of the non-person thing
|
||||||
|
associated with the Role with the intention of reducing the
|
||||||
|
number of Individuals that the user has to select from.
|
||||||
|
Stage two is selecting the non-person Individual to associate
|
||||||
|
with the Role.
|
||||||
|
|
||||||
|
This is intended to create a set of statements like:
|
||||||
|
|
||||||
|
?person core:hasResearchActivityRole ?newRole.
|
||||||
|
?newRole rdf:type core:ResearchActivityRole ;
|
||||||
|
roleToActivityPredicate ?someActivity .
|
||||||
|
?someActivity rdf:type core:ResearchActivity .
|
||||||
|
?someActivity rdfs:label "activity title" .
|
||||||
|
|
||||||
|
|
||||||
|
Each subclass of the abstract two stage Generator class will have the option of overriding certain
|
||||||
|
methods, and must always implement the following methods:
|
||||||
|
getRoleType
|
||||||
|
getRoleActivityTypeOptionsType
|
||||||
|
getRoleActivityTypeObjectClassUri
|
||||||
|
getRoleActivityTypeLiteralOptions
|
||||||
|
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddTeacherRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
|
||||||
|
|
||||||
|
private Log log = LogFactory.getLog(AddTeacherRoleToPersonGenerator.class);
|
||||||
|
private static String template = "addTeacherRoleToPerson.ftl";
|
||||||
|
|
||||||
|
//Should this be overridden
|
||||||
|
@Override
|
||||||
|
protected void setTemplate(EditConfigurationVTwo editConfiguration,
|
||||||
|
VitroRequest vreq) {
|
||||||
|
editConfiguration.setTemplate(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The default activityToRolePredicate and roleToActivityPredicates are
|
||||||
|
//correct for this subclass so they don't need to be overwritten
|
||||||
|
|
||||||
|
//role type will always be set based on particular form
|
||||||
|
public String getRoleType(VitroRequest vreq) {
|
||||||
|
//TODO: Get dynamic way of including vivoweb ontology
|
||||||
|
return "http://vivoweb.org/ontology/core#TeacherRole";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Each subclass generator will return its own type of option here:
|
||||||
|
//whether literal hardcoded, based on class group, or subclasses of a specific class
|
||||||
|
//The latter two will apparently lend some kind of uri to objectClassUri ?
|
||||||
|
public RoleActivityOptionTypes getRoleActivityTypeOptionsType(VitroRequest vreq) {
|
||||||
|
return RoleActivityOptionTypes.HARDCODED_LITERALS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This too will depend on the specific subclass of generator
|
||||||
|
public String getRoleActivityTypeObjectClassUri(VitroRequest vreq) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Teacher role involves hard-coded options for the "right side" of the role or activity
|
||||||
|
protected HashMap<String, String> getRoleActivityTypeLiteralOptions(VitroRequest vreq) {
|
||||||
|
HashMap<String, String> literalOptions = new HashMap<String, String>();
|
||||||
|
literalOptions.put("", "Select one");
|
||||||
|
literalOptions.put("http://purl.org/ontology/bibo/Conference", "Conference");
|
||||||
|
literalOptions.put("http://vivoweb.org/ontology/core#Course","Course");
|
||||||
|
literalOptions.put("http://purl.org/ontology/bibo/Workshop","Workshop");
|
||||||
|
return literalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue