Updates for resolving NIHVIVO-3217 and NIHVIVO-3218

This commit is contained in:
hjkhjk54 2011-10-11 19:44:12 +00:00
parent 591af24749
commit d3f77a374c
2 changed files with 18 additions and 3 deletions

View file

@ -866,14 +866,21 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
if (customListViewConfigFileMap == null) { if (customListViewConfigFileMap == null) {
customListViewConfigFileMap = new HashMap<ObjectProperty, String>(); customListViewConfigFileMap = new HashMap<ObjectProperty, String>();
OntModel displayModel = getOntModelSelector().getDisplayModel(); OntModel displayModel = getOntModelSelector().getDisplayModel();
//Get all property to list view config file mappings in the system
QueryExecution qexec = QueryExecutionFactory.create(listViewConfigFileQuery, displayModel); QueryExecution qexec = QueryExecutionFactory.create(listViewConfigFileQuery, displayModel);
ResultSet results = qexec.execSelect(); ResultSet results = qexec.execSelect();
//Iterate through mappings looking for the current property and setting up a hashmap for subsequent retrieval
while (results.hasNext()) { while (results.hasNext()) {
QuerySolution soln = results.next(); QuerySolution soln = results.next();
String propertyUri = soln.getResource("property").getURI(); String propertyUri = soln.getResource("property").getURI();
ObjectProperty prop = getObjectPropertyByURI(propertyUri); ObjectProperty prop = getObjectPropertyByURI(propertyUri);
if (prop == null) { if (prop == null) {
log.warn("Can't find property for uri " + propertyUri); //This is a warning only if this property is the one for which we're searching
if(op.getURI().equals(propertyUri)){
log.warn("Can't find property for uri " + propertyUri);
} else {
log.debug("Can't find property for uri " + propertyUri);
}
} else { } else {
String filename = soln.getLiteral("filename").getLexicalForm(); String filename = soln.getLiteral("filename").getLexicalForm();
customListViewConfigFileMap.put(prop, filename); customListViewConfigFileMap.put(prop, filename);

View file

@ -655,7 +655,15 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
OntModelSelectorImpl specialSelector = new OntModelSelectorImpl(); OntModelSelectorImpl specialSelector = new OntModelSelectorImpl();
specialSelector.setFullModel(unionModel); specialSelector.setFullModel(unionModel);
specialSelector.setApplicationMetadataModel(specialModel); //Keeping original application metadata model and adding special model
//adding both allows us to prevent errors in ApplicationDao which may depend on
//a specific individual from the regular application metadata model to pick theme
//Adding the new model would take care of special situations where the switch model may
//contain important information
OntModel newApplicationModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
newApplicationModel.add(specialModel);
newApplicationModel.add(originalSelector.getApplicationMetadataModel());
specialSelector.setApplicationMetadataModel(newApplicationModel);
if(specialDisplayModel != null) { if(specialDisplayModel != null) {
specialSelector.setDisplayModel(specialDisplayModel); specialSelector.setDisplayModel(specialDisplayModel);