Java Doc for AutoFacts.java in  » Rule-Engine » Mandarax » org » mandarax » util » 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 » Rule Engine » Mandarax » org.mandarax.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.mandarax.kernel.AbstractPropertiesSupport
      org.mandarax.util.AutoFacts

AutoFacts
public class AutoFacts extends AbstractPropertiesSupport implements ClauseSet,Serializable(Code)
AutoFacts are generic clause sets. AutoFacts facilitate the task of integrating facts generated from data into the knowledge base at run time (=time when we run the inference engine).
It is very useful to subclass AutoFacts, overridding the method getExtension(Class type). This method returns a collection of instances for the respective type. E.g., assume we have an instance af of such a subclass with getExtension returning (the Integer instances) 1,2 and 3 for Integer.class. Now assume that we perform af.clauses(1<x,null), where 1<x stands for the fact consisting of the IntArithmetic.LESS_THAN predicate, a constant term wrapping the integer 1, and a variable term of the type Integer named "x". Then the iterator returned iterates over two facts: 1<2 and 1<3. If we perform af.clauses(x<y,null) (two variables!), the iterator iterates over three facts 1<2,1<3, 2<3. This will also work if the parameter(s) contains functions (with a known semantics), e.g., the iterator returned by af.clauses(x*x<x+x,null) (where * and + stand for the respective function defined as static members in IntArithmetic) will iterate over one fact only: 1*1<1+1.
If clauses() is used without parameters, the set of facts iterated is defined as follows:
  • The predicate of each fact must be in the array returned by getPredicates().
  • For each type of any slot of the predicate, the extension is computed, and a fact is build for each combination of these extensions.
E.g., if getPredicates() returns {IntArithmetic.LESS_THAN,IntArithmetic.EQUALS}, and the extension for Integer.class is defined as {1,2,3}, then clauses() returns an iterator iterating over the following facts: 1=1,2=2 ,3=3 , 1<2, 1<3 and 2<3.
In the math test package and in the example.crm package are a couple of examples showing how to use auto facts.
author:
   Jens Dietrich
version:
   3.4 <7 March 05>
since:
   1.2


Field Summary
protected transient  ListclauseSetChangeListener
    
protected  org.mandarax.kernel.Predicate[]predicates
    

Constructor Summary
public  AutoFacts()
     Constructor.

Method Summary
public  voidaddClauseSetChangeListener(ClauseSetChangeListener l)
     Add a clause set listener.
public  org.mandarax.util.ClauseIteratorclauses()
     Iterate all clauses.
public  ClauseIteratorclauses(org.mandarax.kernel.Clause query, Object additionalParameter)
     Get a clause iterator.
protected  voidfireClauseSetChangeEvent(ClauseSetChangeEvent e)
    
protected  CollectiongetExtension(Class type)
     Get the extension for a type.
public  ObjectgetKey()
    
public  StringgetName()
     Get the name of the auto fact set.
public  org.mandarax.kernel.Predicate[]getPredicates()
     Get the predicates.
public  Iteratorpredicates()
     Get an iterator iterating over the predicates contained in this clause set.
public  voidremoveClauseSetChangeListener(ClauseSetChangeListener l)
     Remove a clause set listener.
public  voidsetName(String aName)
     Set a name.
public  voidsetPredicates(org.mandarax.kernel.Predicate[] newPredicates)
    
public  StringtoString()
     Convert the object to a string.

Field Detail
clauseSetChangeListener
protected transient List clauseSetChangeListener(Code)



predicates
protected org.mandarax.kernel.Predicate[] predicates(Code)




Constructor Detail
AutoFacts
public AutoFacts()(Code)
Constructor.




Method Detail
addClauseSetChangeListener
public void addClauseSetChangeListener(ClauseSetChangeListener l)(Code)
Add a clause set listener.
Parameters:
  l - a listener



clauses
public org.mandarax.util.ClauseIterator clauses()(Code)
Iterate all clauses. We generate a set of clauses for all predicates returned by getPredicates() only if for all types of any term of this predicate a non empty extension is defined. (see also class comment)



clauses
public ClauseIterator clauses(org.mandarax.kernel.Clause query, Object additionalParameter)(Code)
Get a clause iterator. a clause iterator
Parameters:
  query - the query clause
Parameters:
  additionalParameter - an additional parameter



fireClauseSetChangeEvent
protected void fireClauseSetChangeEvent(ClauseSetChangeEvent e)(Code)
Fire a clause set change event
Parameters:
  e - an event



getExtension
protected Collection getExtension(Class type)(Code)
Get the extension for a type. Note that by default an empty set is returned. This will lead to a clause set containing at most one fact. If the auto fact set should build facts for combinations of variable replacements, then this method needs to be overridden by a subclass. a collection of objects of the respective type
Parameters:
  type - a type



getKey
public Object getKey()(Code)
Get the key the key (i.e., the predicates for this clause set)



getName
public String getName()(Code)
Get the name of the auto fact set. a name



getPredicates
public org.mandarax.kernel.Predicate[] getPredicates()(Code)
Get the predicates. the predicates



predicates
public Iterator predicates()(Code)
Get an iterator iterating over the predicates contained in this clause set. an iterator



removeClauseSetChangeListener
public void removeClauseSetChangeListener(ClauseSetChangeListener l)(Code)
Remove a clause set listener.
Parameters:
  l - a listener



setName
public void setName(String aName)(Code)
Set a name.
Parameters:
  aName - a name



setPredicates
public void setPredicates(org.mandarax.kernel.Predicate[] newPredicates)(Code)
Set the predicates,
Parameters:
  newPredicates - the predicates



toString
public String toString()(Code)
Convert the object to a string. the string representation of this object



Methods inherited from org.mandarax.kernel.AbstractPropertiesSupport
public Properties getProperties()(Code)(Java Doc)
public String getProperty(String key)(Code)(Java Doc)
public Enumeration propertyNames()(Code)(Java Doc)
public Object removeProperty(String key)(Code)(Java Doc)
public void setProperties(Properties properties)(Code)(Java Doc)
public Object setProperty(String key, String value)(Code)(Java Doc)

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.