Java Doc for TransitiveGraphCache.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » reasoner » transitiveReasoner » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.reasoner.transitiveReasoner 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveGraphCache

TransitiveGraphCache
public class TransitiveGraphCache implements Finder(Code)
Datastructure used to represent a closed transitive reflexive relation. It (mostly) incrementally maintains a transitive reduction and transitive closure of the relationship and so queries should be faster than dynamically computing the closed or reduced relations.

The implementation stores the reduced and closed relations as real graph (objects linked together by pointers). For each graph node we store its direct predecessors and successors and its closed successors. A cost penalty is the storage turnover involved in turning the graph representation back into triples to answer queries. We could avoid this by optionally also storing the manifested triples for the links.

Cycles are currently handled by collapsing strongly connected components. Incremental deletes would be possible but at the price of substanially more storage and code complexity. We compromise by doing the easy cases incrementally but some deletes (those that break strongly connected components) will trigger a fresh rebuild.

TODO Combine this with interval indexes (Agrawal, Borigda and Jagadish 1989) for storing the closure of the predecessor relationship. Typical graphs will be nearly tree shaped so the successor closure is modest (L^2 where L is the depth of the tree branch) but the predecessor closure would be expensive. The interval index would handle predecessor closure nicely.


author:
   Dave Reynolds
version:
   $Revision: 1.24 $

Inner Class :static interface Visitor

Field Summary
protected  booleancacheTriples
     Flag controlling the whether the triples representing the closed relation should also be cached.
protected  NodeclosedPredicate
    
protected  SetdeletesPending
    
protected  NodedirectPredicate
    
protected  HashMapnodeMap
     Map from RDF Node to the corresponding Graph node.
protected  SetoriginalTriples
    

Constructor Summary
public  TransitiveGraphCache(Node directPredicate, Node closedPredicate)
     Constructor - create a new cache to hold the given relation information.

Method Summary
public synchronized  voidaddRelation(Triple t)
    
public  booleancacheAll(Finder graph, Node predicate)
     Cache all instances of the given predicate which are present in the given Graph.
public  voidclear()
     Clear the entire cache contents.
public  booleancontains(TriplePattern pattern)
     Return true if the given pattern occurs somewhere in the find sequence.
public  TransitiveGraphCachedeepCopy()
     Create a deep copy of the cache contents.
public  Stringdump()
     Dump a description of the cache to a string for debug.
public  ExtendedIteratorfind(TriplePattern pattern)
     Basic pattern lookup interface.
public  ExtendedIteratorfindWithContinuation(TriplePattern pattern, Finder continuation)
     Extended find interface used in situations where the implementator may or may not be able to answer the complete query.
public  NodegetClosedPredicate()
     Returns the closedPredicate.
public  NodegetDirectPredicate()
     Returns the directPredicate.
public  booleanisSubject(Node node)
    
public  ExtendedIteratorlistAllSubjects()
    
public  voidremoveRelation(Triple t)
     Remove an instance of a relation from the cache.
public  voidsetCaching(boolean enable)
     Enable/disabling caching of the Triples representing the relationships.

Field Detail
cacheTriples
protected boolean cacheTriples(Code)
Flag controlling the whether the triples representing the closed relation should also be cached.



closedPredicate
protected Node closedPredicate(Code)
The RDF predicate representing the closed relation



deletesPending
protected Set deletesPending(Code)
A list of pending deletes which break the cycle-free normal form



directPredicate
protected Node directPredicate(Code)
The RDF predicate representing the direct relation



nodeMap
protected HashMap nodeMap(Code)
Map from RDF Node to the corresponding Graph node.



originalTriples
protected Set originalTriples(Code)
The original triples, needed for processing delete operations because some information is lost in the SCC process




Constructor Detail
TransitiveGraphCache
public TransitiveGraphCache(Node directPredicate, Node closedPredicate)(Code)
Constructor - create a new cache to hold the given relation information.
Parameters:
  directPredicate - The RDF predicate representing the direct relation
Parameters:
  closedPredicate - The RDF predicate representing the closed relation




Method Detail
addRelation
public synchronized void addRelation(Triple t)(Code)
Register a new relation instance in the cache



cacheAll
public boolean cacheAll(Finder graph, Node predicate)(Code)
Cache all instances of the given predicate which are present in the given Graph.
Parameters:
  graph - the searchable set of triples to cache
Parameters:
  predicate - the predicate to cache, need not be the registeredpredicate due to subProperty declarations returns true if new information has been cached



clear
public void clear()(Code)
Clear the entire cache contents.



contains
public boolean contains(TriplePattern pattern)(Code)
Return true if the given pattern occurs somewhere in the find sequence.



deepCopy
public TransitiveGraphCache deepCopy()(Code)
Create a deep copy of the cache contents. Works by creating a completely new cache and just adding in the direct links.



dump
public String dump()(Code)
Dump a description of the cache to a string for debug.



find
public ExtendedIterator find(TriplePattern pattern)(Code)
Basic pattern lookup interface.
Parameters:
  pattern - a TriplePattern to be matched against the data a ExtendedIterator over all Triples in the data setthat match the pattern



findWithContinuation
public ExtendedIterator findWithContinuation(TriplePattern pattern, Finder continuation)(Code)
Extended find interface used in situations where the implementator may or may not be able to answer the complete query.

In this case any query on the direct or closed predicates will be assumed complete, any other query will pass on to the continuation.


Parameters:
  pattern - a TriplePattern to be matched against the data
Parameters:
  continuation - either a Finder or a normal Graph whichwill be asked for additional match results if the implementormay not have completely satisfied the query.



getClosedPredicate
public Node getClosedPredicate()(Code)
Returns the closedPredicate. Node



getDirectPredicate
public Node getDirectPredicate()(Code)
Returns the directPredicate. Node



isSubject
public boolean isSubject(Node node)(Code)
Return true if the given Node is registered as a subject node



listAllSubjects
public ExtendedIterator listAllSubjects()(Code)
Return an iterator over all registered subject nodes



removeRelation
public void removeRelation(Triple t)(Code)
Remove an instance of a relation from the cache.



setCaching
public void setCaching(boolean enable)(Code)
Enable/disabling caching of the Triples representing the relationships. If this is enabled then a number of triples quadratic in the graph depth will be stored. If it is disabled then all queries will turn over storage dynamically creating the result triples.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.