Refactoring the N3 editing to reorganize packages

This commit is contained in:
briancaruso 2011-05-12 16:02:37 +00:00
parent 189aeed711
commit 4144046559
77 changed files with 853 additions and 754 deletions

View file

@ -231,7 +231,7 @@ public class FedoraDatastreamController extends VitroHttpServlet implements Cons
} }
//check if fedora is on line //check if fedora is on line
OntModel sessionOntModel = (OntModel)req.getSession().getAttribute("jenaOntModel"); OntModel sessionOntModel = (OntModel)rawRequest.getSession().getAttribute("jenaOntModel");
synchronized (FedoraDatastreamController.class) { synchronized (FedoraDatastreamController.class) {
if( fedoraUrl == null ){ if( fedoraUrl == null ){
setup( sessionOntModel, getServletContext() ); setup( sessionOntModel, getServletContext() );
@ -280,7 +280,7 @@ public class FedoraDatastreamController extends VitroHttpServlet implements Cons
"enough information to complete your request.(Missing fileRes)"); "enough information to complete your request.(Missing fileRes)");
//check if file individual has a fedora:PID for a data stream //check if file individual has a fedora:PID for a data stream
VitroRequest vreq = new VitroRequest(req); VitroRequest vreq = new VitroRequest(rawRequest);
IndividualDao iwDao = vreq.getWebappDaoFactory().getIndividualDao(); IndividualDao iwDao = vreq.getWebappDaoFactory().getIndividualDao();
Individual fileEntity = iwDao.getIndividualByURI(fileUri); Individual fileEntity = iwDao.getIndividualByURI(fileUri);

View file

@ -40,8 +40,8 @@ import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache; import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.SelectListGenerator;
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch; import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel;

View file

@ -38,11 +38,11 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.UserDao; import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent; import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
import edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.FileUploadServletRequest; import edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.FileUploadServletRequest;
import edu.cornell.mannlib.vitro.webapp.utils.MailUtil; import edu.cornell.mannlib.vitro.webapp.utils.MailUtil;

View file

@ -26,7 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.ajax.VitroAjaxController; import edu.cornell.mannlib.vitro.webapp.controller.ajax.VitroAjaxController;
import edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena; import edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent; import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils;
public class PrimitiveRdfEdit extends VitroAjaxController { public class PrimitiveRdfEdit extends VitroAjaxController {

View file

@ -48,8 +48,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao; import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission;
import edu.cornell.mannlib.vitro.webapp.filestorage.model.FileInfo; import edu.cornell.mannlib.vitro.webapp.filestorage.model.FileInfo;
import edu.cornell.mannlib.vitro.webapp.reasoner.SimpleReasoner; import edu.cornell.mannlib.vitro.webapp.reasoner.SimpleReasoner;
import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapper; import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapper;
@ -144,11 +142,8 @@ public class IndividualController extends FreemarkerHttpServlet {
} }
private void cleanUpSession(VitroRequest vreq) { private void cleanUpSession(VitroRequest vreq) {
// Session cleanup: any time we are at an entity page we shouldn't have an editing config or submission // We should not remove edit configurations from the session because the user
HttpSession session = vreq.getSession(); // may resubmit the forms via the back button and the system is setup to handle this.
session.removeAttribute("editjson");
EditConfiguration.clearAllConfigsInSession(session);
EditSubmission.clearAllEditSubmissionsInSession(session);
} }
private Map<String, Object> getVerbosePropertyValues(VitroRequest vreq) { private Map<String, Object> getVerbosePropertyValues(VitroRequest vreq) {

View file

@ -11,8 +11,8 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; 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.controller.freemarker.responsevalues.TemplateResponseValues;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
import freemarker.template.ObjectWrapper; import freemarker.template.ObjectWrapper;
import freemarker.template.TemplateModelException; import freemarker.template.TemplateModelException;

View file

@ -13,7 +13,6 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; 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.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration;
/** /**
* Freemarker controller and template samples. * Freemarker controller and template samples.

View file

@ -9,7 +9,7 @@ import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
import freemarker.template.Configuration; import freemarker.template.Configuration;
import freemarker.template.Template; import freemarker.template.Template;
import freemarker.template.TemplateException; import freemarker.template.TemplateException;

View file

@ -25,9 +25,9 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
import freemarker.template.Configuration; import freemarker.template.Configuration;
/** /**

View file

@ -6,8 +6,8 @@ import java.util.Map;
import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Literal;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
import freemarker.template.Configuration; import freemarker.template.Configuration;
/** /**
* All classes that implement this interface must have a public constructor that * All classes that implement this interface must have a public constructor that

View file

@ -19,7 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.BasicValidation; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.BasicValidation;
public class IndividualDataPropertyStatementProcessor implements ChangeListener { public class IndividualDataPropertyStatementProcessor implements ChangeListener {

View file

@ -1,9 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing;
import java.util.Map;
public interface N3Validator {
public Map<String,String> validate(EditConfiguration editConfig, EditSubmission editSub);
}

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@ -33,6 +33,12 @@ import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.UserToIndIdentifierFactory; import edu.cornell.mannlib.vitro.webapp.auth.identifier.UserToIndIdentifierFactory;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral; import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.EditSubmissionPreprocessor;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.N3Validator;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.SparqlEvaluate;
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch; import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
/** /**

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -187,8 +187,8 @@ public class SelectListGenerator {
for( Individual ind : individuals ){ for( Individual ind : individuals ){
String uri = ind.getURI(); String uri = ind.getURI();
if( uri != null ){ if( uri != null ){
optionsMap.put(uri,ind.getName().trim()); optionsMap.put(uri,ind.getName().trim());
++optionsCount; ++optionsCount;
} }
} }
@ -212,13 +212,13 @@ public class SelectListGenerator {
// individuals asserted in subclasses // individuals asserted in subclasses
boolean inferenceAvailable = false; boolean inferenceAvailable = false;
if (wDaoFact instanceof WebappDaoFactoryJena) { if (wDaoFact instanceof WebappDaoFactoryJena) {
PelletListener pl = ((WebappDaoFactoryJena) wDaoFact) PelletListener pl = ((WebappDaoFactoryJena) wDaoFact)
.getPelletListener(); .getPelletListener();
if (pl != null && pl.isConsistent() if (pl != null && pl.isConsistent()
&& !pl.isInErrorState() && !pl.isInErrorState()
&& !pl.isReasoning()) { && !pl.isReasoning()) {
inferenceAvailable = true; inferenceAvailable = true;
} }
} }
VClass vclass = wDaoFact.getVClassDao().getVClassByURI( vclassUri ); VClass vclass = wDaoFact.getVClassDao().getVClassByURI( vclassUri );
@ -227,41 +227,41 @@ public class SelectListGenerator {
optionsMap.put("", "Could not find class " + vclassUri); optionsMap.put("", "Could not find class " + vclassUri);
}else{ }else{
Map<String, Individual> individualMap = new HashMap<String, Individual>(); Map<String, Individual> individualMap = new HashMap<String, Individual>();
for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(vclass.getURI(),-1,-1)) { for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(vclass.getURI(),-1,-1)) {
if (ind.getURI() != null) { if (ind.getURI() != null) {
individualMap.put(ind.getURI(), ind); individualMap.put(ind.getURI(), ind);
} }
} }
if (!inferenceAvailable) { if (!inferenceAvailable) {
for (String subclassURI : wDaoFact.getVClassDao().getAllSubClassURIs(vclass.getURI())) { for (String subclassURI : wDaoFact.getVClassDao().getAllSubClassURIs(vclass.getURI())) {
for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(subclassURI,-1,-1)) { for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(subclassURI,-1,-1)) {
if (ind.getURI() != null) { if (ind.getURI() != null) {
individualMap.put(ind.getURI(), ind); individualMap.put(ind.getURI(), ind);
} }
} }
} }
} }
List<Individual> individuals = new ArrayList<Individual>(); List<Individual> individuals = new ArrayList<Individual>();
individuals.addAll(individualMap.values()); individuals.addAll(individualMap.values());
Collections.sort(individuals); Collections.sort(individuals);
for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(vclass.getURI(),-1,-1)) { for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(vclass.getURI(),-1,-1)) {
if (ind.getURI() != null) { if (ind.getURI() != null) {
individualMap.put(ind.getURI(), ind); individualMap.put(ind.getURI(), ind);
} }
} }
if (!inferenceAvailable) { if (!inferenceAvailable) {
for (String subclassURI : wDaoFact.getVClassDao().getAllSubClassURIs(vclass.getURI())) { for (String subclassURI : wDaoFact.getVClassDao().getAllSubClassURIs(vclass.getURI())) {
for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(subclassURI,-1,-1)) { for (Individual ind : wDaoFact.getIndividualDao().getIndividualsByVClassURI(subclassURI,-1,-1)) {
if (ind.getURI() != null) { if (ind.getURI() != null) {
individualMap.put(ind.getURI(), ind); individualMap.put(ind.getURI(), ind);
} }
} }
} }
} }
individuals.addAll(individualMap.values()); individuals.addAll(individualMap.values());
@ -274,8 +274,8 @@ public class SelectListGenerator {
for( Individual ind : individuals ) { for( Individual ind : individuals ) {
String uri = ind.getURI(); String uri = ind.getURI();
if( uri != null ) { if( uri != null ) {
optionsMap.put(uri,ind.getName().trim()); optionsMap.put(uri,ind.getName().trim());
++optionsCount; ++optionsCount;
} }
} }
} }

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;

View file

@ -0,0 +1,21 @@
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
import javax.servlet.http.HttpSession;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
/**
* Generates the edit configuration for a default property form.
*
*/
public class DefaultPropertyFormGenerator implements EditConfigurationGenerator {
@Override
public EditConfiguration getEditConfiguration(VitroRequest vreq,
HttpSession session) {
// TODO Generate a edit conf for the default object property form and return it.
return null;
}
}

View file

@ -0,0 +1,10 @@
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
import javax.servlet.http.HttpSession;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
public interface EditConfigurationGenerator {
public EditConfiguration getEditConfiguration( VitroRequest vreq, HttpSession session );
}

View file

@ -1,6 +1,9 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
public abstract class BaseEditSubmissionPreprocessor implements public abstract class BaseEditSubmissionPreprocessor implements
EditSubmissionPreprocessor { EditSubmissionPreprocessor {

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
import java.util.Map; import java.util.Map;
@ -11,6 +11,10 @@ import org.apache.commons.logging.LogFactory;
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.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
public class CreateLabelFromNameFields extends BaseEditSubmissionPreprocessor { public class CreateLabelFromNameFields extends BaseEditSubmissionPreprocessor {
private static final Log log = LogFactory.getLog(CreateLabelFromNameFields.class.getName()); private static final Log log = LogFactory.getLog(CreateLabelFromNameFields.class.getName());

View file

@ -1,9 +1,12 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ResourceFactory; import com.hp.hpl.jena.rdf.model.ResourceFactory;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**

View file

@ -1,6 +1,8 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
public interface EditSubmissionPreprocessor { public interface EditSubmissionPreprocessor {
public void preprocess(EditSubmission editSubmission); public void preprocess(EditSubmission editSubmission);

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Model;

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -24,6 +24,9 @@ import com.hp.hpl.jena.rdf.model.ModelFactory;
import edu.cornell.mannlib.vitro.webapp.beans.Datatype; import edu.cornell.mannlib.vitro.webapp.beans.Datatype;
import edu.cornell.mannlib.vitro.webapp.dao.jena.DatatypeDaoJena; import edu.cornell.mannlib.vitro.webapp.dao.jena.DatatypeDaoJena;
import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena; import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
/** /**
* User: bdc34 * User: bdc34

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
@ -15,6 +15,8 @@ import com.hp.hpl.jena.rdf.model.Literal;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary.Precision; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary.Precision;
import edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision; import edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
public class DateTimeIntervalValidation implements N3Validator { public class DateTimeIntervalValidation implements N3Validator {
private static Log log = LogFactory.getLog(DateTimeIntervalValidation.class); private static Log log = LogFactory.getLog(DateTimeIntervalValidation.class);

View file

@ -0,0 +1,12 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators;
import java.util.Map;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
public interface N3Validator {
public Map<String,String> validate(EditConfiguration editConfig, EditSubmission editSub);
}

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
@ -11,6 +11,9 @@ import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Literal;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
public class StartDateBeforeEndDate implements N3Validator { public class StartDateBeforeEndDate implements N3Validator {
private String startFieldName; private String startFieldName;
private String endFieldName; private String endFieldName;

View file

@ -1,12 +1,15 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Literal;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
public class StartYearBeforeEndYear implements N3Validator { public class StartYearBeforeEndYear implements N3Validator {
private String startFieldName; private String startFieldName;
private String endFieldName; private String endFieldName;

View file

@ -2,6 +2,9 @@
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -12,8 +15,9 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; 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.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils; import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
/** /**
@ -26,11 +30,11 @@ import edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils;
* form. Try adding the behavior logic to the code that generates the * form. Try adding the behavior logic to the code that generates the
* EditConfiguration for the form. * EditConfiguration for the form.
*/ */
public class EditRequestDispatch extends FreemarkerHttpServlet { public class EditRequestDispatchController extends FreemarkerHttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static Log log = LogFactory.getLog(EditRequestDispatch.class); public static Log log = LogFactory.getLog(EditRequestDispatchController.class);
final String DEFAULT_OBJ_FORM = "defaultObjPropForm.jsp"; final String DEFAULT_OBJ_FORM = "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.DefaultPropertyFormGenerator";
final String DEFAULT_ERROR_FORM = "error.jsp"; final String DEFAULT_ERROR_FORM = "error.jsp";
final String DEFAULT_ADD_INDIVIDUAL = "defaultAddMissingIndividualForm.jsp"; final String DEFAULT_ADD_INDIVIDUAL = "defaultAddMissingIndividualForm.jsp";
@Override @Override
@ -117,15 +121,12 @@ public class EditRequestDispatch extends FreemarkerHttpServlet {
// Keep track of what form we are using so it can be returned to after a failed validation // Keep track of what form we are using so it can be returned to after a failed validation
// I'd like to get this from the request but sometimes that doesn't work well, internal forwards etc. // I'd like to get this from the request but sometimes that doesn't work well, internal forwards etc.
String url = "/edit/editRequestDispatch.jsp"; //TODO: this needs to be the same as the mapping in web.xml
vreq.setAttribute("formUrl", url + "?" + vreq.getQueryString()); vreq.setAttribute("formUrl", "/edit/editRequest?" + vreq.getQueryString());
//this are only used by the old jsp forms
vreq.setAttribute("preForm", "/edit/formPrefix.jsp");
vreq.setAttribute("postForm", "/edit/formSuffix.jsp");
if ("delete".equals(command)) { if ("delete".equals(command)) {
// %><jsp:forward page="/edit/forms/propDelete.jsp"/><% //TODO: delete command is used with the defualt delete form
//maybe it doesn't need to be in here?
return null; return null;
} }
@ -138,6 +139,7 @@ public class EditRequestDispatch extends FreemarkerHttpServlet {
// so maybe this logic shouldn't be here? // so maybe this logic shouldn't be here?
if ( isEditOfExistingStmt && (wdf.getObjectPropertyDao().skipEditForm(predicateUri)) ) { if ( isEditOfExistingStmt && (wdf.getObjectPropertyDao().skipEditForm(predicateUri)) ) {
log.debug("redirecting to object for predicate " + predicateUri); log.debug("redirecting to object for predicate " + predicateUri);
//TODO: implement this feature
// %><c:redirect url="/individual"> // %><c:redirect url="/individual">
// <c:param name="uri" value="${param.objectUri}"/> // <c:param name="uri" value="${param.objectUri}"/>
// <c:param name="relatedSubjectUri" value="${param.subjectUri}"/> // <c:param name="relatedSubjectUri" value="${param.subjectUri}"/>
@ -146,19 +148,15 @@ public class EditRequestDispatch extends FreemarkerHttpServlet {
// <% // <%
return null; return null;
} }
String form = DEFAULT_OBJ_FORM; //use default object property form if nothing else works
String editConfGeneratorName = DEFAULT_OBJ_FORM;
// *** handle the case where the form is specified as a request parameter *** // *** handle the case where the form is specified as a request parameter ***
if( predicateUri == null && ( formParam != null && !formParam.isEmpty()) ){ if( predicateUri == null && ( formParam != null && !formParam.isEmpty()) ){
//case where a form was passed as a http parameter //form parameter must be a fully qualified java class name of a EditConfigurationGenerator implementation.
form = formParam; editConfGeneratorName = formParam;
vreq.setAttribute("form", form);
//followed by <jsp:foward page="/edit/forms/${form}"/>
return null;
} }
// *** handle the case where the form is decided by the predicate parameter *** // *** handle the case where the form is decided by the predicate parameter ***
@ -170,34 +168,48 @@ public class EditRequestDispatch extends FreemarkerHttpServlet {
ObjectProperty objectProp = wdf.getObjectPropertyDao().getObjectPropertyByURI(predicateUri); ObjectProperty objectProp = wdf.getObjectPropertyDao().getObjectPropertyByURI(predicateUri);
if( objectProp != null ){ if( objectProp != null ){
vreq.setAttribute("predicate", objectProp); vreq.setAttribute("predicate", objectProp);
//custom entry form use to be a jsp but it should now be a fully qualified java class name of a
//EditConfigurationGenerator implementation.
customForm = objectProp.getCustomEntryForm(); customForm = objectProp.getCustomEntryForm();
if (customForm != null && customForm.length() > 0) {
//if there is a custom form on the predicate, use that
editConfGeneratorName = objectProp.getCustomEntryForm();
}
} }
// Forward to create new is part of the default object property form // Forward to create new is part of the default object property form
// it should be handled in that form's EditConfiguration, not here. // it should be handled in that form's EditConfiguration, not here.
// The code that sets up the EditConfiguration should decide on // The code that sets up the EditConfiguration should decide on
// different configurations and templates to use based on isForwardToCreateNew. // different configurations and templates to use based on isForwardToCreateNew.
//TODO: make sure that forward to create new works on the default object property form
if( isFowardToCreateNew(vreq, objectProp, command)){ if( isFowardToCreateNew(vreq, objectProp, command)){
return handleForwardToCreateNew(vreq, command, objectProp, isEditOfExistingStmt); return handleForwardToCreateNew(vreq, command, objectProp, isEditOfExistingStmt);
} }
//Offer create new and select from existing are ignored if there is a custom form vreq.setAttribute("form", editConfGeneratorName);
if (customForm != null && customForm.length() > 0) {
//if there is a custom form on the predicate, use that
form = objectProp.getCustomEntryForm();
} else {
//if it is nothing special, then use the default object property form
form = DEFAULT_OBJ_FORM ;
}
vreq.setAttribute("form", form);
// Now here we can no longer forward to a JSP. /**** make the edit configuration ***/
// Somehow we need to be able to specify some java code that generates the EditConfiguration editConfig = makeEditConfiguration( editConfGeneratorName, vreq, session);
// EditConfiguration and the do the freemarker template merge.
//what template?
return null; String template = editConfig.getTemplate();
//what goes in the map for templates?
Map<String,Object> templateData = new HashMap<String,Object>();
templateData.put("editConfiguration", editConfig);
return new TemplateResponseValues(editConfig.getTemplate(), templateData);
} }
private EditConfiguration makeEditConfiguration(
String editConfGeneratorName, VitroRequest vreq, HttpSession session) {
//TODO: instianciate generator obj
//TODO: call getEditConfiguration()
return null;
}
/* /*
Forward to create new is part of the default object property form Forward to create new is part of the default object property form
it should be handled in that form's EditConfiguration, not here. it should be handled in that form's EditConfiguration, not here.

View file

@ -1,528 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.shared.Lock;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper.TemplateProcessingException;
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.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelChangePreprocessor;
/**
* This servlet will process EditConfigurations with query parameters
* to perform an edit.
*
* TODO: rename this class ProcessN3Edit
*/
public class ProcessRdfForm extends FreemarkerHttpServlet{
private Log log = LogFactory.getLog(ProcessRdfForm.class);
//bdc34: this is likely to become a servlet instead of a jsp.
// You can get a reference to the servlet from the context.
// this will need to be converted from a jsp to something else
public static final String POST_EDIT_CLEANUP_JSP = "postEditCleanUp.jsp";
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException{
doGet(request, response);
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException{
VitroRequest vreq = new VitroRequest(request);
//get the EditConfiguration
EditConfiguration configuration = getEditConfiguration(request);
if(configuration == null){
doEditConfigNotFound( vreq, response);
return;
}
//get the EditSubmission
EditSubmission submission = new EditSubmission(vreq.getParameterMap(), configuration);
EditSubmission.putEditSubmissionInSession(request.getSession(), submission);
boolean hasErrors = processValidationErrors(vreq, configuration, submission, response);
if( hasErrors)
return; //processValidationErrors() already forwarded to redisplay the form with validation messages
// get the models to work with in case the write model and query model are not the defaults
OntModel queryModel = configuration.getQueryModelSelector().getModel(request, getServletContext());
OntModel writeModel = configuration.getWriteModelSelector().getModel(request,getServletContext());
AdditionsAndRetractions changes;
if(configuration.isUpdate()){
changes = editExistingResource(configuration, submission);
}else{
changes = createNewResource(configuration, submission);
}
changes = getMinimalChanges( changes );
if( configuration.isUseDependentResourceDelete() )
changes = addDependentDeletes(changes, queryModel);
preprocessModels(changes, configuration, vreq);
applyChangesToWriteModel(changes, queryModel, writeModel, EditN3Utils.getEditorUri(vreq) );
//Here we are trying to get the entity to return to URL,
//Maybe this should be in POST_EDIT_CLEANUP?
if( configuration.getEntityToReturnTo() != null ){
request.setAttribute("entityToReturnTo", substitueForURL( configuration, submission));
}
doPostEdit(vreq,response);
}
/**
* Execute any modelChangePreprocessors in the editConfiguration;
* Move to EditN3Utils
*/
protected void preprocessModels(AdditionsAndRetractions changes, EditConfiguration editConfiguration, VitroRequest request){
List<ModelChangePreprocessor> modelChangePreprocessors = editConfiguration.getModelChangePreprocessors();
if ( modelChangePreprocessors != null ) {
for ( ModelChangePreprocessor pp : modelChangePreprocessors ) {
//these work by side effect
pp.preprocess( changes.getRetractions(), changes.getAdditions(), request );
}
}
}
//Move to EditN3Utils
protected AdditionsAndRetractions getMinimalChanges( AdditionsAndRetractions changes ){
//make a model with all the assertions and a model with all the
//retractions, do a diff on those and then only add those to the jenaOntModel
Model allPossibleAssertions = changes.getAdditions();
Model allPossibleRetractions = changes.getRetractions();
//find the minimal change set
Model assertions = allPossibleAssertions.difference( allPossibleRetractions );
Model retractions = allPossibleRetractions.difference( allPossibleAssertions );
return new AdditionsAndRetractions(assertions,retractions);
}
protected AdditionsAndRetractions addDependentDeletes( AdditionsAndRetractions changes, Model queryModel){
//Add retractions for dependent resource delete if that is configured and
//if there are any dependent resources.
Model depResRetractions =
DependentResourceDeleteJena
.getDependentResourceDeleteForChange(changes.getAdditions(),changes.getRetractions(),queryModel);
changes.getRetractions().add(depResRetractions);
return changes;
}
protected void applyChangesToWriteModel(AdditionsAndRetractions changes, OntModel queryModel, OntModel writeModel, String editorUri) {
//side effect: modify the write model with the changes
Lock lock = null;
try{
lock = writeModel.getLock();
lock.enterCriticalSection(Lock.WRITE);
writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,true));
writeModel.add( changes.getAdditions() );
writeModel.remove( changes.getRetractions() );
}catch(Throwable t){
log.error("error adding edit change n3required model to in memory model \n"+ t.getMessage() );
}finally{
writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,false));
lock.leaveCriticalSection();
}
}
private EditConfiguration getEditConfiguration(HttpServletRequest request) {
HttpSession session = request.getSession();
EditConfiguration editConfiguration = EditConfiguration.getConfigFromSession(session, request);
return editConfiguration;
}
@SuppressWarnings("static-access")
private AdditionsAndRetractions createNewResource(EditConfiguration editConfiguration , EditSubmission submission){
List<String> errorMessages = new ArrayList<String>();
EditN3Generator n3Subber = editConfiguration.getN3Generator();
if(log.isDebugEnabled()){
log.debug("creating a new relation " + editConfiguration.getPredicateUri());
}
//handle creation of a new object property and maybe a resource
List<String> n3Required = editConfiguration.getN3Required();
List<String> n3Optional = editConfiguration.getN3Optional();
/* ********** URIs and Literals on Form/Parameters *********** */
//sub in resource uris off form
n3Required = n3Subber.subInUris(submission.getUrisFromForm(), n3Required);
n3Optional = n3Subber.subInUris(submission.getUrisFromForm(), n3Optional);
if(log.isDebugEnabled()) {
Utilities.logRequiredOpt("substituted in URIs off from ",n3Required,n3Optional);
}
//sub in literals from form
n3Required = n3Subber.subInLiterals(submission.getLiteralsFromForm(), n3Required);
n3Optional = n3Subber.subInLiterals(submission.getLiteralsFromForm(), n3Optional);
if(log.isDebugEnabled()) {
Utilities.logRequiredOpt("substituted in literals off from ",n3Required,n3Optional);
}
/* ****************** URIs and Literals in Scope ************** */
n3Required = n3Subber.subInUris( editConfiguration.getUrisInScope(), n3Required);
n3Optional = n3Subber.subInUris( editConfiguration.getUrisInScope(), n3Optional);
if(log.isDebugEnabled()) {
Utilities.logRequiredOpt("substituted in URIs from scope ",n3Required,n3Optional);
}
n3Required = n3Subber.subInLiterals( editConfiguration.getLiteralsInScope(), n3Required);
n3Optional = n3Subber.subInLiterals( editConfiguration.getLiteralsInScope(), n3Optional);
if(log.isDebugEnabled()) {
Utilities.logRequiredOpt("substituted in Literals from scope ",n3Required,n3Optional);
}
//deal with required N3
List<Model> requiredNewModels = new ArrayList<Model>();
for(String n3 : n3Required){
try{
Model model = ModelFactory.createDefaultModel();
StringReader reader = new StringReader(n3);
model.read(reader, "", "N3");
requiredNewModels.add(model);
} catch(Throwable t){
errorMessages.add("error processing required n3 string \n" + t.getMessage() + '\n' + "n3: \n" + n3);
}
}
if(!errorMessages.isEmpty()){
String error = "problems processing required n3: \n";
for(String errorMsg: errorMessages){
error += errorMsg + '\n';
}
if(log.isDebugEnabled()){
log.debug(error);
}
}
List<Model> requiredAssertions = requiredNewModels;
//deal with optional N3
List<Model> optionalNewModels = new ArrayList<Model>();
for(String n3 : n3Optional){
try{
Model model = ModelFactory.createDefaultModel();
StringReader reader = new StringReader(n3);
model.read(reader, "", "N3");
optionalNewModels.add(model);
}catch(Throwable t){
//if an optional N3 block fails to parse it will be ignored
//this is what is meant by optional.
}
}
requiredAssertions.addAll( optionalNewModels );
return new AdditionsAndRetractions(requiredAssertions, Collections.<Model>emptyList());
}
@SuppressWarnings("static-access")
private AdditionsAndRetractions editExistingResource(EditConfiguration editConfiguration, EditSubmission submission) {
Map<String, List<String>> fieldAssertions = Utilities.fieldsToAssertionMap(editConfiguration.getFields());
Map<String, List<String>> fieldRetractions = Utilities.fieldsToRetractionMap(editConfiguration.getFields());
EditN3Generator n3Subber = editConfiguration.getN3Generator();
/* ********** URIs and Literals on Form/Parameters *********** */
fieldAssertions = n3Subber.substituteIntoValues(submission.getUrisFromForm(), submission.getLiteralsFromForm(), fieldAssertions);
if(log.isDebugEnabled()) {
Utilities.logAddRetract("substituted in literals from form",fieldAssertions,fieldRetractions);
}
/* ****************** URIs and Literals in Scope ************** */
fieldAssertions = n3Subber.substituteIntoValues(editConfiguration.getUrisInScope(), editConfiguration.getLiteralsInScope(), fieldAssertions );
fieldRetractions = n3Subber.substituteIntoValues(editConfiguration.getUrisInScope(), editConfiguration.getLiteralsInScope(), fieldRetractions);
if(log.isDebugEnabled()) {
Utilities.logAddRetract("substituted in URIs and Literals from scope",fieldAssertions,fieldRetractions);
}
//do edits ever need new resources? (YES)
/* Map<String,String> varToNewResource = newToUriMap(editConfiguration.getNewResources(),wdf);
fieldAssertions = n3Subber.substituteIntoValues(varToNewResource, null, fieldAssertions);
if(log.isDebugEnabled()) {
Utilities.logAddRetract("substituted in URIs for new resources",fieldAssertions,fieldRetractions);
}
entToReturnTo = n3Subber.subInUris(varToNewResource,entToReturnTo);
*/
//editing an existing statement
List<Model> requiredFieldAssertions = new ArrayList<Model>();
List<Model> requiredFieldRetractions = new ArrayList<Model>();
List<String> errorMessages = new ArrayList<String>();
for(String fieldName : fieldAssertions.keySet()){
List<String> assertions = fieldAssertions.get(fieldName);
List<String> retractions = fieldRetractions.get(fieldName);
for(String n3: assertions){
try{
Model model = ModelFactory.createDefaultModel();
StringReader reader = new StringReader(n3);
model.read(reader, "", "N3");
}catch(Throwable t){
String errMsg = "error processing N3 assertion string from field " + fieldName + "\n" +
t.getMessage() + '\n' + "n3: \n" + n3;
errorMessages.add(errMsg);
if(log.isDebugEnabled()){
log.debug(errMsg);
}
}
}
for(String n3 : retractions){
try{
Model model = ModelFactory.createDefaultModel();
StringReader reader = new StringReader(n3);
model.read(reader, "", "N3");
requiredFieldRetractions.add(model);
}catch(Throwable t){
String errMsg = "error processing N3 retraction string from field " + fieldName + "\n"+
t.getMessage() + '\n' + "n3: \n" + n3;
errorMessages.add(errMsg);
if(log.isDebugEnabled()){
log.debug(errMsg);
}
}
}
}
return new AdditionsAndRetractions(requiredFieldAssertions, requiredFieldRetractions);
}
private void doEditConfigNotFound(VitroRequest request, HttpServletResponse response) {
HashMap<String,Object>map = new HashMap<String,Object>();
map.put("message", "No editing configuration found, cannot process edit.");
ResponseValues values = new TemplateResponseValues("message.ftl", map);
try {
doResponse(request,response,values);
} catch (TemplateProcessingException e) {
log.error("Could not process template for doEditConfigNotFound()",e);
}
}
private boolean processValidationErrors(VitroRequest vreq,
EditConfiguration editConfiguration, EditSubmission submission,
HttpServletResponse response) throws ServletException, IOException {
Map<String, String> errors = submission.getValidationErrors();
if(errors != null && !errors.isEmpty()){
String form = editConfiguration.getFormUrl();
vreq.setAttribute("formUrl", form);
vreq.setAttribute("view", vreq.getParameter("view"));
RequestDispatcher requestDispatcher = vreq.getRequestDispatcher(editConfiguration.getFormUrl());
requestDispatcher.forward(vreq, response);
return true;
}
return false;
}
private void doPostEdit(VitroRequest vreq, HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher requestDispatcher = vreq.getRequestDispatcher(POST_EDIT_CLEANUP_JSP);
requestDispatcher.forward(vreq, response);
}
//Move to EditN3Utils but keep make new uris here
public static class Utilities {
private static Log log = LogFactory.getLog(ProcessRdfForm.class);
static Random random = new Random();
public static Map<String,List<String>> fieldsToAssertionMap( Map<String,Field> fields){
Map<String,List<String>> out = new HashMap<String,List<String>>();
for( String fieldName : fields.keySet()){
Field field = fields.get(fieldName);
List<String> copyOfN3 = new ArrayList<String>();
for( String str : field.getAssertions()){
copyOfN3.add(str);
}
out.put( fieldName, copyOfN3 );
}
return out;
}
public static Map<String,List<String>> fieldsToRetractionMap( Map<String,Field> fields){
Map<String,List<String>> out = new HashMap<String,List<String>>();
for( String fieldName : fields.keySet()){
Field field = fields.get(fieldName);
List<String> copyOfN3 = new ArrayList<String>();
for( String str : field.getRetractions()){
copyOfN3.add(str);
}
out.put( fieldName, copyOfN3 );
}
return out;
}
public static Map<String,String> newToUriMap(Map<String,String> newResources, WebappDaoFactory wdf){
HashMap<String,String> newVarsToUris = new HashMap<String,String>();
HashSet<String> newUris = new HashSet<String>();
for( String key : newResources.keySet()){
String prefix = newResources.get(key);
String uri = makeNewUri(prefix, wdf);
while( newUris.contains(uri) ){
uri = makeNewUri(prefix,wdf);
}
newVarsToUris.put(key,uri);
newUris.add(uri);
}
return newVarsToUris;
}
public static String makeNewUri(String prefix, WebappDaoFactory wdf){
if( prefix == null || prefix.length() == 0 ){
String uri = null;
try{
uri = wdf.getIndividualDao().getUnusedURI(null);
}catch(InsertException ex){
log.error("could not create uri");
}
return uri;
}
String goodURI = null;
int attempts = 0;
while( goodURI == null && attempts < 30 ){
Individual ind = new IndividualImpl();
ind.setURI( prefix + random.nextInt() );
try{
goodURI = wdf.getIndividualDao().getUnusedURI(ind);
}catch(InsertException ex){
log.debug("could not create uri");
}
attempts++;
}
if( goodURI == null )
log.error("could not create uri for prefix " + prefix);
return goodURI;
}
private static boolean logAddRetract(String msg, Map<String,List<String>>add, Map<String,List<String>>retract){
log.debug(msg);
if( add != null ) log.debug( "assertions: " + add.toString() );
if( retract != null ) log.debug( "retractions: " + retract.toString() );
return true;
}
private static boolean logRequiredOpt(String msg, List<String>required, List<String>optional){
log.debug(msg);
if( required != null ) log.debug( "required: " + required.toString() );
if( optional != null ) log.debug( "optional: " + optional.toString() );
return true;
}
}
/**
* This is intended to substitute vars from the EditConfiguration and
* EditSubmission into the URL to return to.
*/
protected String substitueForURL(EditConfiguration configuration, EditSubmission submission){
List<String> entToReturnTo = new ArrayList<String>(1);
entToReturnTo.add(configuration.getEntityToReturnTo());
EditN3Generator n3Subber = configuration.getN3Generator();
// Substitute in URIs from the submission
entToReturnTo = n3Subber.subInUris(submission.getUrisFromForm(), entToReturnTo);
// Substitute in URIs from the scope of the EditConfiguration
entToReturnTo = n3Subber.subInUris(configuration.getUrisInScope(), entToReturnTo);
//The problem is that subInURI will add < and > around URIs for the N3 syntax.
//for the URL to return to, replace < and > from URI additions.
return entToReturnTo.get(0).trim().replaceAll("<","").replaceAll(">","");
}
/**
* This is a data structure to allow a method to return
* a pair of Model objects for additions and retractions.
*
* Move this to its own class
*/
protected class AdditionsAndRetractions {
Model additions;
Model retractions;
public AdditionsAndRetractions(List<Model>adds, List<Model>retractions){
Model allAdds = ModelFactory.createDefaultModel();
Model allRetractions = ModelFactory.createDefaultModel();
for( Model model : adds ) {
allAdds.add( model );
}
for( Model model : retractions ){
allRetractions.add( model );
}
this.setAdditions(allAdds);
this.setRetractions(allRetractions);
}
public AdditionsAndRetractions(Model add, Model retract){
this.additions = add;
this.retractions = retract;
}
public Model getAdditions() {
return additions;
}
public void setAdditions(Model additions) {
this.additions = additions;
}
public Model getRetractions() {
return retractions;
}
public void setRetractions(Model retractions) {
this.retractions = retractions;
}
}
}

View file

@ -0,0 +1,227 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.ontology.OntModel;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper.TemplateProcessingException;
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.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.AdditionsAndRetractions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.ProcessRdfForm;
/**
* This servlet will process EditConfigurations with query parameters
* to perform an edit.
*
* TODO: rename this class ProcessN3Edit
*/
public class ProcessRdfFormController extends FreemarkerHttpServlet{
private Log log = LogFactory.getLog(ProcessRdfFormController.class);
//bdc34: this is likely to become a servlet instead of a jsp.
// You can get a reference to the servlet from the context.
// this will need to be converted from a jsp to something else
public static final String POST_EDIT_CLEANUP_JSP = "postEditCleanUp.jsp";
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException{
doGet(request, response);
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException{
VitroRequest vreq = new VitroRequest(request);
//get the EditConfiguration
EditConfiguration configuration = getEditConfiguration(request);
if(configuration == null){
doEditConfigNotFound( vreq, response);
return;
}
//get the EditSubmission
EditSubmission submission = new EditSubmission(vreq.getParameterMap(), configuration);
EditSubmission.putEditSubmissionInSession(request.getSession(), submission);
boolean hasErrors = doValidationErrors(vreq, configuration, submission, response);
if( hasErrors)
return; //processValidationErrors() already forwarded to redisplay the form with validation messages
// get the models to work with in case the write model and query model are not the defaults
OntModel queryModel = configuration.getQueryModelSelector().getModel(request, getServletContext());
OntModel writeModel = configuration.getWriteModelSelector().getModel(request,getServletContext());
AdditionsAndRetractions changes;
if(configuration.isUpdate()){
changes = ProcessRdfForm.editExistingResource(configuration, submission);
}else{
changes = ProcessRdfForm.createNewResource(configuration, submission);
}
if( configuration.isUseDependentResourceDelete() )
changes = ProcessRdfForm.addDependentDeletes(changes, queryModel);
ProcessRdfForm.preprocessModels(changes, configuration, vreq);
ProcessRdfForm.applyChangesToWriteModel(changes, queryModel, writeModel, EditN3Utils.getEditorUri(vreq) );
//Here we are trying to get the entity to return to URL,
//Maybe this should be in POST_EDIT_CLEANUP?
if( configuration.getEntityToReturnTo() != null ){
request.setAttribute("entityToReturnTo", ProcessRdfForm.substitueForURL( configuration, submission));
}
doPostEdit(vreq,response);
}
private EditConfiguration getEditConfiguration(HttpServletRequest request) {
HttpSession session = request.getSession();
EditConfiguration editConfiguration = EditConfiguration.getConfigFromSession(session, request);
return editConfiguration;
}
private void doEditConfigNotFound(VitroRequest request, HttpServletResponse response) {
HashMap<String,Object>map = new HashMap<String,Object>();
map.put("message", "No editing configuration found, cannot process edit.");
ResponseValues values = new TemplateResponseValues("message.ftl", map);
try {
doResponse(request,response,values);
} catch (TemplateProcessingException e) {
log.error("Could not process template for doEditConfigNotFound()",e);
}
}
private boolean doValidationErrors(VitroRequest vreq,
EditConfiguration editConfiguration, EditSubmission submission,
HttpServletResponse response) throws ServletException, IOException {
Map<String, String> errors = submission.getValidationErrors();
if(errors != null && !errors.isEmpty()){
String form = editConfiguration.getFormUrl();
vreq.setAttribute("formUrl", form);
vreq.setAttribute("view", vreq.getParameter("view"));
RequestDispatcher requestDispatcher = vreq.getRequestDispatcher(editConfiguration.getFormUrl());
requestDispatcher.forward(vreq, response);
return true;
}
return false;
}
private void doPostEdit(VitroRequest vreq, HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher requestDispatcher = vreq.getRequestDispatcher(POST_EDIT_CLEANUP_JSP);
requestDispatcher.forward(vreq, response);
}
//Move to EditN3Utils but keep make new uris here
public static class Utilities {
private static Log log = LogFactory.getLog(ProcessRdfFormController.class);
static Random random = new Random();
public static Map<String,List<String>> fieldsToAssertionMap( Map<String,Field> fields){
Map<String,List<String>> out = new HashMap<String,List<String>>();
for( String fieldName : fields.keySet()){
Field field = fields.get(fieldName);
List<String> copyOfN3 = new ArrayList<String>();
for( String str : field.getAssertions()){
copyOfN3.add(str);
}
out.put( fieldName, copyOfN3 );
}
return out;
}
public static Map<String,List<String>> fieldsToRetractionMap( Map<String,Field> fields){
Map<String,List<String>> out = new HashMap<String,List<String>>();
for( String fieldName : fields.keySet()){
Field field = fields.get(fieldName);
List<String> copyOfN3 = new ArrayList<String>();
for( String str : field.getRetractions()){
copyOfN3.add(str);
}
out.put( fieldName, copyOfN3 );
}
return out;
}
public static Map<String,String> newToUriMap(Map<String,String> newResources, WebappDaoFactory wdf){
HashMap<String,String> newVarsToUris = new HashMap<String,String>();
HashSet<String> newUris = new HashSet<String>();
for( String key : newResources.keySet()){
String prefix = newResources.get(key);
String uri = makeNewUri(prefix, wdf);
while( newUris.contains(uri) ){
uri = makeNewUri(prefix,wdf);
}
newVarsToUris.put(key,uri);
newUris.add(uri);
}
return newVarsToUris;
}
public static String makeNewUri(String prefix, WebappDaoFactory wdf){
if( prefix == null || prefix.length() == 0 ){
String uri = null;
try{
uri = wdf.getIndividualDao().getUnusedURI(null);
}catch(InsertException ex){
log.error("could not create uri");
}
return uri;
}
String goodURI = null;
int attempts = 0;
while( goodURI == null && attempts < 30 ){
Individual ind = new IndividualImpl();
ind.setURI( prefix + random.nextInt() );
try{
goodURI = wdf.getIndividualDao().getUnusedURI(ind);
}catch(InsertException ex){
log.debug("could not create uri");
}
attempts++;
}
if( goodURI == null )
log.error("could not create uri for prefix " + prefix);
return goodURI;
}
}
}

View file

@ -0,0 +1,52 @@
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit;
import java.util.List;
import java.util.Map;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
/**
* This is a data structure to allow a method to return
* a pair of Model objects for additions and retractions.
*
* Move this to its own class
*/
public class AdditionsAndRetractions {
Model additions;
Model retractions;
public AdditionsAndRetractions(List<Model>adds, List<Model>retractions){
Model allAdds = ModelFactory.createDefaultModel();
Model allRetractions = ModelFactory.createDefaultModel();
for( Model model : adds ) {
allAdds.add( model );
}
for( Model model : retractions ){
allRetractions.add( model );
}
this.setAdditions(allAdds);
this.setRetractions(allRetractions);
}
public AdditionsAndRetractions(Model add, Model retract){
this.additions = add;
this.retractions = retract;
}
public Model getAdditions() {
return additions;
}
public void setAdditions(Model additions) {
this.additions = additions;
}
public Model getRetractions() {
return retractions;
}
public void setRetractions(Model retractions) {
this.retractions = retractions;
}
}

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
@ -19,6 +19,8 @@ import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.vocabulary.XSD; import com.hp.hpl.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
/** /**
* Builds the N3 strings for the given EditConfiguration, model * Builds the N3 strings for the given EditConfiguration, model
* and EditSubmission. Main responsibility is the proper substitution * and EditSubmission. Main responsibility is the proper substitution
@ -107,7 +109,7 @@ public class EditN3Generator {
* references, Matcher.quoteReplacement() serves the purpose. * references, Matcher.quoteReplacement() serves the purpose.
* *
*/ */
protected String subInLiterals(String var, Literal literal, String target){ public String subInLiterals(String var, Literal literal, String target){
String varRegex = "\\?" + var + "(?=\\.\\p{Space}|\\p{Space})"; String varRegex = "\\?" + var + "(?=\\.\\p{Space}|\\p{Space})";
if (target==null ) { if (target==null ) {
log.error("subInLiterals was passed a null target"); log.error("subInLiterals was passed a null target");

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -16,18 +16,17 @@ import edu.cornell.mannlib.vitro.webapp.auth.identifier.IsUser;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers; import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers;
public class EditN3Utils { public class EditN3Utils {
/** Several places could give an editor URI. Return the first one. */
public static String getEditorUri(HttpServletRequest request) {
IdentifierBundle ids = RequestIdentifiers.getIdBundleForRequest(request);
/** Several places could give an editor URI. Return the first one. */ List<String> uris = new ArrayList<String>();
public static String getEditorUri(HttpServletRequest request) { uris.addAll(IsUser.getUserUris(ids));
IdentifierBundle ids = RequestIdentifiers.getIdBundleForRequest(request); uris.addAll(HasAssociatedIndividual.getIndividualUris(ids));
uris.addAll(HasRoleLevel.getRoleLevelUris(ids));
List<String> uris = new ArrayList<String>(); uris.add("Unknown N3 Editor");
uris.addAll(IsUser.getUserUris(ids)); return uris.get(0);
uris.addAll(HasAssociatedIndividual.getIndividualUris(ids)); }
uris.addAll(HasRoleLevel.getRoleLevelUris(ids));
uris.add("Unknown N3 Editor");
return uris.get(0);
}
/** /**
* Strips from a string any characters that are not valid in XML 1.0 * Strips from a string any characters that are not valid in XML 1.0

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -29,6 +29,10 @@ import com.hp.hpl.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral; import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral;
import edu.cornell.mannlib.vitro.webapp.edit.elements.EditElement; import edu.cornell.mannlib.vitro.webapp.edit.elements.EditElement;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.BasicValidation;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.N3Validator;
public class EditSubmission { public class EditSubmission {
private String editKey; private String editKey;
@ -209,7 +213,7 @@ public class EditSubmission {
validationErrors.putAll(this.basicValidation.validateFiles( fileItems ) ); validationErrors.putAll(this.basicValidation.validateFiles( fileItems ) );
} }
protected Literal createLiteral(String value, String datatypeUri, String lang) { public Literal createLiteral(String value, String datatypeUri, String lang) {
if( datatypeUri != null ){ if( datatypeUri != null ){
if( "http://www.w3.org/2001/XMLSchema:anyURI".equals(datatypeUri) ){ if( "http://www.w3.org/2001/XMLSchema:anyURI".equals(datatypeUri) ){
try { try {

View file

@ -0,0 +1,277 @@
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.shared.Lock;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller.ProcessRdfFormController.Utilities;
public class ProcessRdfForm {
private static Log log = LogFactory.getLog(ProcessRdfForm.class);
/**
* Execute any modelChangePreprocessors in the editConfiguration;
*
*/
public static void preprocessModels(AdditionsAndRetractions changes, EditConfiguration editConfiguration, VitroRequest request){
List<ModelChangePreprocessor> modelChangePreprocessors = editConfiguration.getModelChangePreprocessors();
if ( modelChangePreprocessors != null ) {
for ( ModelChangePreprocessor pp : modelChangePreprocessors ) {
//these work by side effect
pp.preprocess( changes.getRetractions(), changes.getAdditions(), request );
}
}
}
protected static AdditionsAndRetractions getMinimalChanges( AdditionsAndRetractions changes ){
//make a model with all the assertions and a model with all the
//retractions, do a diff on those and then only add those to the jenaOntModel
Model allPossibleAssertions = changes.getAdditions();
Model allPossibleRetractions = changes.getRetractions();
//find the minimal change set
Model assertions = allPossibleAssertions.difference( allPossibleRetractions );
Model retractions = allPossibleRetractions.difference( allPossibleAssertions );
return new AdditionsAndRetractions(assertions,retractions);
}
public static AdditionsAndRetractions addDependentDeletes( AdditionsAndRetractions changes, Model queryModel){
//Add retractions for dependent resource delete if that is configured and
//if there are any dependent resources.
Model depResRetractions =
DependentResourceDeleteJena
.getDependentResourceDeleteForChange(changes.getAdditions(),changes.getRetractions(),queryModel);
changes.getRetractions().add(depResRetractions);
return changes;
}
public static void applyChangesToWriteModel(AdditionsAndRetractions changes, OntModel queryModel, OntModel writeModel, String editorUri) {
//side effect: modify the write model with the changes
Lock lock = null;
try{
lock = writeModel.getLock();
lock.enterCriticalSection(Lock.WRITE);
writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,true));
writeModel.add( changes.getAdditions() );
writeModel.remove( changes.getRetractions() );
}catch(Throwable t){
log.error("error adding edit change n3required model to in memory model \n"+ t.getMessage() );
}finally{
writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,false));
lock.leaveCriticalSection();
}
}
@SuppressWarnings("static-access")
public static AdditionsAndRetractions createNewResource(EditConfiguration editConfiguration , EditSubmission submission){
List<String> errorMessages = new ArrayList<String>();
EditN3Generator n3Subber = editConfiguration.getN3Generator();
if(log.isDebugEnabled()){
log.debug("creating a new relation " + editConfiguration.getPredicateUri());
}
//handle creation of a new object property and maybe a resource
List<String> n3Required = editConfiguration.getN3Required();
List<String> n3Optional = editConfiguration.getN3Optional();
/* ********** URIs and Literals on Form/Parameters *********** */
//sub in resource uris off form
n3Required = n3Subber.subInUris(submission.getUrisFromForm(), n3Required);
n3Optional = n3Subber.subInUris(submission.getUrisFromForm(), n3Optional);
if(log.isDebugEnabled()) {
logRequiredOpt("substituted in URIs off from ",n3Required,n3Optional);
}
//sub in literals from form
n3Required = n3Subber.subInLiterals(submission.getLiteralsFromForm(), n3Required);
n3Optional = n3Subber.subInLiterals(submission.getLiteralsFromForm(), n3Optional);
if(log.isDebugEnabled()) {
logRequiredOpt("substituted in literals off from ",n3Required,n3Optional);
}
/* ****************** URIs and Literals in Scope ************** */
n3Required = n3Subber.subInUris( editConfiguration.getUrisInScope(), n3Required);
n3Optional = n3Subber.subInUris( editConfiguration.getUrisInScope(), n3Optional);
if(log.isDebugEnabled()) {
logRequiredOpt("substituted in URIs from scope ",n3Required,n3Optional);
}
n3Required = n3Subber.subInLiterals( editConfiguration.getLiteralsInScope(), n3Required);
n3Optional = n3Subber.subInLiterals( editConfiguration.getLiteralsInScope(), n3Optional);
if(log.isDebugEnabled()) {
logRequiredOpt("substituted in Literals from scope ",n3Required,n3Optional);
}
//deal with required N3
List<Model> requiredNewModels = new ArrayList<Model>();
for(String n3 : n3Required){
try{
Model model = ModelFactory.createDefaultModel();
StringReader reader = new StringReader(n3);
model.read(reader, "", "N3");
requiredNewModels.add(model);
} catch(Throwable t){
errorMessages.add("error processing required n3 string \n" + t.getMessage() + '\n' + "n3: \n" + n3);
}
}
if(!errorMessages.isEmpty()){
String error = "problems processing required n3: \n";
for(String errorMsg: errorMessages){
error += errorMsg + '\n';
}
if(log.isDebugEnabled()){
log.debug(error);
}
}
List<Model> requiredAssertions = requiredNewModels;
//deal with optional N3
List<Model> optionalNewModels = new ArrayList<Model>();
for(String n3 : n3Optional){
try{
Model model = ModelFactory.createDefaultModel();
StringReader reader = new StringReader(n3);
model.read(reader, "", "N3");
optionalNewModels.add(model);
}catch(Throwable t){
//if an optional N3 block fails to parse it will be ignored
//this is what is meant by optional.
}
}
requiredAssertions.addAll( optionalNewModels );
return getMinimalChanges(new AdditionsAndRetractions(requiredAssertions, Collections.<Model>emptyList()));
}
@SuppressWarnings("static-access")
public static AdditionsAndRetractions editExistingResource(EditConfiguration editConfiguration, EditSubmission submission) {
Map<String, List<String>> fieldAssertions = Utilities.fieldsToAssertionMap(editConfiguration.getFields());
Map<String, List<String>> fieldRetractions = Utilities.fieldsToRetractionMap(editConfiguration.getFields());
EditN3Generator n3Subber = editConfiguration.getN3Generator();
/* ********** URIs and Literals on Form/Parameters *********** */
fieldAssertions = n3Subber.substituteIntoValues(submission.getUrisFromForm(), submission.getLiteralsFromForm(), fieldAssertions);
if(log.isDebugEnabled()) {
logAddRetract("substituted in literals from form",fieldAssertions,fieldRetractions);
}
/* ****************** URIs and Literals in Scope ************** */
fieldAssertions = n3Subber.substituteIntoValues(editConfiguration.getUrisInScope(), editConfiguration.getLiteralsInScope(), fieldAssertions );
fieldRetractions = n3Subber.substituteIntoValues(editConfiguration.getUrisInScope(), editConfiguration.getLiteralsInScope(), fieldRetractions);
if(log.isDebugEnabled()) {
logAddRetract("substituted in URIs and Literals from scope",fieldAssertions,fieldRetractions);
}
//do edits ever need new resources? (YES)
/* Map<String,String> varToNewResource = newToUriMap(editConfiguration.getNewResources(),wdf);
fieldAssertions = n3Subber.substituteIntoValues(varToNewResource, null, fieldAssertions);
if(log.isDebugEnabled()) {
Utilities.logAddRetract("substituted in URIs for new resources",fieldAssertions,fieldRetractions);
}
entToReturnTo = n3Subber.subInUris(varToNewResource,entToReturnTo);
*/
//editing an existing statement
List<Model> requiredFieldAssertions = new ArrayList<Model>();
List<Model> requiredFieldRetractions = new ArrayList<Model>();
List<String> errorMessages = new ArrayList<String>();
for(String fieldName : fieldAssertions.keySet()){
List<String> assertions = fieldAssertions.get(fieldName);
List<String> retractions = fieldRetractions.get(fieldName);
for(String n3: assertions){
try{
Model model = ModelFactory.createDefaultModel();
StringReader reader = new StringReader(n3);
model.read(reader, "", "N3");
}catch(Throwable t){
String errMsg = "error processing N3 assertion string from field " + fieldName + "\n" +
t.getMessage() + '\n' + "n3: \n" + n3;
errorMessages.add(errMsg);
if(log.isDebugEnabled()){
log.debug(errMsg);
}
}
}
for(String n3 : retractions){
try{
Model model = ModelFactory.createDefaultModel();
StringReader reader = new StringReader(n3);
model.read(reader, "", "N3");
requiredFieldRetractions.add(model);
}catch(Throwable t){
String errMsg = "error processing N3 retraction string from field " + fieldName + "\n"+
t.getMessage() + '\n' + "n3: \n" + n3;
errorMessages.add(errMsg);
if(log.isDebugEnabled()){
log.debug(errMsg);
}
}
}
}
return getMinimalChanges(new AdditionsAndRetractions(requiredFieldAssertions, requiredFieldRetractions));
}
/**
* This is intended to substitute vars from the EditConfiguration and
* EditSubmission into the URL to return to.
*/
public static String substitueForURL(EditConfiguration configuration, EditSubmission submission){
List<String> entToReturnTo = new ArrayList<String>(1);
entToReturnTo.add(configuration.getEntityToReturnTo());
EditN3Generator n3Subber = configuration.getN3Generator();
// Substitute in URIs from the submission
entToReturnTo = n3Subber.subInUris(submission.getUrisFromForm(), entToReturnTo);
// Substitute in URIs from the scope of the EditConfiguration
entToReturnTo = n3Subber.subInUris(configuration.getUrisInScope(), entToReturnTo);
//The problem is that subInURI will add < and > around URIs for the N3 syntax.
//for the URL to return to, replace < and > from URI additions.
return entToReturnTo.get(0).trim().replaceAll("<","").replaceAll(">","");
}
private static boolean logAddRetract(String msg, Map<String,List<String>>add, Map<String,List<String>>retract){
log.debug(msg);
if( add != null ) log.debug( "assertions: " + add.toString() );
if( retract != null ) log.debug( "retractions: " + retract.toString() );
return true;
}
private static boolean logRequiredOpt(String msg, List<String>required, List<String>optional){
log.debug(msg);
if( required != null ) log.debug( "required: " + required.toString() );
if( optional != null ) log.debug( "optional: " + optional.toString() );
return true;
}
}

View file

@ -1,6 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit;
import java.util.List; import java.util.List;

View file

@ -1,10 +1,13 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing; package edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit;
import com.hp.hpl.jena.query.*; import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Resource;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -82,7 +85,7 @@ public class SparqlEvaluate {
// return varToUris; // return varToUris;
// } // }
protected Map<String,Literal> sparqlEvaluateForLiterals( EditConfiguration editConfig, Map<String,String> varToSparql) { public Map<String,Literal> sparqlEvaluateForLiterals( EditConfiguration editConfig, Map<String,String> varToSparql) {
Map<String,String> uriScope = editConfig.getUrisInScope(); Map<String,String> uriScope = editConfig.getUrisInScope();
Map<String,Literal> literalScope = editConfig.getLiteralsInScope(); Map<String,Literal> literalScope = editConfig.getLiteralsInScope();
@ -104,7 +107,7 @@ public class SparqlEvaluate {
return varToLiterals; return varToLiterals;
} }
protected Map<String,String> sparqlEvaluateForUris( EditConfiguration editConfig, Map<String,String>varToSparql) { public Map<String,String> sparqlEvaluateForUris( EditConfiguration editConfig, Map<String,String>varToSparql) {
Map<String,String> uriScope = editConfig.getUrisInScope(); Map<String,String> uriScope = editConfig.getUrisInScope();
Map<String,Literal> literalScope = editConfig.getLiteralsInScope(); Map<String,Literal> literalScope = editConfig.getLiteralsInScope();
@ -133,7 +136,7 @@ public class SparqlEvaluate {
return varToUris; return varToUris;
} }
// protected Map<String,Literal> sparqlEvaluateForAdditionalLiterals( EditConfiguration editConfig) { // public Map<String,Literal> sparqlEvaluateForAdditionalLiterals( EditConfiguration editConfig) {
// Map<String,String> varToSpqrql = editConfig.getSparqlForAdditionalLiteralsInScope(); // Map<String,String> varToSpqrql = editConfig.getSparqlForAdditionalLiteralsInScope();
// Map<String,String> uriScope = editConfig.getUrisInScope(); // Map<String,String> uriScope = editConfig.getUrisInScope();
// Map<String,Literal> literalScope = editConfig.getLiteralsInScope(); // Map<String,Literal> literalScope = editConfig.getLiteralsInScope();
@ -156,7 +159,7 @@ public class SparqlEvaluate {
// return varToLiterals; // return varToLiterals;
// } // }
protected String queryToUri(String querystr){ public String queryToUri(String querystr){
String value = null; String value = null;
QueryExecution qe = null; QueryExecution qe = null;
try{ try{
@ -192,7 +195,7 @@ public class SparqlEvaluate {
} }
protected Literal queryToLiteral(String querystr){ public Literal queryToLiteral(String querystr){
Literal value = null; Literal value = null;
QueryExecution qe = null; QueryExecution qe = null;
try{ try{

View file

@ -2,8 +2,8 @@
package edu.cornell.mannlib.vitro.webapp.web.jsptags; package edu.cornell.mannlib.vitro.webapp.web.jsptags;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;

View file

@ -43,10 +43,10 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerConfigurationLoader; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerConfigurationLoader;
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.SelectListGenerator;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch; import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
import freemarker.template.Configuration; import freemarker.template.Configuration;

View file

@ -2,18 +2,7 @@
package edu.cornell.mannlib.vitro.webapp.web.jsptags; package edu.cornell.mannlib.vitro.webapp.web.jsptags;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration;
import org.apache.commons.lang.StringEscapeUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport; import javax.servlet.jsp.tagext.TagSupport;
import java.util.List;
/** /**
* *

View file

@ -2,12 +2,6 @@
package edu.cornell.mannlib.vitro.webapp.web.jsptags; package edu.cornell.mannlib.vitro.webapp.web.jsptags;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission;
import org.apache.commons.lang.StringEscapeUtils;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport; import javax.servlet.jsp.tagext.TagSupport;
/** /**

View file

@ -19,7 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
public class DataPropertyStatementTemplateModel extends PropertyStatementTemplateModel { public class DataPropertyStatementTemplateModel extends PropertyStatementTemplateModel {

View file

@ -14,9 +14,8 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.SelectListGenerator;
import edu.cornell.mannlib.vitro.webapp.web.directives.WidgetDirective;
import freemarker.core.Environment; import freemarker.core.Environment;
import freemarker.template.SimpleScalar; import freemarker.template.SimpleScalar;

View file

@ -24,9 +24,9 @@ import com.hp.hpl.jena.datatypes.xsd.XSDDateTime;
import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Literal;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
@RunWith(value= Parameterized.class) @RunWith(value= Parameterized.class)

View file

@ -10,6 +10,8 @@ import junit.framework.Assert;
import org.junit.Test; import org.junit.Test;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.BasicValidation;
public class BasicValidationTest { public class BasicValidationTest {
@Test @Test

View file

@ -14,6 +14,8 @@ import org.junit.Test;
import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Literal;
import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral; import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator;
public class EditN3GeneratorTest { public class EditN3GeneratorTest {

View file

@ -11,6 +11,8 @@ import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.vocabulary.RDFS; import com.hp.hpl.jena.vocabulary.RDFS;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils;
public class EditN3UtilsTest { public class EditN3UtilsTest {

View file

@ -14,6 +14,8 @@ import stubs.javax.servlet.http.HttpServletRequestStub;
import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Literal;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass; import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
public class EditSubmissionTest extends AbstractTestClass { public class EditSubmissionTest extends AbstractTestClass {
HttpServletRequestStub request; HttpServletRequestStub request;

View file

@ -19,6 +19,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash;
public class RdfLiteralHashTest { public class RdfLiteralHashTest {

View file

@ -9,6 +9,9 @@ import org.junit.Test;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.ModelFactory;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.SparqlEvaluate;
public class SparqlEvaluateTest { public class SparqlEvaluateTest {
SparqlEvaluate sEval; SparqlEvaluate sEval;

View file

@ -6,8 +6,8 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>

View file

@ -4,7 +4,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>

View file

@ -7,7 +7,7 @@
<%@ page import="com.hp.hpl.jena.rdf.model.Literal" %> <%@ page import="com.hp.hpl.jena.rdf.model.Literal" %>
<%@ page import="com.hp.hpl.jena.rdf.model.Model" %> <%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
<% <%

View file

@ -6,9 +6,9 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelSelector" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.ModelSelector" %>
<%@ page import="com.hp.hpl.jena.ontology.OntModel"%> <%@ page import="com.hp.hpl.jena.ontology.OntModel"%>
<%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %> <%@ page import="org.apache.commons.logging.LogFactory" %>

View file

@ -5,7 +5,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>

View file

@ -6,7 +6,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %> <%@ page import="org.apache.commons.logging.LogFactory" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

View file

@ -7,14 +7,14 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.StandardModelSelector"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.StandardModelSelector"%>
<%@ page import="com.hp.hpl.jena.shared.Lock"%> <%@ page import="com.hp.hpl.jena.shared.Lock"%>
<%@ page import="com.hp.hpl.jena.ontology.OntModel"%> <%@ page import="com.hp.hpl.jena.ontology.OntModel"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent"%>

View file

@ -10,15 +10,15 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.DateTimeIntervalValidation"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation"%>
<%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %> <%@ page import="org.apache.commons.logging.LogFactory" %>

View file

@ -10,18 +10,18 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.elements.DateTimeWithPrecision"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field"%>
<%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %> <%@ page import="org.apache.commons.logging.LogFactory" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.DateTimeIntervalValidation"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.DateTimeIntervalValidation"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>

View file

@ -7,9 +7,9 @@
<%@ page import="com.hp.hpl.jena.rdf.model.Literal" %> <%@ page import="com.hp.hpl.jena.rdf.model.Literal" %>
<%@ page import="com.hp.hpl.jena.rdf.model.Model" %> <%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelChangePreprocessor"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.DefaultAddMissingIndividualFormModelPreprocessor"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.DefaultAddMissingIndividualFormModelPreprocessor"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena"%>

View file

@ -7,7 +7,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
<%@ page import="java.util.HashMap"%> <%@ page import="java.util.HashMap"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
<%! private static HashMap<String,String> defaultsForXSDtypes ; <%! private static HashMap<String,String> defaultsForXSDtypes ;

View file

@ -6,7 +6,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %>

View file

@ -6,7 +6,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="java.util.List" %> <%@ page import="java.util.List" %>
<%@ page import="org.apache.commons.logging.LogFactory" %> <%@ page import="org.apache.commons.logging.LogFactory" %>
@ -23,7 +23,7 @@
WebappDaoFactory wdf = vreq.getWebappDaoFactory(); WebappDaoFactory wdf = vreq.getWebappDaoFactory();
%> %>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.SelectListGenerator"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.SelectListGenerator"%>
<%@page import="java.util.Map"%> <%@page import="java.util.Map"%>
<%@page import="com.hp.hpl.jena.ontology.OntModel"%> <%@page import="com.hp.hpl.jena.ontology.OntModel"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch"%> <%@page import="edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch"%>

View file

@ -5,7 +5,7 @@
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory.SelfEditing"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory.SelfEditing"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty"%>

View file

@ -9,8 +9,8 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %>

View file

@ -13,7 +13,7 @@ This is a test file for the DateTimeWithPrecision EditElement.
<%@ page import="java.util.HashMap"%> <%@ page import="java.util.HashMap"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

View file

@ -9,10 +9,10 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.EditLiteral" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.EditLiteral" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.Log" %>
@ -21,7 +21,7 @@
<%@ page import="java.util.*" %> <%@ page import="java.util.*" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

View file

@ -9,10 +9,10 @@
<%@ page import="com.hp.hpl.jena.shared.Lock" %> <%@ page import="com.hp.hpl.jena.shared.Lock" %>
<%@ page import="com.thoughtworks.xstream.XStream" %> <%@ page import="com.thoughtworks.xstream.XStream" %>
<%@ page import="com.thoughtworks.xstream.io.xml.DomDriver" %> <%@ page import="com.thoughtworks.xstream.io.xml.DomDriver" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="java.io.StringReader" %> <%@ page import="java.io.StringReader" %>
<%@ page import="java.util.*" %> <%@ page import="java.util.*" %>
@ -33,7 +33,7 @@
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep"%> <%@page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena"%> <%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

View file

@ -1,7 +1,7 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> <%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="org.apache.commons.lang.StringUtils" %> <%@ page import="org.apache.commons.lang.StringUtils" %>
<%@page import="org.apache.commons.logging.Log"%> <%@page import="org.apache.commons.logging.Log"%>

View file

@ -9,10 +9,10 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.EditLiteral" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.EditLiteral" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.Log" %>
@ -21,13 +21,13 @@
<%@ page import="java.util.*" %> <%@ page import="java.util.*" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.RdfLiteralHash"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty"%> <%@page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent"%> <%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%-- 2nd prototype of processing, adapted for data property editing <%-- 2nd prototype of processing, adapted for data property editing

View file

@ -9,10 +9,10 @@
<%@ page import="com.hp.hpl.jena.shared.Lock" %> <%@ page import="com.hp.hpl.jena.shared.Lock" %>
<%@ page import="com.thoughtworks.xstream.XStream" %> <%@ page import="com.thoughtworks.xstream.XStream" %>
<%@ page import="com.thoughtworks.xstream.io.xml.DomDriver" %> <%@ page import="com.thoughtworks.xstream.io.xml.DomDriver" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Generator" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %>
<%@ page import="java.io.StringReader" %> <%@ page import="java.io.StringReader" %>
<%@ page import="java.util.*" %> <%@ page import="java.util.*" %>
<%@ page import="java.util.Map" %> <%@ page import="java.util.Map" %>
@ -34,10 +34,10 @@
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%> <%@page import="edu.cornell.mannlib.vitro.webapp.auth.identifier.RoleIdentifier"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditN3Utils"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep"%> <%@page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep"%>
<%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelChangePreprocessor"%> <%@page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ModelChangePreprocessor"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="java.net.URLDecoder" %> <%@ page import="java.net.URLDecoder" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena"%> <%@page import="edu.cornell.mannlib.vitro.webapp.dao.jena.DependentResourceDeleteJena"%>

View file

@ -1,7 +1,7 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> <%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %> <%@ page import="org.apache.commons.logging.LogFactory" %>