Class TransitiveEngine
- java.lang.Object
-
- org.apache.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.
-
-
Field Summary
Fields Modifier and Type Field Description static Node
directSubClassOf
The direct (minimal) version of the subClassOf propertystatic Node
directSubPropertyOf
The direct (minimal) version of the subPropertyOf propertystatic Node
subClassOf
The normal subClassOf propertystatic Node
subPropertyOf
The normal subPropertyOf property
-
Constructor Summary
Constructors Constructor Description TransitiveEngine(TransitiveEngine tengine)
Constructor.TransitiveEngine(TransitiveGraphCache subClassCache, TransitiveGraphCache subPropertyCache)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
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 TGCsubPropertyCache
- 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 nullnewData
- 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 wantedcacheSC
- 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 forgraph
- 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 cachedspCache
- the existing state of the subPropertyOf cachescCache
- 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 cachedspCache
- the existing state of the subPropertyOf cache, will be updated- Returns:
- true if there were new metalevel declarations discovered.
-
-