work in progress on data migration and related changes to support ISF
This commit is contained in:
parent
c00fefacfe
commit
d8d704064e
8 changed files with 75 additions and 29 deletions
|
@ -77,11 +77,16 @@ public class RDFUploadController extends JenaIngestController {
|
|||
VitroRequest request = new VitroRequest(req);
|
||||
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
|
||||
|
||||
String modelName = req.getParameter("modelName");
|
||||
if(modelName!=null){
|
||||
loadRDF(req,request,response);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String modelName = req.getParameter("modelName");
|
||||
if(modelName!=null){
|
||||
loadRDF(req,request,response);
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e,e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
boolean remove = "remove".equals(request.getParameter("mode"));
|
||||
String verb = remove?"Removed":"Added";
|
||||
|
|
|
@ -905,8 +905,8 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
|||
"SELECT ?property ?range ?filename WHERE { \n" +
|
||||
" { ?property display:listViewConfigFile ?filename \n" +
|
||||
" } UNION { \n" +
|
||||
" ?lv config:listViewConfigFile ?filename . \n " +
|
||||
" ?configuration config:hasListView ?lv . " +
|
||||
" ?configuration config:listViewConfigFile ?filename . \n " +
|
||||
// " ?configuration config:hasListView ?lv . " +
|
||||
" ?context config:hasConfiguration ?configuration . \n" +
|
||||
" ?context config:configContextFor ?property . \n" +
|
||||
" ?context config:qualifiedBy ?range . \n" +
|
||||
|
@ -955,6 +955,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
|||
}
|
||||
} else {
|
||||
String filename = soln.getLiteral("filename").getLexicalForm();
|
||||
log.info("putting " + prop.getURI() + " " + rangeUri + " " + filename + " into list view map");
|
||||
customListViewConfigFileMap.put(new Pair<ObjectProperty, String>(prop, rangeUri), filename);
|
||||
}
|
||||
}
|
||||
|
@ -963,6 +964,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
|||
|
||||
String customListViewConfigFileName = customListViewConfigFileMap.get(new Pair<ObjectProperty, String>(op, op.getRangeVClassURI()));
|
||||
if (customListViewConfigFileName == null) {
|
||||
log.info("no list view found for " + op.getURI() + " qualified by " + op.getRangeVClassURI());
|
||||
customListViewConfigFileName = customListViewConfigFileMap.get(new Pair<ObjectProperty, String>(op, OWL.Thing.getURI()));
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ public class MultipartHttpServletRequest extends FileUploadServletRequest {
|
|||
throws IOException{
|
||||
super(request);
|
||||
storeFilesToTempDir = false;
|
||||
setup(request);
|
||||
|
||||
}
|
||||
|
||||
|
@ -73,6 +74,7 @@ public class MultipartHttpServletRequest extends FileUploadServletRequest {
|
|||
storeFilesToTempDir = true;
|
||||
this.maxFileSize = maxFileSize;
|
||||
this.tempDir = figureTemporaryDirectory(request);
|
||||
setup(request);
|
||||
}
|
||||
|
||||
private void setup(HttpServletRequest request){
|
||||
|
|
|
@ -4,10 +4,12 @@ package edu.cornell.mannlib.vitro.webapp.ontology.update;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntClass;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
||||
|
@ -24,7 +26,6 @@ import com.hp.hpl.jena.rdf.model.StmtIterator;
|
|||
import com.hp.hpl.jena.shared.Lock;
|
||||
import com.hp.hpl.jena.vocabulary.OWL;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.ontology.update.AtomicOntologyChange.AtomicChangeType;
|
||||
|
||||
|
@ -34,6 +35,7 @@ import edu.cornell.mannlib.vitro.webapp.ontology.update.AtomicOntologyChange.Ato
|
|||
*/
|
||||
public class ABoxUpdater {
|
||||
|
||||
private final Log log = LogFactory.getLog(ABoxUpdater.class);
|
||||
private OntModel oldTboxModel;
|
||||
private OntModel newTboxModel;
|
||||
private OntModel aboxModel;
|
||||
|
@ -388,20 +390,33 @@ public class ABoxUpdater {
|
|||
Iterator<AtomicOntologyChange> propItr = changes.iterator();
|
||||
while(propItr.hasNext()){
|
||||
AtomicOntologyChange propChangeObj = propItr.next();
|
||||
switch (propChangeObj.getAtomicChangeType()){
|
||||
case ADD:
|
||||
addProperty(propChangeObj);
|
||||
break;
|
||||
case DELETE:
|
||||
deleteProperty(propChangeObj);
|
||||
break;
|
||||
case RENAME:
|
||||
renameProperty(propChangeObj);
|
||||
break;
|
||||
default:
|
||||
logger.logError("unexpected change type indicator: " + propChangeObj.getAtomicChangeType());
|
||||
break;
|
||||
}
|
||||
log.info("processing " + propChangeObj);
|
||||
try {
|
||||
if (propChangeObj.getAtomicChangeType() == null) {
|
||||
log.error("Missing change type; skipping " + propChangeObj);
|
||||
continue;
|
||||
}
|
||||
switch (propChangeObj.getAtomicChangeType()){
|
||||
case ADD:
|
||||
log.info("add");
|
||||
addProperty(propChangeObj);
|
||||
break;
|
||||
case DELETE:
|
||||
log.info("delete");
|
||||
deleteProperty(propChangeObj);
|
||||
break;
|
||||
case RENAME:
|
||||
log.info("rename");
|
||||
renameProperty(propChangeObj);
|
||||
break;
|
||||
default:
|
||||
log.info("unknown");
|
||||
logger.logError("unexpected change type indicator: " + propChangeObj.getAtomicChangeType());
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -518,7 +533,7 @@ public class ABoxUpdater {
|
|||
|
||||
private void renameProperty(AtomicOntologyChange propObj) throws IOException {
|
||||
|
||||
//logger.log("Processing a property rename from: " + propObj.getSourceURI() + " to " + propObj.getDestinationURI());
|
||||
logger.log("Processing a property rename from: " + propObj.getSourceURI() + " to " + propObj.getDestinationURI());
|
||||
|
||||
OntProperty oldProperty = oldTboxModel.getOntProperty(propObj.getSourceURI());
|
||||
OntProperty newProperty = newTboxModel.getOntProperty(propObj.getDestinationURI());
|
||||
|
|
|
@ -30,6 +30,11 @@ public class AtomicOntologyChange {
|
|||
this.notes = notes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Source: " + sourceURI + "; Destination: " + destinationURI +
|
||||
"; Type: " + atomicChangeType + "; Notes:" + notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the URI of a class or property in the previous version of
|
||||
|
|
|
@ -98,14 +98,18 @@ public class KnowledgeBaseUpdater {
|
|||
AtomicOntologyChangeLists changes = new AtomicOntologyChangeLists(rawChanges,settings.getNewTBoxModel(),settings.getOldTBoxModel());
|
||||
|
||||
//process the TBox before the ABox
|
||||
log.info("\tupdating tbox annotations");
|
||||
updateTBoxAnnotations();
|
||||
|
||||
try {
|
||||
log.info("\tupdating tbox annotations");
|
||||
updateTBoxAnnotations();
|
||||
} catch (Exception e) {
|
||||
log.error(e,e);
|
||||
}
|
||||
|
||||
try {
|
||||
migrateMigrationMetadata(servletContext);
|
||||
logger.log("Migrated migration metadata");
|
||||
} catch (Exception e) {
|
||||
log.debug("unable to migrate migration metadata " + e.getMessage());
|
||||
log.error("unable to migrate migration metadata " + e.getMessage());
|
||||
}
|
||||
|
||||
log.info("\tupdating the abox");
|
||||
|
@ -390,11 +394,13 @@ public class KnowledgeBaseUpdater {
|
|||
while(listItr.hasNext()) {
|
||||
AtomicOntologyChange changeObj = listItr.next();
|
||||
if (changeObj.getSourceURI() != null){
|
||||
|
||||
log.info("triaging " + changeObj);
|
||||
if (oldTboxModel.getOntProperty(changeObj.getSourceURI()) != null){
|
||||
atomicPropertyChanges.add(changeObj);
|
||||
log.info("added to property changes");
|
||||
} else if (oldTboxModel.getOntClass(changeObj.getSourceURI()) != null) {
|
||||
atomicClassChanges.add(changeObj);
|
||||
log.info("added to class changes");
|
||||
} else if ("Prop".equals(changeObj.getNotes())) {
|
||||
atomicPropertyChanges.add(changeObj);
|
||||
} else if ("Class".equals(changeObj.getNotes())) {
|
||||
|
|
|
@ -9,6 +9,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.skife.csv.CSVReader;
|
||||
import org.skife.csv.SimpleReader;
|
||||
|
||||
|
@ -23,6 +25,8 @@ import edu.cornell.mannlib.vitro.webapp.ontology.update.AtomicOntologyChange.Ato
|
|||
|
||||
public class OntologyChangeParser {
|
||||
|
||||
private final Log log = LogFactory.getLog(OntologyChangeParser.class);
|
||||
|
||||
private ChangeLogger logger;
|
||||
|
||||
public OntologyChangeParser(ChangeLogger logger) {
|
||||
|
@ -85,6 +89,8 @@ public class OntologyChangeParser {
|
|||
}
|
||||
|
||||
|
||||
log.info(changeObj);
|
||||
|
||||
changeObjects.add(changeObj);
|
||||
|
||||
}
|
||||
|
|
|
@ -104,6 +104,11 @@ public class TBoxUpdater {
|
|||
// if the default has changed in the new version of the ontology AND if
|
||||
// the site hasn't overidden the previous default in their knowledge base.
|
||||
|
||||
if(oldTboxAnnotationsModel == null) {
|
||||
logger.log("oldTboxAnnotationModel is null; aborting update of annotation values");
|
||||
return;
|
||||
}
|
||||
|
||||
StmtIterator iter = oldTboxAnnotationsModel.listStatements();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue