VIVO-82 Use ModelAccess to get the OntModelSelectors
Since the OntModelSelectors are facades over the OntModels stored in ModelAccess, remove any attempts to set the OntModelSelectors.
This commit is contained in:
parent
6e5a6074f6
commit
a70ad4953f
3 changed files with 11 additions and 8 deletions
|
@ -25,8 +25,9 @@ import edu.cornell.mannlib.vitro.webapp.controller.edit.utils.LocalNamespaceClas
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess.ModelID;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
||||||
/*
|
/*
|
||||||
* Custom controller for menu management. This will be replaced later once N3 Editing
|
* Custom controller for menu management. This will be replaced later once N3 Editing
|
||||||
|
@ -183,7 +184,7 @@ public class InstitutionalInternalClassController extends FreemarkerHttpServlet
|
||||||
}
|
}
|
||||||
//If existing class, need to simply add a statement specifying existing class is an internal class
|
//If existing class, need to simply add a statement specifying existing class is an internal class
|
||||||
if(classUri != null && !classUri.isEmpty()) {
|
if(classUri != null && !classUri.isEmpty()) {
|
||||||
Model writeModel = ModelContext.getBaseOntModelSelector(getServletContext()).getTBoxModel();
|
Model writeModel = ModelAccess.on(getServletContext()).getOntModel(ModelID.BASE_TBOX);
|
||||||
writeModel.enterCriticalSection(Lock.WRITE);
|
writeModel.enterCriticalSection(Lock.WRITE);
|
||||||
writeModel.notifyEvent(new EditEvent(null,true));
|
writeModel.notifyEvent(new EditEvent(null,true));
|
||||||
try {
|
try {
|
||||||
|
@ -238,7 +239,7 @@ public class InstitutionalInternalClassController extends FreemarkerHttpServlet
|
||||||
//Get current internal class
|
//Get current internal class
|
||||||
private String retrieveCurrentInternalClass() {
|
private String retrieveCurrentInternalClass() {
|
||||||
String internalClassUri = "";
|
String internalClassUri = "";
|
||||||
Model mainModel = ModelContext.getBaseOntModelSelector(getServletContext()).getTBoxModel();
|
Model mainModel = ModelAccess.on(getServletContext()).getOntModel(ModelID.BASE_TBOX);
|
||||||
StmtIterator internalIt = mainModel.listStatements(null,
|
StmtIterator internalIt = mainModel.listStatements(null,
|
||||||
ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT),
|
ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT),
|
||||||
(RDFNode) null);
|
(RDFNode) null);
|
||||||
|
|
|
@ -27,8 +27,9 @@ import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess.ModelID;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will pass these variables to the template:
|
* This will pass these variables to the template:
|
||||||
|
@ -104,7 +105,7 @@ public class InternalClassesDataGetter extends IndividualsForClassesDataGetter{
|
||||||
//if internal class restriction specified and is true
|
//if internal class restriction specified and is true
|
||||||
if(internalClass != null && internalClass.equals("true")) {
|
if(internalClass != null && internalClass.equals("true")) {
|
||||||
//Get internal class
|
//Get internal class
|
||||||
Model mainModel = ModelContext.getBaseOntModelSelector(context).getTBoxModel();;
|
Model mainModel = ModelAccess.on(context).getOntModel(ModelID.BASE_TBOX);
|
||||||
StmtIterator internalIt = mainModel.listStatements(null, ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT), (RDFNode) null);
|
StmtIterator internalIt = mainModel.listStatements(null, ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT), (RDFNode) null);
|
||||||
//Checks for just one statement
|
//Checks for just one statement
|
||||||
if(internalIt.hasNext()){
|
if(internalIt.hasNext()){
|
||||||
|
|
|
@ -14,8 +14,9 @@ import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess.ModelID;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class includes methods that help in selecting a data getter based on
|
* This class includes methods that help in selecting a data getter based on
|
||||||
|
@ -46,8 +47,8 @@ public class MenuManagementDataUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String retrieveInternalClass(ServletContext context) {
|
private static String retrieveInternalClass(ServletContext context) {
|
||||||
OntModel mainModel = ModelContext.getBaseOntModelSelector(context).getTBoxModel();
|
OntModel mainModel = ModelAccess.on(context).getOntModel(ModelID.BASE_TBOX);
|
||||||
StmtIterator internalIt = mainModel.listStatements(null, ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT), (RDFNode) null);
|
StmtIterator internalIt = mainModel.listStatements(null, ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT), (RDFNode) null);
|
||||||
if(internalIt.hasNext()) {
|
if(internalIt.hasNext()) {
|
||||||
String internalClass = internalIt.nextStatement().getSubject().getURI();
|
String internalClass = internalIt.nextStatement().getSubject().getURI();
|
||||||
return internalClass;
|
return internalClass;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue