simple context listener modifications to support setting triple store in deploy properties

This commit is contained in:
bjl23 2010-12-20 21:35:48 +00:00
parent deb362f599
commit fd15870f7e
2 changed files with 24 additions and 0 deletions

View file

@ -18,6 +18,7 @@ import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao;
public class AttachSubmodels implements ServletContextListener {
@ -28,6 +29,17 @@ public class AttachSubmodels implements ServletContextListener {
public void contextInitialized( ServletContextEvent sce ) {
try {
//FIXME refactor this
String tripleStoreTypeStr =
ConfigurationProperties.getProperty(
"VitroConnection.DataSource.tripleStoreType", "RDB");
if ("SDB".equals(tripleStoreTypeStr)) {
(new FileGraphSetup()).contextInitialized(sce);
return;
// use filegraphs instead of submodels if we're running SDB
}
int attachmentCount = 0;
OntModel baseModel = (OntModel) sce.getServletContext().getAttribute( JenaBaseDao.ASSERTIONS_ONT_MODEL_ATTRIBUTE_NAME );
Set<String> pathSet = sce.getServletContext().getResourcePaths( PATH );

View file

@ -13,6 +13,7 @@ import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.vocabulary.OWL;
import edu.cornell.mannlib.vitro.webapp.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena;
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener;
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.ReasonerConfiguration;
@ -27,6 +28,17 @@ public class PelletReasonerSetup implements ServletContextListener {
try {
//FIXME refactor this
String tripleStoreTypeStr =
ConfigurationProperties.getProperty(
"VitroConnection.DataSource.tripleStoreType", "RDB");
if ("SDB".equals(tripleStoreTypeStr)) {
(new SimpleReasonerSetup()).contextInitialized(sce);
return;
// use the simple reasoner instead of Pellet for ABox inferences
// if we're running SDB
}
OntModel memoryModel = (OntModel) sce.getServletContext().getAttribute("jenaOntModel");
OntModel baseModel = (OntModel) sce.getServletContext().getAttribute("baseOntModel");
OntModel inferenceModel = (OntModel) sce.getServletContext().getAttribute("inferenceOntModel");