|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dllearner.kb.sparql.Cache
public class Cache
SPARQL query cache to avoid possibly expensive multiple queries. The queries and their results are written to files. A cache has an associated cache directory where all files are written. Each SPARQL query and its result is written to one file. The name of this file is a hash of the query. The result of the query is written as JSON serialisation of the SPARQL XML result, see http://www.w3.org/TR/rdf-sparql-json-res/. Apart from the query and its result, a timestamp of the query is stored. After a configurable amount of time, query results are considered outdated. If a cached result of a SPARQL query exists, but is too old, the cache behaves as if the cached result would not exist. TODO: We are doing md5 hashing at the moment, so in rare cases different SPARQL queries can be mapped to the same file. Support for such scenarios needs to be included.
| Constructor Summary | |
|---|---|
Cache(String cacheDir)
Constructor for the cache itself. |
|
| Method Summary | |
|---|---|
void |
clearCache()
deletes all Files in the cacheDir, does not delete the cacheDir itself, and can thus still be used without creating a new Cache Object |
String |
executeSparqlQuery(SparqlQuery query)
Takes a SPARQL query (which has not been evaluated yet) as argument and returns a JSON result set. |
static Cache |
getDefaultCache()
|
static String |
getDefaultCacheDir()
the default cachedir normally is "cache". |
static String |
getPersistantCacheDir()
a more persistant cache used for example generation." |
static Cache |
getPersistentCache()
A Persistant cache is stored in the folder cachePersistant. |
void |
setFreshnessInDays(int days)
Changes how long cached results will stay fresh (default 15 days). |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Cache(String cacheDir)
cacheDir - Where the base path to the cache is .| Method Detail |
|---|
public static Cache getPersistentCache()
public static Cache getDefaultCache()
public static String getDefaultCacheDir()
public static String getPersistantCacheDir()
public String executeSparqlQuery(SparqlQuery query)
query - The SPARQL query.
public void clearCache()
public void setFreshnessInDays(int days)
days - number of days
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||