public void initialize() throws ThinklabException { /* link and initialize knowledge repository */ knowledgeRepository.initialize(); /* see if the preferences override the thinklab core ontology URL */ String cont = LocalConfiguration.getProperties() .getProperty("thinklab.ontology.core", DEFAULT_CORE_ONTOLOGY); URL tco = Thinklab.get().getResourceURL(cont); knowledgeRepository.refreshOntology(tco, MiscUtilities.getNameFromURL(cont), true); /* initialize types before we register plugins */ initializeThinklabTypes(); /* initialize default blacklists */ String blk = LocalConfiguration.getProperties().getProperty(IGNORE_PROPERTY_PROPERTY); if (blk != null) { String[] bk = blk.trim().split(","); for (String s : bk) { KnowledgeManager.get().blacklistProperty(s); } } blk = LocalConfiguration.getProperties().getProperty(IGNORE_CONCEPT_PROPERTY); if (blk != null) { String[] bk = blk.trim().split(","); for (String s : bk) { KnowledgeManager.get().blacklistConcept(s); } } commandManager = new CommandManager(); Thinklab.get().logger().info("knowledge manager initialized successfully"); }
/** * This should become the default constructor: the class of knowledge repository and session * manager is stated in the properties, defaulting to the ones we trust. * * @param fileKnowledgeRepository * @throws ThinklabIOException */ public KnowledgeManager() throws ThinklabException { KM = this; String smClass = Thinklab.get() .getProperties() .getProperty( "thinklab.sessionmanager.class", "org.integratedmodelling.thinklab.session.SingleSessionManager"); String krClass = Thinklab.get() .getProperties() .getProperty( "thinklab.repository.class", "org.integratedmodelling.thinklab.owlapi.FileKnowledgeRepository"); IKnowledgeRepository kr = null; ISessionManager sm = null; Class<?> cls = null; try { cls = Thinklab.get().getClassLoader().loadClass(smClass); sm = (ISessionManager) cls.newInstance(); cls = Thinklab.get().getClassLoader().loadClass(krClass); kr = (IKnowledgeRepository) cls.newInstance(); } catch (Exception e) { throw new ThinklabValidationException(e); } knowledgeRepository = kr; sessionManager = sm; this.start = new Date(); }