Fixing bugs with PrimitiveRdfEdit.
This commit is contained in:
parent
10da4551cd
commit
195c03f9d0
1 changed files with 7 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -115,14 +117,14 @@ public class PrimitiveRdfEdit extends FreeMarkerHttpServlet{
|
||||||
if( hasPermission ){
|
if( hasPermission ){
|
||||||
String editorUri = EditN3Utils.getEditorUri(vreq,request.getSession(false),getServletContext());
|
String editorUri = EditN3Utils.getEditorUri(vreq,request.getSession(false),getServletContext());
|
||||||
try {
|
try {
|
||||||
processChanges(request, additions, retractions, getWriteModel(request),getQueryModel(request), editorUri);
|
processChanges( additions, retractions, getWriteModel(request),getQueryModel(request), editorUri);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
doError(response,e.getMessage(),HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
doError(response,e.getMessage(),HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processChanges( HttpServletRequest request, Set<Model> additions, Set<Model> retractions, OntModel writeModel, OntModel queryModel, String editorURI ) throws Exception{
|
protected void processChanges(Set<Model> additions, Set<Model> retractions, OntModel writeModel, OntModel queryModel, String editorURI ) throws Exception{
|
||||||
Model a = com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel();
|
Model a = com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel();
|
||||||
for(Model m : additions)
|
for(Model m : additions)
|
||||||
a.add(m);
|
a.add(m);
|
||||||
|
@ -131,10 +133,10 @@ public class PrimitiveRdfEdit extends FreeMarkerHttpServlet{
|
||||||
for(Model m : retractions)
|
for(Model m : retractions)
|
||||||
r.add(m);
|
r.add(m);
|
||||||
|
|
||||||
procesChanges(request,a,r,writeModel,queryModel,editorURI);
|
procesChanges(a,r,writeModel,queryModel,editorURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void procesChanges(HttpServletRequest request, Model additions, Model retractions, OntModel writeModel, OntModel queryModel, String editorURI ) throws Exception{
|
protected void procesChanges(Model additions, Model retractions, OntModel writeModel, OntModel queryModel, String editorURI ) throws Exception{
|
||||||
/*
|
/*
|
||||||
* Do a diff on the additions and retractions and then only add the delta to the jenaOntModel.
|
* Do a diff on the additions and retractions and then only add the delta to the jenaOntModel.
|
||||||
*/
|
*/
|
||||||
|
@ -176,6 +178,7 @@ public class PrimitiveRdfEdit extends FreeMarkerHttpServlet{
|
||||||
StringReader reader = new StringReader(param);
|
StringReader reader = new StringReader(param);
|
||||||
Model model = com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel();
|
Model model = com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel();
|
||||||
model.read(reader, null, format);
|
model.read(reader, null, format);
|
||||||
|
models.add(model);
|
||||||
}catch(Error ex){
|
}catch(Error ex){
|
||||||
log.error("Error reading RDF as " + format + " in " + param);
|
log.error("Error reading RDF as " + format + " in " + param);
|
||||||
throw new Exception("Error reading RDF, set log level to debug for this class to get error messages in the sever logs.");
|
throw new Exception("Error reading RDF, set log level to debug for this class to get error messages in the sever logs.");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue