From: <lor...@us...> - 2013-06-21 13:36:23
|
Revision: 4004 http://sourceforge.net/p/dl-learner/code/4004 Author: lorenz_b Date: 2013-06-21 13:36:20 +0000 (Fri, 21 Jun 2013) Log Message: ----------- Added namespace filter. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java 2013-06-18 15:14:54 UTC (rev 4003) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java 2013-06-21 13:36:20 UTC (rev 4004) @@ -94,7 +94,6 @@ @ConfigOption(name = "useCache", description = "Whether to use a DB cache", defaultValue = "true", required = false, propertyEditorClass = BooleanEditor.class) private boolean useCache = true; - private ExtractionDBCache cache; private QueryExecutionFactory qef; private SparqlEndpointKS ks; @@ -111,18 +110,11 @@ public SPARQLReasoner(SparqlEndpointKS ks) { - this.ks = ks; - - if(useCache){ - cache = new ExtractionDBCache("cache"); - } - classPopularityMap = new HashMap<NamedClass, Integer>(); - objectPropertyPopularityMap = new HashMap<ObjectProperty, Integer>(); + this(ks, (String)null); } - - public SPARQLReasoner(SparqlEndpointKS ks, ExtractionDBCache cache) { + + public SPARQLReasoner(SparqlEndpointKS ks, String cacheDirectory) { this.ks = ks; - this.cache = cache; classPopularityMap = new HashMap<NamedClass, Integer>(); objectPropertyPopularityMap = new HashMap<ObjectProperty, Integer>(); @@ -130,10 +122,10 @@ if(ks.isRemote()){ SparqlEndpoint endpoint = ks.getEndpoint(); qef = new QueryExecutionFactoryHttp(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()); - if(cache != null){ + if(cacheDirectory != null){ try { long timeToLive = TimeUnit.DAYS.toMillis(30); - CacheCoreEx cacheBackend = CacheCoreH2.create(cache.getCacheDirectory(), timeToLive, true); + CacheCoreEx cacheBackend = CacheCoreH2.create(cacheDirectory, timeToLive, true); CacheEx cacheFrontend = new CacheExImpl(cacheBackend); qef = new QueryExecutionFactoryCacheEx(qef, cacheFrontend); } catch (ClassNotFoundException e) { @@ -149,6 +141,10 @@ } } + public SPARQLReasoner(SparqlEndpointKS ks, ExtractionDBCache cache) { + this(ks, cache.getCacheDirectory()); + } + public SPARQLReasoner(OntModel model) { this.model = model; @@ -1410,7 +1406,7 @@ } public void setCache(ExtractionDBCache cache) { - this.cache = cache; +// this.cache = cache; } public void setUseCache(boolean useCache) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |