From: <jen...@us...> - 2010-03-23 16:26:17
|
Revision: 2128 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2128&view=rev Author: jenslehmann Date: 2010-03-23 16:26:07 +0000 (Tue, 23 Mar 2010) Log Message: ----------- implemented option "useDatabaseCache" in SPARQL component Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/configurators/CELOEConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java Modified: trunk/src/dl-learner/org/dllearner/core/configurators/CELOEConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/CELOEConfigurator.java 2010-03-23 14:32:33 UTC (rev 2127) +++ trunk/src/dl-learner/org/dllearner/core/configurators/CELOEConfigurator.java 2010-03-23 16:26:07 UTC (rev 2128) @@ -202,7 +202,7 @@ return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "instanceBasedDisjoints") ; } /** -* filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base.. +* filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base. Be careful, since this requires a potentially expensive consistency check for candidate solutions.. * mandatory: false| reinit necessary: true * default value: false * @return boolean @@ -365,7 +365,7 @@ reinitNecessary = true; } /** -* @param filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base.. +* @param filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base. Be careful, since this requires a potentially expensive consistency check for candidate solutions.. * mandatory: false| reinit necessary: true * default value: false **/ Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java 2010-03-23 14:32:33 UTC (rev 2127) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java 2010-03-23 16:26:07 UTC (rev 2128) @@ -178,26 +178,6 @@ return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(rOLComponent2, "ignoredConcepts") ; } /** -* allowedRoles roles the algorithm is allowed to use. -* mandatory: false| reinit necessary: true -* default value: null -* @return Set(String) -**/ -@SuppressWarnings("unchecked") -public Set<String> getAllowedRoles() { -return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(rOLComponent2, "allowedRoles") ; -} -/** -* ignoredRoles roles the algorithm must ignore. -* mandatory: false| reinit necessary: true -* default value: null -* @return Set(String) -**/ -@SuppressWarnings("unchecked") -public Set<String> getIgnoredRoles() { -return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(rOLComponent2, "ignoredRoles") ; -} -/** * useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm. * mandatory: false| reinit necessary: true * default value: true @@ -550,24 +530,6 @@ reinitNecessary = true; } /** -* @param allowedRoles roles the algorithm is allowed to use. -* mandatory: false| reinit necessary: true -* default value: null -**/ -public void setAllowedRoles(Set<String> allowedRoles) { -ComponentManager.getInstance().applyConfigEntry(rOLComponent2, "allowedRoles", allowedRoles); -reinitNecessary = true; -} -/** -* @param ignoredRoles roles the algorithm must ignore. -* mandatory: false| reinit necessary: true -* default value: null -**/ -public void setIgnoredRoles(Set<String> ignoredRoles) { -ComponentManager.getInstance().applyConfigEntry(rOLComponent2, "ignoredRoles", ignoredRoles); -reinitNecessary = true; -} -/** * @param useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm. * mandatory: false| reinit necessary: true * default value: true Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2010-03-23 14:32:33 UTC (rev 2127) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2010-03-23 16:26:07 UTC (rev 2128) @@ -85,6 +85,15 @@ return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useCache") ; } /** +* useCacheDatabase If true, H2 database is used, otherwise one file per query is written.. +* mandatory: false| reinit necessary: true +* default value: false +* @return boolean +**/ +public boolean getUseCacheDatabase() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useCacheDatabase") ; +} +/** * instances relevant instances e.g. positive and negative examples in a learning problem. * mandatory: true| reinit necessary: true * default value: null @@ -300,6 +309,15 @@ reinitNecessary = true; } /** +* @param useCacheDatabase If true, H2 database is used, otherwise one file per query is written.. +* mandatory: false| reinit necessary: true +* default value: false +**/ +public void setUseCacheDatabase(boolean useCacheDatabase) { +ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useCacheDatabase", useCacheDatabase); +reinitNecessary = true; +} +/** * @param instances relevant instances e.g. positive and negative examples in a learning problem. * mandatory: true| reinit necessary: true * default value: null Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2010-03-23 14:32:33 UTC (rev 2127) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2010-03-23 16:26:07 UTC (rev 2128) @@ -129,7 +129,10 @@ * Where the base path to the cache is . */ public Cache(String cacheDir) { - + this(cacheDir, false); + } + + public Cache(String cacheDir, boolean useDatabase) { this.cacheDir = cacheDir + File.separator; if (!new File(cacheDir).exists()) { Files.mkdir(cacheDir); @@ -138,9 +141,9 @@ if(useDatabase) { h2 = new ExtractionDBCache(); - } + } } - + // compute md5-hash private String getHash(String string) { Monitor hashTime = JamonMonitorLogger.getTimeMonitor(Cache.class, "HashTime").start(); Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2010-03-23 14:32:33 UTC (rev 2127) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2010-03-23 16:26:07 UTC (rev 2128) @@ -142,6 +142,7 @@ false, true)); options.add(new BooleanConfigOption("useCache", "If true a Cache is used", true, false, true)); + options.add(new BooleanConfigOption("useCacheDatabase", "If true, H2 database is used, otherwise one file per query is written.", false)); options .add(new StringSetConfigOption( "instances", @@ -414,7 +415,7 @@ // get Options for endpoints if (configurator.getUseCache()){ - return new SPARQLTasks(new Cache(configurator.getCacheDir()), + return new SPARQLTasks(new Cache(configurator.getCacheDir(), configurator.getUseCacheDatabase()), getSparqlEndpoint()); }else { return new SPARQLTasks(getSparqlEndpoint()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |