diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/ifaces/DefaultAuthorizedPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/ifaces/DefaultAuthorizedPolicy.java deleted file mode 100644 index 0e64f5b40..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/ifaces/DefaultAuthorizedPolicy.java +++ /dev/null @@ -1,35 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces; - -import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.policy.BasicPolicyDecision; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; - -/** - * a policy where every type of action is authorized as INCONCLUSIVE - * by default. - * - * @author bdc34 - */ -public class DefaultAuthorizedPolicy implements PolicyIface{ - protected static PolicyDecision AUTHORIZED_DECISION = new BasicPolicyDecision( - Authorization.AUTHORIZED, - "This is the default decision defined in DefaultAuthorizedPolicy"); - - public PolicyDecision isAuthorized(IdentifierBundle whoToAuth, - RequestedAction whatToAuth) { - if (whoToAuth == null) - return new BasicPolicyDecision(Authorization.AUTHORIZED, - "null was passed as whoToAuth"); - if (whatToAuth == null) - return new BasicPolicyDecision(Authorization.AUTHORIZED, - "null was passed as whatToAuth"); - return AUTHORIZED_DECISION; - } - - @Override - public String toString() { - return "DefaultAuthorizedPolicy"; - } -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/AlwaysAuthorizePolicySetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/AlwaysAuthorizePolicySetup.java deleted file mode 100644 index bfdcfb321..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/AlwaysAuthorizePolicySetup.java +++ /dev/null @@ -1,34 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.auth.policy.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList; -import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.DefaultAuthorizedPolicy; - -public class AlwaysAuthorizePolicySetup implements ServletContextListener { - - private static final Log log = LogFactory.getLog(AlwaysAuthorizePolicySetup.class.getName()); - - public void contextInitialized(ServletContextEvent sce) { - try{ - log.trace("WARNING: Setting up AlwaysAuthorizePolicySetup."); - - - ServletPolicyList.addPolicy(sce.getServletContext(), new DefaultAuthorizedPolicy() ); - - - }catch(Exception e){ - log.error("could not create AuthorizationFactory: " + e); - e.printStackTrace(); - } - } - - - public void contextDestroyed(ServletContextEvent sce) { /*nothing*/ } -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/AttachSubmodels.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/AttachSubmodels.java deleted file mode 100644 index 8cce8d675..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/AttachSubmodels.java +++ /dev/null @@ -1,101 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.Set; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -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.config.ConfigurationProperties; -import edu.cornell.mannlib.vitro.webapp.dao.jena.JenaBaseDao; - -public class AttachSubmodels implements ServletContextListener { - - private static String PATH = "/WEB-INF/submodels"; - - private static final Log log = LogFactory.getLog( AttachSubmodels.class ); - - @Override - public void contextInitialized( ServletContextEvent sce ) { - - ServletContext ctx = sce.getServletContext(); - - if (true) { - (new FileGraphSetup()).contextInitialized(sce); - return; - // use filegraphs instead of submodels if we're running SDB - } - - // The future of AttachSubmodels is uncertain. - // Presently unreachable code follows. - - try { - int attachmentCount = 0; - OntModel baseModel = (OntModel) ctx.getAttribute( JenaBaseDao.ASSERTIONS_ONT_MODEL_ATTRIBUTE_NAME ); - Set pathSet = ctx.getResourcePaths( PATH ); - if (pathSet == null) { - return; - } - for ( String p : pathSet ) { - File file = new File( ctx.getRealPath( p ) ); - try { - FileInputStream fis = new FileInputStream( file ); - try { - Model m = ModelFactory.createDefaultModel(); - if ( p.endsWith(".n3") || p.endsWith(".N3") || p.endsWith(".ttl") || p.endsWith(".TTL") ) { - m.read( fis, null, "N3" ); - } else if ( p.endsWith(".owl") || p.endsWith(".OWL") || p.endsWith(".rdf") || p.endsWith(".RDF") || p.endsWith(".xml") || p.endsWith(".XML") ) { - m.read( fis, null, "RDF/XML" ); - } else { - log.warn("Ignoring submodel file " + p + " because the file extension is unrecognized."); - } - if ( !m.isEmpty() ) { - baseModel.addSubModel( m ); - } - attachmentCount++; - log.info("Attached submodel from file " + p); - } catch (Exception ioe) { - log.error("Unable to attach submodel from file " + p, ioe); - System.out.println("Unable to attach submodel from file " + p); - ioe.printStackTrace(); - } finally { - fis.close(); - } - } catch (FileNotFoundException fnfe) { - log.warn(p + " not found. Unable to attach as submodel" + - ((fnfe.getLocalizedMessage() != null) ? - fnfe.getLocalizedMessage() : "") ); - } - } - System.out.println("Attached " + attachmentCount + " file" + ((attachmentCount == 1) ? "" : "s") + " as submodels"); - } catch (ClassCastException cce) { - String errMsg = "Unable to cast servlet context attribute " + JenaBaseDao.ASSERTIONS_ONT_MODEL_ATTRIBUTE_NAME + " to " + OntModel.class.getName(); - // Logging this ourselves because Tomcat's tends not to log exceptions thrown in context listeners. - log.error( errMsg ); - throw new ClassCastException( errMsg ); - } catch (Throwable t) { - System.out.println("Throwable in listener " + this.getClass().getName()); - log.error(t); - t.printStackTrace(); - } - - } - - @Override - public void contextDestroyed( ServletContextEvent sce ) { - // nothing to worry about - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/HeapDefragement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/HeapDefragement.java deleted file mode 100644 index c17b513b0..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/HeapDefragement.java +++ /dev/null @@ -1,42 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * This class will request a full garbage collection when - * contextInitialized() is called. The goal is to eliminate fragmentation - * in the tenured generation and avoid problems with the 'young generation guarantee.' - * - * This should be the last listener before the context starts. - * - * See http://blogs.sun.com/jonthecollector/entry/when_the_sum_of_the (retrieved 2010-10-18) - * - * @author bdc34 - * - */ -public class HeapDefragement implements ServletContextListener { - private static final Log log = LogFactory.getLog(HeapDefragement.class); - - @Override - public void contextInitialized(ServletContextEvent arg0) { - try{ - log.info("Calling System.gc() to defragement the heap."); - long start = System.currentTimeMillis(); - System.gc(); - log.info("GC took " + (System.currentTimeMillis() - start) + " msec"); - }catch(Exception ex){ - log.error(ex,ex); - } - } - - @Override - public void contextDestroyed(ServletContextEvent arg0) { - //do nothing - } -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/ModelAuditorSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/ModelAuditorSetup.java deleted file mode 100644 index cdb141bb1..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/ModelAuditorSetup.java +++ /dev/null @@ -1,49 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -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.dao.jena.ModelAuditor; - -public class ModelAuditorSetup extends JenaDataSourceSetupBase implements ServletContextListener { - - private static final Log log = LogFactory.getLog(ModelAuditorSetup.class.getName()); - - @Override - public void contextDestroyed(ServletContextEvent arg0) { - // TODO Auto-generated method stub - - } - - - @Override - public void contextInitialized(ServletContextEvent sce) { - ServletContext ctx = sce.getServletContext(); - try { - // the events don't seem to filter down to the writable model of a dynamic union. Bummer. For now we have the ugly workaround of registering twice and recording some duplication. - OntModel ontModel = (OntModel) ctx.getAttribute("baseOntModel"); - Model baseModel = ontModel.getBaseModel(); - OntModel dynamicUnionModel = (OntModel) ctx.getAttribute("jenaOntModel"); - log.debug("Setting model auditor database..."); - OntModel auditModel = ModelFactory.createOntologyModel(MEM_ONT_MODEL_SPEC,makeDBModelFromConfigurationProperties(JENA_AUDIT_MODEL, DB_ONT_MODEL_SPEC, ctx)); - ctx.setAttribute("jenaAuditModel", auditModel); - ModelAuditor ma = new ModelAuditor(auditModel,ontModel); - baseModel.register(ma); - dynamicUnionModel.getBaseModel().register(ma); - log.debug("Successful."); - } catch (Exception e) { - log.error("Unable to use audit model "+JENA_AUDIT_MODEL); - } - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/NamespacePrefixMapSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/NamespacePrefixMapSetup.java deleted file mode 100644 index 54dab91c1..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/NamespacePrefixMapSetup.java +++ /dev/null @@ -1,37 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import java.util.HashMap; -import java.util.List; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import com.hp.hpl.jena.rdf.model.Model; - -public class NamespacePrefixMapSetup implements ServletContextListener { - - public void contextInitialized(ServletContextEvent sce) { - HashMap prefixToNamespace = new HashMap(); - HashMap namespaceToPrefix = new HashMap(); - Model model = (Model) sce.getServletContext().getAttribute("jenaOntModel"); - long start = System.currentTimeMillis(); - int count = 0; - String prefixPrefix = "p"; - for (String ns : (List) model.listNameSpaces().toList() ) { - System.out.println(prefixPrefix+count+" => "+ns); - prefixToNamespace.put(prefixPrefix+count,ns); - namespaceToPrefix.put(ns,prefixPrefix+count); - count++; - } - sce.getServletContext().setAttribute("prefixToNamespaceMap",prefixToNamespace); - sce.getServletContext().setAttribute("namespaceToPrefixMap",namespaceToPrefix); - System.out.println( (System.currentTimeMillis()-start)+" ms to map namespaces"); - } - - public void contextDestroyed(ServletContextEvent sce) { - // - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/NightlyDefragement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/NightlyDefragement.java deleted file mode 100644 index f23a6711b..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/NightlyDefragement.java +++ /dev/null @@ -1,80 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.joda.time.DateTime; - -/** - * This will attempt to run System.gc() once a night. - * - * @author bdc34 - * - */ -public class NightlyDefragement implements ServletContextListener, Runnable { - - private static NightlyDefragement nightlyDefragement = null; - private static boolean stop = false; - private static final Log log = LogFactory.getLog(NightlyDefragement.class); - - protected DateTime lastRun; - - @Override - public void run() { - while( ! stop ){ - DateTime now = new DateTime(); - - if( now.hourOfDay().get() > 0 - && now.hourOfDay().get() < 2 - && lastRun.isBefore( now.minusHours(22) ) ){ - - log.info("running defragement"); - long start = System.currentTimeMillis(); - System.gc(); - log.info("Finished defragement, " + (start - System.currentTimeMillis()) + "msec"); - lastRun = now; - } - - try{ - synchronized( nightlyDefragement ){ - this.wait(30*60*1000); //30 min; - } - }catch( InterruptedException ex){ - log.debug("woken up"); - } - } - log.info(" Stopping NightlyDefragement thread."); - } - - - public void stopNicely(){ - stop = true; - synchronized( nightlyDefragement ){ - nightlyDefragement.notifyAll(); - } - } - - - @Override - public void contextInitialized(ServletContextEvent arg0) { - lastRun = new DateTime().minusHours( 400 ); - if( nightlyDefragement != null ){ - log.warn("NightlyDefragement listener has already been setup. Check your web.xml for duplicate listeners."); - }else{ - nightlyDefragement = this; - Thread thread = new Thread(this , "nightlyDefragementThread"); - thread.start(); - } - } - - @Override - public void contextDestroyed(ServletContextEvent arg0) { - nightlyDefragement.stopNicely(); - } - - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetup.java deleted file mode 100644 index 5a3930c10..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetup.java +++ /dev/null @@ -1,74 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mindswap.pellet.PelletOptions; - -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.vocabulary.OWL; - -import edu.cornell.mannlib.vitro.webapp.config.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; - -public class PelletReasonerSetup implements ServletContextListener { - private static final Log log = LogFactory.getLog(PelletReasonerSetup.class.getName()); - - @Override - public void contextInitialized(ServletContextEvent sce) { - if (true) { - (new SimpleReasonerSetup()).contextInitialized(sce); - return; - // use the simple reasoner instead of Pellet for ABox inferences - // if we're running SDB - } - - // presently unreachable code follows - - try { - - OntModel memoryModel = (OntModel) sce.getServletContext().getAttribute("jenaOntModel"); - OntModel baseModel = (OntModel) sce.getServletContext().getAttribute("baseOntModel"); - OntModel inferenceModel = (OntModel) sce.getServletContext().getAttribute("inferenceOntModel"); - WebappDaoFactoryJena wadf = (WebappDaoFactoryJena) sce.getServletContext().getAttribute("webappDaoFactory"); - - if (!baseModel.getProfile().NAMESPACE().equals(OWL.NAMESPACE.getNameSpace())) { - log.error("Not connecting Pellet reasoner - base model is not an OWL model"); - return; - } - - // Set various Pellet options for incremental consistency checking, etc. - PelletOptions.DL_SAFE_RULES = true; - PelletOptions.USE_COMPLETION_QUEUE = true; - PelletOptions.USE_TRACING = true; - PelletOptions.TRACK_BRANCH_EFFECTS = true; - PelletOptions.USE_INCREMENTAL_CONSISTENCY = true; - PelletOptions.USE_INCREMENTAL_DELETION = true; - - PelletListener pelletListener = new PelletListener(memoryModel,baseModel,inferenceModel,ReasonerConfiguration.DEFAULT); - sce.getServletContext().setAttribute("pelletListener",pelletListener); - sce.getServletContext().setAttribute("pelletOntModel", pelletListener.getPelletModel()); - - if (wadf != null) { - wadf.setPelletListener(pelletListener); - } - - log.info("Pellet reasoner connected"); - - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @Override - public void contextDestroyed(ServletContextEvent arg0) { - // - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetupComplete.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetupComplete.java deleted file mode 100644 index 39e8f83af..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetupComplete.java +++ /dev/null @@ -1,63 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mindswap.pellet.PelletOptions; - -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.vocabulary.OWL; - -import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener; -import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.ReasonerConfiguration; - -public class PelletReasonerSetupComplete implements ServletContextListener { - - private static final Log log = LogFactory.getLog(PelletReasonerSetupComplete.class.getName()); - - public void contextInitialized(ServletContextEvent sce) { - try { - - OntModel memoryModel = (OntModel) sce.getServletContext().getAttribute("jenaOntModel"); - OntModel baseModel = (OntModel) sce.getServletContext().getAttribute("baseOntModel"); - OntModel inferenceModel = (OntModel) sce.getServletContext().getAttribute("inferenceOntModel"); - - if (!baseModel.getProfile().NAMESPACE().equals(OWL.NAMESPACE.getNameSpace())) { - log.error("Not connecting Pellet reasoner - base model is not an OWL model"); - return; - } - - // Set various options - PelletOptions.DL_SAFE_RULES = true; - PelletOptions.USE_COMPLETION_QUEUE = true; - PelletOptions.USE_TRACING = true; - PelletOptions.TRACK_BRANCH_EFFECTS = true; - PelletOptions.USE_INCREMENTAL_CONSISTENCY = true; - PelletOptions.USE_INCREMENTAL_DELETION = true; - - // Pellet 2.0-RC5 is buggy with incremental reasoning through Jena - //PelletOptions.USE_INCREMENTAL_CONSISTENCY = true; - //PelletOptions.USE_INCREMENTAL_DELETION = true; - ReasonerConfiguration config = ReasonerConfiguration.COMPLETE; - config.setIncrementalReasongingEnabled(false); - - PelletListener pelletListener = new PelletListener(memoryModel,baseModel,inferenceModel,config); - sce.getServletContext().setAttribute("pelletListener",pelletListener); - sce.getServletContext().setAttribute("pelletOntModel", pelletListener.getPelletModel()); - - log.debug("Reasoner connected"); - - } catch (Throwable t) { - t.printStackTrace(); - } - } - - public void contextDestroyed(ServletContextEvent arg0) { - // - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetupPseudocomplete.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetupPseudocomplete.java deleted file mode 100644 index cb93eaf69..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetupPseudocomplete.java +++ /dev/null @@ -1,63 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mindswap.pellet.PelletOptions; - -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.vocabulary.OWL; - -import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener; -import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.ReasonerConfiguration; - -public class PelletReasonerSetupPseudocomplete implements ServletContextListener { - - private static final Log log = LogFactory.getLog(PelletReasonerSetupComplete.class.getName()); - - public void contextInitialized(ServletContextEvent sce) { - try { - - OntModel memoryModel = (OntModel) sce.getServletContext().getAttribute("jenaOntModel"); - OntModel baseModel = (OntModel) sce.getServletContext().getAttribute("baseOntModel"); - OntModel inferenceModel = (OntModel) sce.getServletContext().getAttribute("inferenceOntModel"); - - if (!baseModel.getProfile().NAMESPACE().equals(OWL.NAMESPACE.getNameSpace())) { - log.error("Not connecting Pellet reasoner - base model is not an OWL model"); - return; - } - - // Set various options - PelletOptions.DL_SAFE_RULES = true; - PelletOptions.USE_COMPLETION_QUEUE = true; - PelletOptions.USE_TRACING = true; - PelletOptions.TRACK_BRANCH_EFFECTS = true; - PelletOptions.USE_INCREMENTAL_CONSISTENCY = true; - PelletOptions.USE_INCREMENTAL_DELETION = true; - - // Pellet 2.0-RC5 is buggy with incremental reasoning through Jena - //PelletOptions.USE_INCREMENTAL_CONSISTENCY = true; - //PelletOptions.USE_INCREMENTAL_DELETION = true; - ReasonerConfiguration config = ReasonerConfiguration.PSEUDOCOMPLETE; - config.setIncrementalReasongingEnabled(false); - - PelletListener pelletListener = new PelletListener(memoryModel,baseModel,inferenceModel,config); - sce.getServletContext().setAttribute("pelletListener",pelletListener); - sce.getServletContext().setAttribute("pelletOntModel", pelletListener.getPelletModel()); - - log.debug("Reasoner connected"); - - } catch (Throwable t) { - t.printStackTrace(); - } - } - - public void contextDestroyed(ServletContextEvent arg0) { - // - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetupPseudocompleteIgnoreDataproperties.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetupPseudocompleteIgnoreDataproperties.java deleted file mode 100644 index 02bd5b098..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/PelletReasonerSetupPseudocompleteIgnoreDataproperties.java +++ /dev/null @@ -1,60 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mindswap.pellet.PelletOptions; - -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.vocabulary.OWL; - -import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener; -import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.ReasonerConfiguration; - -public class PelletReasonerSetupPseudocompleteIgnoreDataproperties implements - ServletContextListener { - - private static final Log log = LogFactory.getLog(PelletReasonerSetupPseudocompleteIgnoreDataproperties.class.getName()); - - public void contextInitialized(ServletContextEvent sce) { - try { - OntModel memoryModel = (OntModel) sce.getServletContext().getAttribute("jenaOntModel"); - OntModel baseModel = (OntModel) sce.getServletContext().getAttribute("baseOntModel"); - OntModel inferenceModel = (OntModel) sce.getServletContext().getAttribute("inferenceOntModel"); - - if (!baseModel.getProfile().NAMESPACE().equals(OWL.NAMESPACE.getNameSpace())) { - log.error("Not connecting Pellet reasoner - base model is not an OWL model"); - return; - } - - // Set various options - PelletOptions.DL_SAFE_RULES = true; - PelletOptions.USE_COMPLETION_QUEUE = true; - PelletOptions.USE_TRACING = true; - PelletOptions.TRACK_BRANCH_EFFECTS = true; - PelletOptions.USE_INCREMENTAL_CONSISTENCY = true; - PelletOptions.USE_INCREMENTAL_DELETION = true; - - ReasonerConfiguration config = ReasonerConfiguration.PSEUDOCOMPLETE_IGNORE_DATAPROPERTIES; - config.setIncrementalReasongingEnabled(false); - - PelletListener pelletListener = new PelletListener(memoryModel,baseModel,inferenceModel,config); - sce.getServletContext().setAttribute("pelletListener",pelletListener); - sce.getServletContext().setAttribute("pelletOntModel", pelletListener.getPelletModel()); - - log.debug("Reasoner connected"); - - } catch (Throwable t) { - t.printStackTrace(); - } - } - - public void contextDestroyed(ServletContextEvent arg0) { - // nothing to worry about - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/RDFSReasonerSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/RDFSReasonerSetup.java deleted file mode 100644 index 2e22e00e3..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/RDFSReasonerSetup.java +++ /dev/null @@ -1,53 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.servlet.setup; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mindswap.pellet.PelletOptions; - -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.dao.jena.pellet.PelletListener; -import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.ReasonerConfiguration; - -public class RDFSReasonerSetup implements ServletContextListener { - - private static final Log log = LogFactory.getLog(PelletReasonerSetupComplete.class.getName()); - - /** - * This ContextListener uses the infrastructure designed for Pellet, but switches the OntModelSpec - * to use Jena's RDFS reasoner. Pellet itself is not used, despite the current names of some of the - * classes involved. - */ - public void contextInitialized(ServletContextEvent sce) { - - try { - - OntModel memoryModel = (OntModel) sce.getServletContext().getAttribute("jenaOntModel"); - OntModel baseModel = (OntModel) sce.getServletContext().getAttribute("baseOntModel"); - OntModel inferenceModel = (OntModel) sce.getServletContext().getAttribute("inferenceOntModel"); - - ReasonerConfiguration configuration = ReasonerConfiguration.COMPLETE; - configuration.setOntModelSpec(OntModelSpec.RDFS_MEM_RDFS_INF); - PelletListener pelletListener = new PelletListener(memoryModel,baseModel,inferenceModel,configuration); - sce.getServletContext().setAttribute("pelletListener",pelletListener); - sce.getServletContext().setAttribute("pelletOntModel", pelletListener.getPelletModel()); - - log.debug("RDFS reasoner connected"); - - } catch (Throwable t) { - t.printStackTrace(); - } - } - - public void contextDestroyed(ServletContextEvent arg0) { - // - } - -} diff --git a/webapp/web/templates/freemarker/body/admin/startupStatus-display.ftl b/webapp/web/templates/freemarker/body/admin/startupStatus-display.ftl index e76332f7b..e0a0a4ce3 100644 --- a/webapp/web/templates/freemarker/body/admin/startupStatus-display.ftl +++ b/webapp/web/templates/freemarker/body/admin/startupStatus-display.ftl @@ -44,9 +44,6 @@ ${stylesheets.add('Continue -

<#list status.errorItems as item> <@statusItem item=item /> @@ -55,9 +52,6 @@ ${stylesheets.add('Continue -

<#list status.warningItems as item> <@statusItem item=item />