net.fortytwo.linkeddata
Class LinkedDataCache

java.lang.Object
  extended by net.fortytwo.linkeddata.LinkedDataCache

public class LinkedDataCache
extends Object

A manager for a dynamic set of RDF graphs collected from the Web. The cache uses configurable URI dereferencers and RDFizers to fetch and translate documents, and connects to an RDF triple store which provides a unified view of the Web of Data.

Author:
Joshua Shinavier (http://fortytwo.net)

Field Summary
static org.openrdf.model.URI CACHE_GRAPH
           
static org.openrdf.model.URI CACHE_MEMO
           
static String CACHE_NS
           
 
Constructor Summary
LinkedDataCache(org.openrdf.sail.Sail sail)
           
 
Method Summary
 void addDereferencer(String scheme, Dereferencer dref)
          Associates a dereferencer with a given URI scheme.
 void addRdfizer(org.restlet.data.MediaType mediaType, Rdfizer rdfizer, double qualityFactor)
          Associates an rdfizer with a given media type.
static LinkedDataCache createDefault(org.openrdf.sail.Sail sail)
          Constructs a cache with the default settings, dereferencers, and rdfizers.
 String getAcceptHeader()
           
 boolean getDereferenceContexts()
           
 boolean getDereferenceObjects()
           
 boolean getDereferencePredicates()
           
 boolean getDereferenceSubjects()
           
 net.fortytwo.ripple.URIMap getURIMap()
           
 boolean isAutoCommit()
           
 CacheEntry.Status retrieveUri(org.openrdf.model.URI uri, org.openrdf.sail.SailConnection sc)
          Retrieves caching metadata for a URI, possibly dereferencing a document from the Web first.
 void setAutoCommit(boolean autoCommit)
           
 void setDereferenceContexts(boolean flag)
           
 void setDereferenceObjects(boolean flag)
           
 void setDereferencePredicates(boolean flag)
           
 void setDereferenceSubjects(boolean flag)
           
 void setExpirationPolicy(CacheExpirationPolicy expirationPolicy)
           
 void setURIMap(net.fortytwo.ripple.URIMap map)
          Defines an application-specific mapping for URIs dereferenced by the cache, in the manner of a Web proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_NS

public static final String CACHE_NS
See Also:
Constant Field Values

CACHE_MEMO

public static final org.openrdf.model.URI CACHE_MEMO

CACHE_GRAPH

public static final org.openrdf.model.URI CACHE_GRAPH
Constructor Detail

LinkedDataCache

public LinkedDataCache(org.openrdf.sail.Sail sail)
                throws net.fortytwo.ripple.RippleException
Parameters:
sail - underlying triple store for the cache
Throws:
net.fortytwo.ripple.RippleException - if there is a configuration error
Method Detail

createDefault

public static LinkedDataCache createDefault(org.openrdf.sail.Sail sail)
                                     throws net.fortytwo.ripple.RippleException
Constructs a cache with the default settings, dereferencers, and rdfizers.

Parameters:
sail - the underlying triple store for the cache
Returns:
the default cache
Throws:
net.fortytwo.ripple.RippleException - if construction fails for any reason

getURIMap

public net.fortytwo.ripple.URIMap getURIMap()
Returns:
an application-specific mapping for URIs dereferenced by the cache, or null no mapping is used

setURIMap

public void setURIMap(net.fortytwo.ripple.URIMap map)
Defines an application-specific mapping for URIs dereferenced by the cache, in the manner of a Web proxy.

Parameters:
map - the mapping

getAcceptHeader

public String getAcceptHeader()
Returns:
an HTTP "Accept" header which matches the cache's collection of rdfizers

addRdfizer

public void addRdfizer(org.restlet.data.MediaType mediaType,
                       Rdfizer rdfizer,
                       double qualityFactor)
Associates an rdfizer with a given media type.

Parameters:
mediaType - a MIME type, e.g. "application/rdf+xml", "image/tiff"
rdfizer - the associated rdfizer
qualityFactor - a quality value ranging from 0 to 1 which expresses the client's preference for the given media type. This value is used for HTTP content negotiation.

addDereferencer

public void addDereferencer(String scheme,
                            Dereferencer dref)
Associates a dereferencer with a given URI scheme.

Parameters:
scheme - the name of the URI scheme (e.g. "http", "ftp", "file", "jar")
dref - the associated dereferencer

retrieveUri

public CacheEntry.Status retrieveUri(org.openrdf.model.URI uri,
                                     org.openrdf.sail.SailConnection sc)
                              throws net.fortytwo.ripple.RippleException
Retrieves caching metadata for a URI, possibly dereferencing a document from the Web first.

Parameters:
uri - the URI to dereference
sc - a connection to a Sail
Returns:
the result of the dereferencing operation
Throws:
net.fortytwo.ripple.RippleException - if retrieval fails for any reason

isAutoCommit

public boolean isAutoCommit()
Returns:
whether the cache commits to the triple store after each Web request (true by default)

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Parameters:
autoCommit - whether the cache should commit to the triple store after each Web request (true by default)

setExpirationPolicy

public void setExpirationPolicy(CacheExpirationPolicy expirationPolicy)
Parameters:
expirationPolicy - the rule by which the cache determines whether a cache entry has expired. If an entry has expired, the cache will issue a new request in order to refresh it.

getDereferenceSubjects

public boolean getDereferenceSubjects()

setDereferenceSubjects

public void setDereferenceSubjects(boolean flag)

getDereferencePredicates

public boolean getDereferencePredicates()

setDereferencePredicates

public void setDereferencePredicates(boolean flag)

getDereferenceObjects

public boolean getDereferenceObjects()

setDereferenceObjects

public void setDereferenceObjects(boolean flag)

getDereferenceContexts

public boolean getDereferenceContexts()

setDereferenceContexts

public void setDereferenceContexts(boolean flag)


Copyright © 2007-2013. All Rights Reserved.