NIHVIVO-143 Front end deletion of moniker through the "delete" link: fixed more bugs, so it finally works.

This commit is contained in:
rjy7 2010-03-19 21:37:09 +00:00
parent ea25ff4ffb
commit 6038b68c4a
3 changed files with 8 additions and 8 deletions

View file

@ -85,6 +85,7 @@
DataProperty dataproperty = wdf.getDataPropertyDao().getDataPropertyByURI( predicateUri ); DataProperty dataproperty = wdf.getDataPropertyDao().getDataPropertyByURI( predicateUri );
if( dataproperty == null) { if( dataproperty == null) {
// No dataproperty will be returned for a vitro ns prop, but we shouldn't throw an error. // No dataproperty will be returned for a vitro ns prop, but we shouldn't throw an error.
// RY This is not necessarily true...
if (!isVitroNsProp) { if (!isVitroNsProp) {
log.error("Could not find data property '"+predicateUri+"' in model"); log.error("Could not find data property '"+predicateUri+"' in model");
throw new Error("editDatapropStmtRequest.jsp: Could not find DataProperty in model: " + predicateUri); throw new Error("editDatapropStmtRequest.jsp: Could not find DataProperty in model: " + predicateUri);

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$ --%>
<%@ page import="com.hp.hpl.jena.rdf.model.Model" %> <%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
<%@ page import="com.hp.hpl.jena.rdf.model.Resource" %>
<%@ page import="com.hp.hpl.jena.rdf.model.Literal" %>
<%@ page import="com.hp.hpl.jena.rdf.model.Property" %>
<%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %> <%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataProperty" %>
@ -89,11 +92,11 @@
OntModel writeModel = (new StandardModelSelector()).getModel(request, application); OntModel writeModel = (new StandardModelSelector()).getModel(request, application);
writeModel.enterCriticalSection(Lock.WRITE); writeModel.enterCriticalSection(Lock.WRITE);
try{ try{
writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,true)); writeModel.getBaseModel().notifyEvent(new EditEvent(editorUri,true));
writeModel.remove( writeModel.remove(
writeModel.getResource(subjectUri), writeModel.getResource(subjectUri),
writeModel.getProperty(predicateUri), writeModel.getProperty(predicateUri),
writeModel.createLiteral(dps.getData())); writeModel.createTypedLiteral(dps.getData(), dps.getDatatypeURI()));
}finally{ }finally{
writeModel.leaveCriticalSection(); writeModel.leaveCriticalSection();
} }

View file

@ -37,12 +37,12 @@
Individual subject = (Individual)vreq.getAttribute("subject"); Individual subject = (Individual)vreq.getAttribute("subject");
if( subject == null ) { if( subject == null ) {
throw new Error("In vitroNsEditLabelForm.jsp, could not find subject " + subjectUri); throw new Error("In defaultVitroNsPropForm.jsp, could not find subject " + subjectUri);
} }
Model model = (Model)application.getAttribute("jenaOntModel"); Model model = (Model)application.getAttribute("jenaOntModel");
// RY ***** Get the rangeDatatypeUri - need to get it from the // RY ***** Get the rangeDatatypeUri - need to get the existing value datatype. Or just hardcode?
//String rangeDatatypeUri = vreq.getWebappDaoFactory().getDataPropertyDao().getRequiredDatatypeURI(subject, prop); //String rangeDatatypeUri = vreq.getWebappDaoFactory().getDataPropertyDao().getRequiredDatatypeURI(subject, prop);
//String rangeDatatypeUri = prop.getRangeDatatypeURI(); //String rangeDatatypeUri = prop.getRangeDatatypeURI();
String rangeDatatypeUri = "http://www.w3.org/2001/XMLSchema#string"; String rangeDatatypeUri = "http://www.w3.org/2001/XMLSchema#string";
@ -57,11 +57,8 @@
if (!rangeDatatypeUriJson.isEmpty()) { if (!rangeDatatypeUriJson.isEmpty()) {
validatorList.add("datatype:" + rangeDatatypeUriJson); validatorList.add("datatype:" + rangeDatatypeUriJson);
} }
String validators = StringUtils.quotedList(validatorList, ",");
System.out.println("VALIDATORS: " + validators);
vreq.setAttribute("validators", StringUtils.quotedList(validatorList, ",")); vreq.setAttribute("validators", StringUtils.quotedList(validatorList, ","));
%> %>
<c:set var="predicate" value="<%=predicateUri%>" /> <c:set var="predicate" value="<%=predicateUri%>" />
@ -132,7 +129,6 @@
<% <%
System.out.println(request.getAttribute("editjson"));
if( log.isDebugEnabled()) log.debug(request.getAttribute("editjson")); if( log.isDebugEnabled()) log.debug(request.getAttribute("editjson"));
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request); EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);