VIVO-97 removed unconditional cast to WebappDaoFactoryJena in SimpleReasonerSetup

This commit is contained in:
brianjlowe 2013-09-13 11:59:27 -04:00
parent d2d813ab62
commit 772cfe127e

View file

@ -56,7 +56,7 @@ public class SimpleReasonerSetup implements ServletContextListener {
OntModelSelector inferencesOms = ModelAccess.on(ctx).getInferenceOntModelSelector(); OntModelSelector inferencesOms = ModelAccess.on(ctx).getInferenceOntModelSelector();
OntModelSelector unionOms = ModelAccess.on(ctx).getUnionOntModelSelector(); OntModelSelector unionOms = ModelAccess.on(ctx).getUnionOntModelSelector();
WebappDaoFactoryJena wadf = (WebappDaoFactoryJena) ModelAccess.on(ctx).getWebappDaoFactory(); WebappDaoFactory wadf = ModelAccess.on(ctx).getWebappDaoFactory();
if (!assertionsOms.getTBoxModel().getProfile().NAMESPACE().equals(OWL.NAMESPACE.getNameSpace())) { if (!assertionsOms.getTBoxModel().getProfile().NAMESPACE().equals(OWL.NAMESPACE.getNameSpace())) {
log.error("Not connecting Pellet reasoner - the TBox assertions model is not an OWL model"); log.error("Not connecting Pellet reasoner - the TBox assertions model is not an OWL model");
@ -75,19 +75,14 @@ public class SimpleReasonerSetup implements ServletContextListener {
sce.getServletContext().setAttribute("pelletListener",pelletListener); sce.getServletContext().setAttribute("pelletListener",pelletListener);
sce.getServletContext().setAttribute("pelletOntModel", pelletListener.getPelletModel()); sce.getServletContext().setAttribute("pelletOntModel", pelletListener.getPelletModel());
if (wadf != null) { if (wadf instanceof WebappDaoFactoryJena) {
wadf.setPelletListener(pelletListener); ((WebappDaoFactoryJena) wadf).setPelletListener(pelletListener);
} }
log.info("Pellet reasoner connected for the TBox"); log.info("Pellet reasoner connected for the TBox");
// set up simple reasoning for the ABox // set up simple reasoning for the ABox
DataSource bds = JenaDataSourceSetupBase
.getApplicationDataSource(ctx);
String dbType = ConfigurationProperties.getBean(ctx).getProperty( // database type
"VitroConnection.DataSource.dbtype","MySQL");
RDFService rdfService = RDFServiceUtils.getRDFServiceFactory(ctx).getRDFService(); RDFService rdfService = RDFServiceUtils.getRDFServiceFactory(ctx).getRDFService();
Dataset dataset = new RDFServiceDataset(rdfService); Dataset dataset = new RDFServiceDataset(rdfService);