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);
|
VitroRequest request = new VitroRequest(req);
|
||||||
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
|
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
|
||||||
|
|
||||||
String modelName = req.getParameter("modelName");
|
try {
|
||||||
if(modelName!=null){
|
String modelName = req.getParameter("modelName");
|
||||||
loadRDF(req,request,response);
|
if(modelName!=null){
|
||||||
return;
|
loadRDF(req,request,response);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e,e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
boolean remove = "remove".equals(request.getParameter("mode"));
|
boolean remove = "remove".equals(request.getParameter("mode"));
|
||||||
String verb = remove?"Removed":"Added";
|
String verb = remove?"Removed":"Added";
|
||||||
|
|
|
@ -905,8 +905,8 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
"SELECT ?property ?range ?filename WHERE { \n" +
|
"SELECT ?property ?range ?filename WHERE { \n" +
|
||||||
" { ?property display:listViewConfigFile ?filename \n" +
|
" { ?property display:listViewConfigFile ?filename \n" +
|
||||||
" } UNION { \n" +
|
" } UNION { \n" +
|
||||||
" ?lv config:listViewConfigFile ?filename . \n " +
|
" ?configuration config:listViewConfigFile ?filename . \n " +
|
||||||
" ?configuration config:hasListView ?lv . " +
|
// " ?configuration config:hasListView ?lv . " +
|
||||||
" ?context config:hasConfiguration ?configuration . \n" +
|
" ?context config:hasConfiguration ?configuration . \n" +
|
||||||
" ?context config:configContextFor ?property . \n" +
|
" ?context config:configContextFor ?property . \n" +
|
||||||
" ?context config:qualifiedBy ?range . \n" +
|
" ?context config:qualifiedBy ?range . \n" +
|
||||||
|
@ -955,6 +955,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String filename = soln.getLiteral("filename").getLexicalForm();
|
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);
|
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()));
|
String customListViewConfigFileName = customListViewConfigFileMap.get(new Pair<ObjectProperty, String>(op, op.getRangeVClassURI()));
|
||||||
if (customListViewConfigFileName == null) {
|
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()));
|
customListViewConfigFileName = customListViewConfigFileMap.get(new Pair<ObjectProperty, String>(op, OWL.Thing.getURI()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class MultipartHttpServletRequest extends FileUploadServletRequest {
|
||||||
throws IOException{
|
throws IOException{
|
||||||
super(request);
|
super(request);
|
||||||
storeFilesToTempDir = false;
|
storeFilesToTempDir = false;
|
||||||
|
setup(request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ public class MultipartHttpServletRequest extends FileUploadServletRequest {
|
||||||
storeFilesToTempDir = true;
|
storeFilesToTempDir = true;
|
||||||
this.maxFileSize = maxFileSize;
|
this.maxFileSize = maxFileSize;
|
||||||
this.tempDir = figureTemporaryDirectory(request);
|
this.tempDir = figureTemporaryDirectory(request);
|
||||||
|
setup(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup(HttpServletRequest request){
|
private void setup(HttpServletRequest request){
|
||||||
|
|
|
@ -4,10 +4,12 @@ package edu.cornell.mannlib.vitro.webapp.ontology.update;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
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.OntClass;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
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.shared.Lock;
|
||||||
import com.hp.hpl.jena.vocabulary.OWL;
|
import com.hp.hpl.jena.vocabulary.OWL;
|
||||||
import com.hp.hpl.jena.vocabulary.RDF;
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.ontology.update.AtomicOntologyChange.AtomicChangeType;
|
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 {
|
public class ABoxUpdater {
|
||||||
|
|
||||||
|
private final Log log = LogFactory.getLog(ABoxUpdater.class);
|
||||||
private OntModel oldTboxModel;
|
private OntModel oldTboxModel;
|
||||||
private OntModel newTboxModel;
|
private OntModel newTboxModel;
|
||||||
private OntModel aboxModel;
|
private OntModel aboxModel;
|
||||||
|
@ -388,20 +390,33 @@ public class ABoxUpdater {
|
||||||
Iterator<AtomicOntologyChange> propItr = changes.iterator();
|
Iterator<AtomicOntologyChange> propItr = changes.iterator();
|
||||||
while(propItr.hasNext()){
|
while(propItr.hasNext()){
|
||||||
AtomicOntologyChange propChangeObj = propItr.next();
|
AtomicOntologyChange propChangeObj = propItr.next();
|
||||||
switch (propChangeObj.getAtomicChangeType()){
|
log.info("processing " + propChangeObj);
|
||||||
case ADD:
|
try {
|
||||||
addProperty(propChangeObj);
|
if (propChangeObj.getAtomicChangeType() == null) {
|
||||||
break;
|
log.error("Missing change type; skipping " + propChangeObj);
|
||||||
case DELETE:
|
continue;
|
||||||
deleteProperty(propChangeObj);
|
}
|
||||||
break;
|
switch (propChangeObj.getAtomicChangeType()){
|
||||||
case RENAME:
|
case ADD:
|
||||||
renameProperty(propChangeObj);
|
log.info("add");
|
||||||
break;
|
addProperty(propChangeObj);
|
||||||
default:
|
break;
|
||||||
logger.logError("unexpected change type indicator: " + propChangeObj.getAtomicChangeType());
|
case DELETE:
|
||||||
break;
|
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 {
|
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 oldProperty = oldTboxModel.getOntProperty(propObj.getSourceURI());
|
||||||
OntProperty newProperty = newTboxModel.getOntProperty(propObj.getDestinationURI());
|
OntProperty newProperty = newTboxModel.getOntProperty(propObj.getDestinationURI());
|
||||||
|
|
|
@ -30,6 +30,11 @@ public class AtomicOntologyChange {
|
||||||
this.notes = notes;
|
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
|
* 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());
|
AtomicOntologyChangeLists changes = new AtomicOntologyChangeLists(rawChanges,settings.getNewTBoxModel(),settings.getOldTBoxModel());
|
||||||
|
|
||||||
//process the TBox before the ABox
|
//process the TBox before the ABox
|
||||||
log.info("\tupdating tbox annotations");
|
try {
|
||||||
updateTBoxAnnotations();
|
log.info("\tupdating tbox annotations");
|
||||||
|
updateTBoxAnnotations();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e,e);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
migrateMigrationMetadata(servletContext);
|
migrateMigrationMetadata(servletContext);
|
||||||
logger.log("Migrated migration metadata");
|
logger.log("Migrated migration metadata");
|
||||||
} catch (Exception e) {
|
} 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");
|
log.info("\tupdating the abox");
|
||||||
|
@ -390,11 +394,13 @@ public class KnowledgeBaseUpdater {
|
||||||
while(listItr.hasNext()) {
|
while(listItr.hasNext()) {
|
||||||
AtomicOntologyChange changeObj = listItr.next();
|
AtomicOntologyChange changeObj = listItr.next();
|
||||||
if (changeObj.getSourceURI() != null){
|
if (changeObj.getSourceURI() != null){
|
||||||
|
log.info("triaging " + changeObj);
|
||||||
if (oldTboxModel.getOntProperty(changeObj.getSourceURI()) != null){
|
if (oldTboxModel.getOntProperty(changeObj.getSourceURI()) != null){
|
||||||
atomicPropertyChanges.add(changeObj);
|
atomicPropertyChanges.add(changeObj);
|
||||||
|
log.info("added to property changes");
|
||||||
} else if (oldTboxModel.getOntClass(changeObj.getSourceURI()) != null) {
|
} else if (oldTboxModel.getOntClass(changeObj.getSourceURI()) != null) {
|
||||||
atomicClassChanges.add(changeObj);
|
atomicClassChanges.add(changeObj);
|
||||||
|
log.info("added to class changes");
|
||||||
} else if ("Prop".equals(changeObj.getNotes())) {
|
} else if ("Prop".equals(changeObj.getNotes())) {
|
||||||
atomicPropertyChanges.add(changeObj);
|
atomicPropertyChanges.add(changeObj);
|
||||||
} else if ("Class".equals(changeObj.getNotes())) {
|
} else if ("Class".equals(changeObj.getNotes())) {
|
||||||
|
|
|
@ -9,6 +9,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
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.CSVReader;
|
||||||
import org.skife.csv.SimpleReader;
|
import org.skife.csv.SimpleReader;
|
||||||
|
|
||||||
|
@ -23,6 +25,8 @@ import edu.cornell.mannlib.vitro.webapp.ontology.update.AtomicOntologyChange.Ato
|
||||||
|
|
||||||
public class OntologyChangeParser {
|
public class OntologyChangeParser {
|
||||||
|
|
||||||
|
private final Log log = LogFactory.getLog(OntologyChangeParser.class);
|
||||||
|
|
||||||
private ChangeLogger logger;
|
private ChangeLogger logger;
|
||||||
|
|
||||||
public OntologyChangeParser(ChangeLogger logger) {
|
public OntologyChangeParser(ChangeLogger logger) {
|
||||||
|
@ -85,6 +89,8 @@ public class OntologyChangeParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
log.info(changeObj);
|
||||||
|
|
||||||
changeObjects.add(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
|
// 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.
|
// 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();
|
StmtIterator iter = oldTboxAnnotationsModel.listStatements();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue