Java Doc for RETEEngine.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » reasoner » rulesys » impl » 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.rulesys.impl 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.hp.hpl.jena.reasoner.rulesys.impl.RETEEngine

RETEEngine
public class RETEEngine implements FRuleEngineI(Code)
A RETE version of the the forward rule system engine. It neeeds to reference an enclosing ForwardInfGraphI which holds the raw data and deductions.
author:
   Dave Reynolds
version:
   $Revision: 1.30 $ on $Date: 2008/01/02 12:06:16 $

Inner Class :protected static class ClausePointer
Inner Class :public static class RuleStore

Field Summary
protected  ListaddsPending
    
protected  OneToManyMapclauseIndex
    
protected  RETEConflictSetconflictSet
    
protected  ListdeletesPending
    
protected  ForwardRuleInfGraphIinfGraph
    
 booleanisMonotonic
    
protected static  Loglogger
    
 longnRulesFired
    
protected  HashSetpredicatesUsed
    
 booleanprocessedAxioms
    
protected  booleanrecordDerivations
    
protected  Listrules
    
protected  booleanwildcardRule
    

Constructor Summary
public  RETEEngine(ForwardRuleInfGraphI parent, List rules)
     Constructor.
public  RETEEngine(ForwardRuleInfGraphI parent)
     Constructor.

Method Summary
public synchronized  voidadd(Triple t)
     Add one triple to the data graph, run any rules triggered by the new data item, recursively adding any generated triples.
public synchronized  voidaddTriple(Triple triple, boolean deduction)
     Add a new triple to the network.
public  voidcompile(List rules, boolean ignoreBrules)
     Compile a list of rules into the internal rule store representation.
protected  RETETerminalcreateTerminal(Rule rule)
     Create a terminal node for the RETE network.
public synchronized  booleandelete(Triple t)
     Remove one triple to the data graph.
public synchronized  voiddeleteTriple(Triple triple, boolean deduction)
     Remove a new triple from the network.
public  voidfastInit(Finder inserts)
     Process all available data.
protected  voidfindAndProcessActions()
    
protected  voidfindAndProcessAxioms()
    
public  longgetNRulesFired()
    
public  ObjectgetRuleStore()
     Access the precomputed internal rule form.
protected  voidincRuleCount()
     Increment the rule firing count, called by the terminal nodes in the network.
public  voidinit(boolean ignoreBrules, Finder inserts)
     Process all available data.
protected synchronized  TriplenextAddTriple()
     Find the next pending add triple.
protected synchronized  TriplenextDeleteTriple()
     Find the next pending add triple.
public  voidrequestRuleFiring(Rule rule, BindingEnvironment env, boolean isAdd)
     Add a rule firing request to the conflict set.
public  voidrunAll()
     Process the queue of pending insert/deletes until the queues are empty.
public  voidsetDerivationLogging(boolean recordDerivations)
    
public  voidsetRuleStore(Object ruleStore)
     Set the internal rule from from a precomputed state.
public  booleanshouldTrace()
     Return true if the internal engine state means that tracing is worthwhile.
public  voidtestTripleInsert(Triple t)
     This fires a triple into the current RETE network.

Field Detail
addsPending
protected List addsPending(Code)
Queue of newly added triples waiting to be processed



clauseIndex
protected OneToManyMap clauseIndex(Code)
Map from predicate node to clause processor, Node_ANY is used for wildcard predicates



conflictSet
protected RETEConflictSet conflictSet(Code)
The conflict set of rules waiting to fire



deletesPending
protected List deletesPending(Code)
Queue of newly deleted triples waiting to be processed



infGraph
protected ForwardRuleInfGraphI infGraph(Code)
The parent InfGraph which is employing this engine instance



isMonotonic
boolean isMonotonic(Code)
True if all the rules are monotonic, so we short circuit the conflict set processing



logger
protected static Log logger(Code)



nRulesFired
long nRulesFired(Code)
performance stats - number of rules fired



predicatesUsed
protected HashSet predicatesUsed(Code)
List of predicates used in rules to assist in fast data loading



processedAxioms
boolean processedAxioms(Code)
True if we have processed the axioms in the rule set



recordDerivations
protected boolean recordDerivations(Code)
Set to true to flag that derivations should be logged



rules
protected List rules(Code)
Set of rules being used



wildcardRule
protected boolean wildcardRule(Code)
Flag, if true then there is a wildcard predicate in the rule set so that selective insert is not useful




Constructor Detail
RETEEngine
public RETEEngine(ForwardRuleInfGraphI parent, List rules)(Code)
Constructor.
Parameters:
  parent - the F or FB infGraph that it using this engine, the parent graphholds the deductions graph and source data.
Parameters:
  rules - the rule set to be processed



RETEEngine
public RETEEngine(ForwardRuleInfGraphI parent)(Code)
Constructor. Build an empty engine to which rules must be added using setRuleStore().
Parameters:
  parent - the F or FB infGraph that it using this engine, the parent graphholds the deductions graph and source data.




Method Detail
add
public synchronized void add(Triple t)(Code)
Add one triple to the data graph, run any rules triggered by the new data item, recursively adding any generated triples.



addTriple
public synchronized void addTriple(Triple triple, boolean deduction)(Code)
Add a new triple to the network.
Parameters:
  triple - the new triple
Parameters:
  deduction - true if the triple has been generated by the rules and so should be added to the deductions graph.



compile
public void compile(List rules, boolean ignoreBrules)(Code)
Compile a list of rules into the internal rule store representation.
Parameters:
  rules - the list of Rule objects
Parameters:
  ignoreBrules - set to true if rules written in backward notation should be ignored



createTerminal
protected RETETerminal createTerminal(Rule rule)(Code)
Create a terminal node for the RETE network. Normally this is RETETerminal but some people have experimented with alternative delete handling by creating RETETerminal subclasses so this hook simplifies use of that approach.



delete
public synchronized boolean delete(Triple t)(Code)
Remove one triple to the data graph. true if the effects could be correctly propagated orfalse if not (in which case the entire engine should be restarted).



deleteTriple
public synchronized void deleteTriple(Triple triple, boolean deduction)(Code)
Remove a new triple from the network.
Parameters:
  triple - the new triple
Parameters:
  deduction - true if the remove has been generated by the rules



fastInit
public void fastInit(Finder inserts)(Code)
Process all available data. This version expects that all the axioms have already be preprocessed and the clause index already exists.
Parameters:
  inserts - the set of triples to be processed, normally this is theraw data graph but may include additional deductions made by preprocessing hooks



findAndProcessActions
protected void findAndProcessActions()(Code)
Scan the rules for any run actions and run those



findAndProcessAxioms
protected void findAndProcessAxioms()(Code)
Scan the rules for any axioms and insert those



getNRulesFired
public long getNRulesFired()(Code)
Return the number of rules fired since this rule engine instance was created and initialized



getRuleStore
public Object getRuleStore()(Code)
Access the precomputed internal rule form. Used when precomputing the internal axiom closures.



incRuleCount
protected void incRuleCount()(Code)
Increment the rule firing count, called by the terminal nodes in the network.



init
public void init(boolean ignoreBrules, Finder inserts)(Code)
Process all available data. This should be called once a deductions graph has be prepared and loaded with any precomputed deductions. It will process the rule axioms and all relevant existing exiting data entries.
Parameters:
  ignoreBrules - set to true if rules written in backward notation should be ignored
Parameters:
  inserts - the set of triples to be processed, normally this is theraw data graph but may include additional deductions made by preprocessing hooks



nextAddTriple
protected synchronized Triple nextAddTriple()(Code)
Find the next pending add triple. the triple or null if there are none left.



nextDeleteTriple
protected synchronized Triple nextDeleteTriple()(Code)
Find the next pending add triple. the triple or null if there are none left.



requestRuleFiring
public void requestRuleFiring(Rule rule, BindingEnvironment env, boolean isAdd)(Code)
Add a rule firing request to the conflict set.



runAll
public void runAll()(Code)
Process the queue of pending insert/deletes until the queues are empty. Public to simplify unit tests - not normally called directly.



setDerivationLogging
public void setDerivationLogging(boolean recordDerivations)(Code)
Set to true to enable derivation caching



setRuleStore
public void setRuleStore(Object ruleStore)(Code)
Set the internal rule from from a precomputed state.



shouldTrace
public boolean shouldTrace()(Code)
Return true if the internal engine state means that tracing is worthwhile. It will return false during the axiom bootstrap phase.



testTripleInsert
public void testTripleInsert(Triple t)(Code)
This fires a triple into the current RETE network. This format of call is used in the unit testing but needs to be public because the tester is in another package.



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)

w___w__w._j__a__v_a__2_s___._c__o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.