Adding ability for an EditConfiguration to specify a redirect instead of a form. NIHVIVO-3369
This commit is contained in:
parent
32041213b4
commit
78049c4633
2 changed files with 263 additions and 225 deletions
|
@ -3602,7 +3602,6 @@
|
||||||
<vitro:collateBySubclassAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</vitro:collateBySubclassAnnot>
|
<vitro:collateBySubclassAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</vitro:collateBySubclassAnnot>
|
||||||
<vitro:prohibitedFromUpdateBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
<vitro:prohibitedFromUpdateBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||||
<vitro:fullPropertyNameAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has authorship</vitro:fullPropertyNameAnnot>
|
<vitro:fullPropertyNameAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has authorship</vitro:fullPropertyNameAnnot>
|
||||||
<vitro:skipEditForm rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</vitro:skipEditForm>
|
|
||||||
<vitro:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
<vitro:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||||
<vitro:publicDescriptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This relates a person to their authorship information.</vitro:publicDescriptionAnnot>
|
<vitro:publicDescriptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This relates a person to their authorship information.</vitro:publicDescriptionAnnot>
|
||||||
</rdf:Description>
|
</rdf:Description>
|
||||||
|
|
|
@ -12,7 +12,10 @@ import javax.servlet.http.HttpSession;
|
||||||
import com.hp.hpl.jena.rdf.model.Literal;
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
import com.hp.hpl.jena.vocabulary.XSD;
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.PersonHasPublicationValidator;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.PersonHasPublicationValidator;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
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.EditConfigurationVTwo;
|
||||||
|
@ -20,246 +23,282 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.FieldVTwo;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
|
import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On an add/new, this will show a form, on an edit/update this will skip to the
|
||||||
|
* profile page of the publication.
|
||||||
|
*/
|
||||||
public class AddPublicationToPersonGenerator extends VivoBaseGenerator implements EditConfigurationGenerator {
|
public class AddPublicationToPersonGenerator extends VivoBaseGenerator implements EditConfigurationGenerator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
|
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) {
|
||||||
HttpSession session) {
|
|
||||||
EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo();
|
if( EditConfigurationUtils.getObjectUri(vreq) == null ){
|
||||||
initBasics(editConfiguration, vreq);
|
return doAddNew(vreq,session);
|
||||||
initPropertyParameters(vreq, session, editConfiguration);
|
}else{
|
||||||
initObjectPropForm(editConfiguration, vreq);
|
return doSkipToPublication(vreq);
|
||||||
setVarNames(editConfiguration);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private EditConfigurationVTwo doSkipToPublication(VitroRequest vreq) {
|
||||||
|
Individual authorshipNode = EditConfigurationUtils.getObjectIndividual(vreq);
|
||||||
|
|
||||||
|
//try to get the publication
|
||||||
|
List<ObjectPropertyStatement> stmts =
|
||||||
|
authorshipNode.getObjectPropertyStatements("http://vivoweb.org/ontology/core#linkedInformationResource");
|
||||||
|
if( stmts == null || stmts.isEmpty() ){
|
||||||
|
return doBadAuthorshipNoPub( vreq );
|
||||||
|
}else if( stmts.size() > 1 ){
|
||||||
|
return doBadAuthorshipMultiplePubs(vreq);
|
||||||
|
}else{
|
||||||
|
//skip to publication
|
||||||
|
EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo();
|
||||||
|
editConfiguration.setSkipToUrl(UrlBuilder.getIndividualProfileUrl(stmts.get(0).getObjectURI(), vreq));
|
||||||
|
return editConfiguration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected EditConfigurationVTwo doAddNew(VitroRequest vreq,
|
||||||
|
HttpSession session) {
|
||||||
|
EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo();
|
||||||
|
initBasics(editConfiguration, vreq);
|
||||||
|
initPropertyParameters(vreq, session, editConfiguration);
|
||||||
|
initObjectPropForm(editConfiguration, vreq);
|
||||||
|
setVarNames(editConfiguration);
|
||||||
|
|
||||||
|
// Required N3
|
||||||
|
editConfiguration.setN3Required(generateN3Required());
|
||||||
|
|
||||||
|
// Optional N3
|
||||||
|
editConfiguration.setN3Optional(generateN3Optional());
|
||||||
|
|
||||||
|
editConfiguration.setNewResources(generateNewResources(vreq));
|
||||||
|
|
||||||
|
// In scope
|
||||||
|
setUrisAndLiteralsInScope(editConfiguration, vreq);
|
||||||
|
|
||||||
|
// on Form
|
||||||
|
setUrisAndLiteralsOnForm(editConfiguration, vreq);
|
||||||
|
|
||||||
|
// Sparql queries
|
||||||
|
setSparqlQueries(editConfiguration, vreq);
|
||||||
|
|
||||||
|
// set fields
|
||||||
|
setFields(editConfiguration, vreq);
|
||||||
|
|
||||||
|
// template file
|
||||||
|
editConfiguration.setTemplate("addPublicationToPerson.ftl");
|
||||||
|
// adding person has publication validator
|
||||||
|
editConfiguration.addValidator(new PersonHasPublicationValidator());
|
||||||
|
|
||||||
|
// Adding additional data, specifically edit mode
|
||||||
|
addFormSpecificData(editConfiguration, vreq);
|
||||||
|
return editConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EditConfigurationVTwo doBadAuthorshipMultiplePubs(VitroRequest vreq) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EditConfigurationVTwo doBadAuthorshipNoPub(VitroRequest vreq) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setVarNames(EditConfigurationVTwo editConfiguration) {
|
||||||
|
editConfiguration.setVarNameForSubject("person");
|
||||||
|
editConfiguration.setVarNameForPredicate("predicate");
|
||||||
|
editConfiguration.setVarNameForObject("authorshipUri");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Required N3
|
|
||||||
editConfiguration.setN3Required(generateN3Required());
|
|
||||||
|
|
||||||
// Optional N3
|
/***N3 strings both required and optional***/
|
||||||
editConfiguration.setN3Optional( generateN3Optional());
|
private List<String> generateN3Optional() {
|
||||||
|
return list(getN3ForExistingPub(),
|
||||||
|
getN3ForNewPub(),
|
||||||
|
getN3NewPubNameAssertion(),
|
||||||
|
getN3NewPubTypeAssertion());
|
||||||
|
}
|
||||||
|
|
||||||
editConfiguration.setNewResources( generateNewResources(vreq) );
|
|
||||||
|
|
||||||
//In scope
|
private List<String> generateN3Required() {
|
||||||
setUrisAndLiteralsInScope(editConfiguration, vreq);
|
return list(getAuthorshipN3());
|
||||||
|
}
|
||||||
|
|
||||||
//on Form
|
private String getAuthorshipN3() {
|
||||||
setUrisAndLiteralsOnForm(editConfiguration, vreq);
|
return "@prefix core: <" + vivoCore + "> . " +
|
||||||
|
"?authorshipUri a core:Authorship ;" +
|
||||||
|
"core:linkedAuthor ?person ." +
|
||||||
|
"?person core:authorInAuthorship ?authorshipUri .";
|
||||||
|
}
|
||||||
|
|
||||||
//Sparql queries
|
private String getN3ForExistingPub() {
|
||||||
setSparqlQueries(editConfiguration, vreq);
|
return "@prefix core: <" + vivoCore + "> ." +
|
||||||
|
"?authorshipUri core:linkedInformationResource ?pubUri ." +
|
||||||
|
"?pubUri core:informationResourceInAuthorship ?authorshipUri .";
|
||||||
|
}
|
||||||
|
|
||||||
//set fields
|
private String getN3ForNewPub() {
|
||||||
setFields(editConfiguration, vreq);
|
return "@prefix core: <" + vivoCore + "> ." +
|
||||||
|
"?pubUri a ?pubType ;" +
|
||||||
|
"<" + label + "> ?title ." +
|
||||||
|
"?authorshipUri core:linkedInformationResource ?pubUri ." +
|
||||||
|
"?pubUri core:informationResourceInAuthorship ?authorshipUri .";
|
||||||
|
}
|
||||||
|
|
||||||
//template file
|
private String getN3NewPubNameAssertion() {
|
||||||
editConfiguration.setTemplate("addPublicationToPerson.ftl");
|
return "?pubUri <" + label + "> ?title .";
|
||||||
//adding person has publication validator
|
}
|
||||||
editConfiguration.addValidator(new PersonHasPublicationValidator());
|
|
||||||
|
|
||||||
//Adding additional data, specifically edit mode
|
private String getN3NewPubTypeAssertion() {
|
||||||
addFormSpecificData(editConfiguration, vreq);
|
return "?pubUri a ?pubType . ";
|
||||||
return editConfiguration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get new resources */
|
||||||
|
private Map<String, String> generateNewResources(VitroRequest vreq) {
|
||||||
|
String DEFAULT_NS_TOKEN=null; //null forces the default NS
|
||||||
|
|
||||||
|
HashMap<String, String> newResources = new HashMap<String, String>();
|
||||||
|
newResources.put("authorshipUri", DEFAULT_NS_TOKEN);
|
||||||
|
newResources.put("pubUri", DEFAULT_NS_TOKEN);
|
||||||
|
return newResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set URIS and Literals In Scope and on form and supporting methods */
|
||||||
|
private void setUrisAndLiteralsInScope(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
||||||
|
HashMap<String, List<String>> urisInScope = new HashMap<String, List<String>>();
|
||||||
|
urisInScope.put(editConfiguration.getVarNameForSubject(),
|
||||||
|
Arrays.asList(new String[]{editConfiguration.getSubjectUri()}));
|
||||||
|
urisInScope.put(editConfiguration.getVarNameForPredicate(),
|
||||||
|
Arrays.asList(new String[]{editConfiguration.getPredicateUri()}));
|
||||||
|
editConfiguration.setUrisInScope(urisInScope);
|
||||||
|
HashMap<String, List<Literal>> literalsInScope = new HashMap<String, List<Literal>>();
|
||||||
|
editConfiguration.setLiteralsInScope(literalsInScope);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUrisAndLiteralsOnForm(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
||||||
|
List<String> urisOnForm = new ArrayList<String>();
|
||||||
|
//add role activity and roleActivityType to uris on form
|
||||||
|
urisOnForm.add("pubUri");
|
||||||
|
urisOnForm.add("pubType");
|
||||||
|
editConfiguration.setUrisOnform(urisOnForm);
|
||||||
|
|
||||||
|
//activity label and role label are literals on form
|
||||||
|
List<String> literalsOnForm = new ArrayList<String>();
|
||||||
|
literalsOnForm.add("title");
|
||||||
|
editConfiguration.setLiteralsOnForm(literalsOnForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set SPARQL Queries and supporting methods. */
|
||||||
|
//In this case no queries for existing
|
||||||
|
private void setSparqlQueries(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
||||||
|
editConfiguration.setSparqlForExistingUris(new HashMap<String, String>());
|
||||||
|
editConfiguration.setSparqlForAdditionalLiteralsInScope(new HashMap<String, String>());
|
||||||
|
editConfiguration.setSparqlForAdditionalUrisInScope(new HashMap<String, String>());
|
||||||
|
editConfiguration.setSparqlForExistingLiterals(new HashMap<String, String>());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Set Fields and supporting methods
|
||||||
|
*/
|
||||||
|
|
||||||
|
private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
||||||
|
setTitleField(editConfiguration);
|
||||||
|
setPubTypeField(editConfiguration);
|
||||||
|
setPubUriField(editConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTitleField(EditConfigurationVTwo editConfiguration) {
|
||||||
|
String stringDatatypeUri = XSD.xstring.toString();
|
||||||
|
editConfiguration.addField(new FieldVTwo().
|
||||||
|
setName("title").
|
||||||
|
setValidators(list("datatype:" + stringDatatypeUri)).
|
||||||
|
setRangeDatatypeUri(stringDatatypeUri));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void setVarNames(EditConfigurationVTwo editConfiguration) {
|
private void setPubTypeField(EditConfigurationVTwo editConfiguration) {
|
||||||
editConfiguration.setVarNameForSubject("person");
|
editConfiguration.addField(new FieldVTwo().
|
||||||
editConfiguration.setVarNameForPredicate("predicate");
|
setName("pubType").
|
||||||
editConfiguration.setVarNameForObject("authorshipUri");
|
setOptionsType("HARDCODED_LITERALS").
|
||||||
|
setLiteralOptions(getPublicationTypeLiteralOptions()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***N3 strings both required and optional***/
|
|
||||||
private List<String> generateN3Optional() {
|
|
||||||
return list(getN3ForExistingPub(),
|
|
||||||
getN3ForNewPub(),
|
|
||||||
getN3NewPubNameAssertion(),
|
|
||||||
getN3NewPubTypeAssertion());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<String> generateN3Required() {
|
|
||||||
return list(getAuthorshipN3());
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getAuthorshipN3() {
|
|
||||||
return "@prefix core: <" + vivoCore + "> . " +
|
|
||||||
"?authorshipUri a core:Authorship ;" +
|
|
||||||
"core:linkedAuthor ?person ." +
|
|
||||||
"?person core:authorInAuthorship ?authorshipUri .";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getN3ForExistingPub() {
|
|
||||||
return "@prefix core: <" + vivoCore + "> ." +
|
|
||||||
"?authorshipUri core:linkedInformationResource ?pubUri ." +
|
|
||||||
"?pubUri core:informationResourceInAuthorship ?authorshipUri .";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getN3ForNewPub() {
|
|
||||||
return "@prefix core: <" + vivoCore + "> ." +
|
|
||||||
"?pubUri a ?pubType ;" +
|
|
||||||
"<" + label + "> ?title ." +
|
|
||||||
"?authorshipUri core:linkedInformationResource ?pubUri ." +
|
|
||||||
"?pubUri core:informationResourceInAuthorship ?authorshipUri .";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getN3NewPubNameAssertion() {
|
|
||||||
return "?pubUri <" + label + "> ?title .";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getN3NewPubTypeAssertion() {
|
|
||||||
return "?pubUri a ?pubType . ";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get new resources */
|
|
||||||
private Map<String, String> generateNewResources(VitroRequest vreq) {
|
|
||||||
String DEFAULT_NS_TOKEN=null; //null forces the default NS
|
|
||||||
|
|
||||||
HashMap<String, String> newResources = new HashMap<String, String>();
|
|
||||||
newResources.put("authorshipUri", DEFAULT_NS_TOKEN);
|
|
||||||
newResources.put("pubUri", DEFAULT_NS_TOKEN);
|
|
||||||
return newResources;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set URIS and Literals In Scope and on form and supporting methods */
|
|
||||||
private void setUrisAndLiteralsInScope(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
|
||||||
HashMap<String, List<String>> urisInScope = new HashMap<String, List<String>>();
|
|
||||||
urisInScope.put(editConfiguration.getVarNameForSubject(),
|
|
||||||
Arrays.asList(new String[]{editConfiguration.getSubjectUri()}));
|
|
||||||
urisInScope.put(editConfiguration.getVarNameForPredicate(),
|
|
||||||
Arrays.asList(new String[]{editConfiguration.getPredicateUri()}));
|
|
||||||
editConfiguration.setUrisInScope(urisInScope);
|
|
||||||
HashMap<String, List<Literal>> literalsInScope = new HashMap<String, List<Literal>>();
|
|
||||||
editConfiguration.setLiteralsInScope(literalsInScope);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUrisAndLiteralsOnForm(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
|
||||||
List<String> urisOnForm = new ArrayList<String>();
|
|
||||||
//add role activity and roleActivityType to uris on form
|
|
||||||
urisOnForm.add("pubUri");
|
|
||||||
urisOnForm.add("pubType");
|
|
||||||
editConfiguration.setUrisOnform(urisOnForm);
|
|
||||||
|
|
||||||
//activity label and role label are literals on form
|
|
||||||
List<String> literalsOnForm = new ArrayList<String>();
|
|
||||||
literalsOnForm.add("title");
|
|
||||||
editConfiguration.setLiteralsOnForm(literalsOnForm);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set SPARQL Queries and supporting methods. */
|
|
||||||
//In this case no queries for existing
|
|
||||||
private void setSparqlQueries(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
|
||||||
editConfiguration.setSparqlForExistingUris(new HashMap<String, String>());
|
|
||||||
editConfiguration.setSparqlForAdditionalLiteralsInScope(new HashMap<String, String>());
|
|
||||||
editConfiguration.setSparqlForAdditionalUrisInScope(new HashMap<String, String>());
|
|
||||||
editConfiguration.setSparqlForExistingLiterals(new HashMap<String, String>());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Set Fields and supporting methods
|
|
||||||
*/
|
|
||||||
|
|
||||||
private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
|
||||||
setTitleField(editConfiguration);
|
|
||||||
setPubTypeField(editConfiguration);
|
|
||||||
setPubUriField(editConfiguration);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setTitleField(EditConfigurationVTwo editConfiguration) {
|
|
||||||
String stringDatatypeUri = XSD.xstring.toString();
|
|
||||||
editConfiguration.addField(new FieldVTwo().
|
|
||||||
setName("title").
|
|
||||||
setValidators(list("datatype:" + stringDatatypeUri)).
|
|
||||||
setRangeDatatypeUri(stringDatatypeUri));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void setPubTypeField(EditConfigurationVTwo editConfiguration) {
|
private void setPubUriField(EditConfigurationVTwo editConfiguration) {
|
||||||
editConfiguration.addField(new FieldVTwo().
|
editConfiguration.addField(new FieldVTwo().
|
||||||
setName("pubType").
|
setName("pubUri").
|
||||||
setOptionsType("HARDCODED_LITERALS").
|
setObjectClassUri(personClass));
|
||||||
setLiteralOptions(getPublicationTypeLiteralOptions()));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
private List<List<String>> getPublicationTypeLiteralOptions() {
|
||||||
|
List<List<String>> literalOptions = new ArrayList<List<String>>();
|
||||||
|
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://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://vivoweb.org/ontology/core#Software", "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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Form specific data
|
||||||
|
public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
||||||
|
HashMap<String, Object> formSpecificData = new HashMap<String, Object>();
|
||||||
|
formSpecificData.put("editMode", getEditMode(vreq).name().toLowerCase());
|
||||||
|
formSpecificData.put("sparqlForAcFilter", getSparqlForAcFilter(vreq));
|
||||||
|
editConfiguration.setFormSpecificData(formSpecificData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSparqlForAcFilter(VitroRequest vreq) {
|
||||||
|
String subject = EditConfigurationUtils.getSubjectUri(vreq);
|
||||||
|
|
||||||
private void setPubUriField(EditConfigurationVTwo editConfiguration) {
|
String query = "PREFIX core:<" + vivoCore + "> " +
|
||||||
editConfiguration.addField(new FieldVTwo().
|
"SELECT ?pubUri WHERE { " +
|
||||||
setName("pubUri").
|
"<" + subject + "> core:authorInAuthorship ?authorshipUri ." +
|
||||||
setObjectClassUri(personClass));
|
"?authorshipUri core:linkedInformationResource ?pubUri . }";
|
||||||
}
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EditMode getEditMode(VitroRequest vreq) {
|
||||||
private List<List<String>> getPublicationTypeLiteralOptions() {
|
return EditModeUtils.getEditMode(vreq, list("http://vivoweb.org/ontology/core#linkedInformationResource"));
|
||||||
List<List<String>> literalOptions = new ArrayList<List<String>>();
|
}
|
||||||
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://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://vivoweb.org/ontology/core#Software", "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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Form specific data
|
|
||||||
public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
|
|
||||||
HashMap<String, Object> formSpecificData = new HashMap<String, Object>();
|
|
||||||
formSpecificData.put("editMode", getEditMode(vreq).name().toLowerCase());
|
|
||||||
formSpecificData.put("sparqlForAcFilter", getSparqlForAcFilter(vreq));
|
|
||||||
editConfiguration.setFormSpecificData(formSpecificData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSparqlForAcFilter(VitroRequest vreq) {
|
|
||||||
String subject = EditConfigurationUtils.getSubjectUri(vreq);
|
|
||||||
|
|
||||||
String query = "PREFIX core:<" + vivoCore + "> " +
|
|
||||||
"SELECT ?pubUri WHERE { " +
|
|
||||||
"<" + subject + "> core:authorInAuthorship ?authorshipUri ." +
|
|
||||||
"?authorshipUri core:linkedInformationResource ?pubUri . }";
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EditMode getEditMode(VitroRequest vreq) {
|
|
||||||
return EditModeUtils.getEditMode(vreq, list("http://vivoweb.org/ontology/core#linkedInformationResource"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue