edu.unika.aifb.rdf.crawler
Class Cache

java.lang.Object
  |
  +--edu.unika.aifb.rdf.crawler.Cache

public class Cache
extends java.lang.Object

This is a top-level class responsible for the mapping of URIs to filepaths, streams or symbolic strings. For better performance we may want to store all files the RDF Crawler encounters on the file system. Thus repeated usage of RDF Crawler for similar input data may give a significant performance boost. This is essential, if we are building different "cross-sections" of RDF models from the same data. In most cases we want to cache ontologies, so that interpretation of data found in RDF markup is not dependent on whether we succeed to download, say, DAML schema from the network in every particular case.


Constructor Summary
Cache()
          Make either an empty cache or a cache with 5 default items
 
Method Summary
 void insert(java.lang.String uristring, java.lang.String filepath)
          Insert an URI-filename pair in the cache
 java.lang.String lookup(java.lang.String uristring)
          Look up an URI in the cache
static void main(java.lang.String[] args)
          Test whether the data structure used for cache functions properly
 java.lang.StringBuffer readAsString(java.lang.String uri, java.lang.String p_uri)
          This utility function reads a file contents in a String buffer and returns it
 java.lang.String toString()
          Prints a table of cache mappings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cache

public Cache()
Make either an empty cache or a cache with 5 default items
Method Detail

lookup

public java.lang.String lookup(java.lang.String uristring)
Look up an URI in the cache

insert

public void insert(java.lang.String uristring,
                   java.lang.String filepath)
Insert an URI-filename pair in the cache

readAsString

public java.lang.StringBuffer readAsString(java.lang.String uri,
                                           java.lang.String p_uri)
                                    throws java.io.FileNotFoundException,
                                           java.io.IOException
This utility function reads a file contents in a String buffer and returns it

toString

public java.lang.String toString()
Prints a table of cache mappings
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
Test whether the data structure used for cache functions properly