com.hp.hpl.jena.reasoner.transitiveReasoner
Class TransitiveEngine

java.lang.Object
  extended by com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveEngine

public class TransitiveEngine
extends java.lang.Object

Uses two transitive graph caches to store a subclass and a subproperty lattice and use them within a larger inference graph.

Version:
$Revision: 1.1 $ on $Date: 2009/06/29 08:55:57 $
Author:
Dave Reynolds

Field Summary
static Node directSubClassOf
          The direct (minimal) version of the subClassOf property
static Node directSubPropertyOf
          The direct (minimal) version of the subPropertyOf property
static Node subClassOf
          The normal subClassOf property
static Node subPropertyOf
          The normal subPropertyOf property
 
Constructor Summary
TransitiveEngine(TransitiveEngine tengine)
          Constructor.
TransitiveEngine(TransitiveGraphCache subClassCache, TransitiveGraphCache subPropertyCache)
          Constructor.
 
Method Summary
 boolean add(Triple t)
          Add one triple to caches if it is relevant.
static boolean cacheSubClassUtility(Finder graph, TransitiveGraphCache spCache, TransitiveGraphCache scCache)
          Caches all subClass declarations, including those that are defined via subProperties of subClassOf.
static boolean cacheSubPropUtility(Finder graph, TransitiveGraphCache spCache)
          Caches all subPropertyOf declarations, including any meta level ones (subPropertyOf subPropertyOf).
 boolean checkOccurance(Node prop, Graph graph)
          Test if there are any usages of prop within the given graph.
 boolean delete(Triple t)
          Removes the triple t (if relevant) from the caches.
 Finder getFinder(TriplePattern pattern, Finder continuation)
          Return a Finder instance appropriate for the given query.
 TransitiveGraphCache getSubClassCache()
          Return the cache of the subclass lattice.
 TransitiveGraphCache getSubPropertyCache()
          Return the cache of the subclass lattice.
 Finder insert(Finder baseData, FGraph newData)
          Prepare the engine by inserting any new data not already included in the existing caches.
 void setCaching(boolean cacheSP, boolean cacheSC)
          Set the closure caching flags.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

directSubPropertyOf

public static Node directSubPropertyOf
The direct (minimal) version of the subPropertyOf property


directSubClassOf

public static Node directSubClassOf
The direct (minimal) version of the subClassOf property


subPropertyOf

public static Node subPropertyOf
The normal subPropertyOf property


subClassOf

public static Node subClassOf
The normal subClassOf property

Constructor Detail

TransitiveEngine

public TransitiveEngine(TransitiveGraphCache subClassCache,
                        TransitiveGraphCache subPropertyCache)
Constructor.

Parameters:
subClassCache - pre-initialized subclass TGC
subPropertyCache - pre-initialized subproperty TGC

TransitiveEngine

public TransitiveEngine(TransitiveEngine tengine)
Constructor.

Parameters:
tengine - an instance of TransitiveEngine to be cloned
Method Detail

insert

public Finder insert(Finder baseData,
                     FGraph newData)
Prepare the engine by inserting any new data not already included in the existing caches.

Parameters:
baseData - the base dataset on which the initial caches were based, could be null
newData - a dataset to be added to the engine, not known to be already included in the caches from construction time
Returns:
a concatenation of the inserted data and the original data

getSubClassCache

public TransitiveGraphCache getSubClassCache()
Return the cache of the subclass lattice.


getSubPropertyCache

public TransitiveGraphCache getSubPropertyCache()
Return the cache of the subclass lattice.


setCaching

public void setCaching(boolean cacheSP,
                       boolean cacheSC)
Set the closure caching flags.

Parameters:
cacheSP - true if caching of subPropertyOf closure is wanted
cacheSC - true if caching of subClassOf closure is wanted

getFinder

public Finder getFinder(TriplePattern pattern,
                        Finder continuation)
Return a Finder instance appropriate for the given query.


add

public boolean add(Triple t)
Add one triple to caches if it is relevant.

Returns:
true if the triple affected the caches

delete

public boolean delete(Triple t)
Removes the triple t (if relevant) from the caches.

Returns:
true if the triple affected the caches

checkOccurance

public boolean checkOccurance(Node prop,
                              Graph graph)
Test if there are any usages of prop within the given graph. This includes indirect usages incurred by subProperties of prop.

Parameters:
prop - the property to be checked for
graph - the graph to be check
Returns:
true if there is a triple using prop or one of its sub properties

cacheSubClassUtility

public static boolean cacheSubClassUtility(Finder graph,
                                           TransitiveGraphCache spCache,
                                           TransitiveGraphCache scCache)
Caches all subClass declarations, including those that are defined via subProperties of subClassOf. Public to allow other reasoners to use it but not of interest to end users.

Parameters:
graph - a graph whose declarations are to be cached
spCache - the existing state of the subPropertyOf cache
scCache - the existing state of the subClassOf cache, will be updated
Returns:
true if there were new metalevel declarations discovered.

cacheSubPropUtility

public static boolean cacheSubPropUtility(Finder graph,
                                          TransitiveGraphCache spCache)
Caches all subPropertyOf declarations, including any meta level ones (subPropertyOf subPropertyOf). Public to allow other reasoners to use it but not of interest to end users.

Parameters:
graph - a graph whose declarations are to be cached
spCache - the existing state of the subPropertyOf cache, will be updated
Returns:
true if there were new metalevel declarations discovered.


Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP