updates for edit submission preprocessor, passing vreq
This commit is contained in:
parent
91fd8a4c1b
commit
b6b96d12a7
5 changed files with 11 additions and 11 deletions
|
@ -358,16 +358,14 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
||||||
|
|
||||||
//Add preprocessor
|
//Add preprocessor
|
||||||
|
|
||||||
private void addPreprocessors(EditConfigurationVTwo editConfiguration,
|
private void addPreprocessors(EditConfigurationVTwo editConfiguration) {
|
||||||
OntModel ontModel,
|
|
||||||
WebappDaoFactory wdf) {
|
|
||||||
//An Edit submission preprocessor for enabling addition of multiple terms for a single search
|
//An Edit submission preprocessor for enabling addition of multiple terms for a single search
|
||||||
//TODO: Check if this is the appropriate way of getting model
|
//TODO: Check if this is the appropriate way of getting model
|
||||||
|
|
||||||
//Passing model to check for any URIs that are present
|
//Passing model to check for any URIs that are present
|
||||||
|
|
||||||
editConfiguration.addEditSubmissionPreprocessor(
|
editConfiguration.addEditSubmissionPreprocessor(
|
||||||
new AddAssociatedConceptsPreprocessor(editConfiguration, ontModel, wdf));
|
new AddAssociatedConceptsPreprocessor(editConfiguration));
|
||||||
editConfiguration.addModelChangePreprocessor(new ConceptSemanticTypesPreprocessor());
|
editConfiguration.addModelChangePreprocessor(new ConceptSemanticTypesPreprocessor());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.BaseEditSubmissionPreprocessorVTwo;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.BaseEditSubmissionPreprocessorVTwo;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||||
|
@ -78,17 +79,18 @@ public class AddAssociatedConceptsPreprocessor extends
|
||||||
|
|
||||||
// Will be editing the edit configuration as well as edit submission here
|
// Will be editing the edit configuration as well as edit submission here
|
||||||
|
|
||||||
public AddAssociatedConceptsPreprocessor(EditConfigurationVTwo editConfig, OntModel ontModel, WebappDaoFactory wadf) {
|
public AddAssociatedConceptsPreprocessor(EditConfigurationVTwo editConfig) {
|
||||||
super(editConfig);
|
super(editConfig);
|
||||||
this.ontModel = ontModel;
|
|
||||||
this.wdf = wadf;
|
|
||||||
this.labelVarToUriVarHash = new HashMap<String, String>();
|
this.labelVarToUriVarHash = new HashMap<String, String>();
|
||||||
//Saves values of concept type uris
|
//Saves values of concept type uris
|
||||||
this.conceptSemanticTypeURIVarToValueMap = new HashMap<String, List<String>>();
|
this.conceptSemanticTypeURIVarToValueMap = new HashMap<String, List<String>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preprocess(MultiValueEditSubmission inputSubmission) {
|
public void preprocess(MultiValueEditSubmission inputSubmission, VitroRequest vreq) {
|
||||||
submission = inputSubmission;
|
submission = inputSubmission;
|
||||||
|
this.wdf = vreq.getWebappDaoFactory();
|
||||||
|
this.ontModel = ModelAccess.on(vreq).getJenaOntModel();
|
||||||
|
//Set the models that we need here
|
||||||
// Get the input elements for concept node and concept label as well
|
// Get the input elements for concept node and concept label as well
|
||||||
// as vocab uri (which is based on thge
|
// as vocab uri (which is based on thge
|
||||||
// For query parameters, check whether CUI
|
// For query parameters, check whether CUI
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class ConceptSemanticTypesPreprocessor implements ModelChangePreprocessor
|
||||||
@Override
|
@Override
|
||||||
public void preprocess(Model retractionsModel, Model additionsModel,
|
public void preprocess(Model retractionsModel, Model additionsModel,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) {
|
||||||
VitroRequest vreq = new VitroRequest(vreq);
|
VitroRequest vreq = new VitroRequest(request);
|
||||||
//Run a construct query against the additions model
|
//Run a construct query against the additions model
|
||||||
String prefixes = "PREFIX rdfs:<" + RDFS.getURI() + "> " +
|
String prefixes = "PREFIX rdfs:<" + RDFS.getURI() + "> " +
|
||||||
"PREFIX owl:<http://www.w3.org/2002/07/owl#> " +
|
"PREFIX owl:<http://www.w3.org/2002/07/owl#> " +
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class RoleToActivityPredicatePreprocessor extends RoleToPredicatePreproce
|
||||||
this.itemToRolePredicate = "activityToRolePredicate";
|
this.itemToRolePredicate = "activityToRolePredicate";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getItemType(MultiValueEditSubmission submission) {
|
protected String getItemType(MultiValueEditSubmission submission, VitroRequest vreq) {
|
||||||
String type = null;
|
String type = null;
|
||||||
Map<String, List<String>> urisFromForm = submission.getUrisFromForm();
|
Map<String, List<String>> urisFromForm = submission.getUrisFromForm();
|
||||||
//Get the type of the activity selected
|
//Get the type of the activity selected
|
||||||
|
|
|
@ -56,7 +56,7 @@ public abstract class RoleToPredicatePreprocessor extends BaseEditSubmissionPrep
|
||||||
//Instantiate itemType etc. based on which version of preprocessor required
|
//Instantiate itemType etc. based on which version of preprocessor required
|
||||||
abstract protected void setupVariableNames();
|
abstract protected void setupVariableNames();
|
||||||
|
|
||||||
public void preprocess(MultiValueEditSubmission submission) {
|
public void preprocess(MultiValueEditSubmission submission, VitroRequest vreq) {
|
||||||
//Query for all statements using the original roleIn predicate replace
|
//Query for all statements using the original roleIn predicate replace
|
||||||
//with the appropriate roleRealizedIn or roleContributesTo
|
//with the appropriate roleRealizedIn or roleContributesTo
|
||||||
//In addition, need to ensure the inverse predicate is also set correctly
|
//In addition, need to ensure the inverse predicate is also set correctly
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue