001    package com.hammurapi.reasoning.impl;
002    
003    import java.lang.reflect.Method;
004    import java.util.List;
005    
006    import com.hammurapi.reasoning.Derivation;
007    import com.hammurapi.reasoning.ForwardReasoningSession;
008    import com.hammurapi.reasoning.Handle;
009    
010    /**
011     * Knowledge base holds facts and mapping of handles to facts.
012     * Collections created by the knowledge base shall be tied to
013     * the knowledge base and shall return null for invalid (removed) 
014     * objects.
015     * @author Pavel Vlasov
016     *
017     */
018    public interface KnowledgeBase<F> extends CollectionManager<Object>, ForwardReasoningSession<F> {
019            
020            interface PutDerivedResult<F> {
021                    
022                    /**
023                     * @return Fact handle.
024                     */
025                    Handle<F> getHandle();
026                    
027                    /**
028                     * @return True if facts was added to the knowledge base. False, if fact was already present in the knowledge base. 
029                     */
030                    boolean isNew();
031            }
032            
033            PutDerivedResult<F> putConclusion(F obj, Object rule, String ruleName, String ruleDescription, Method method, List<Handle<F>> handleList);
034    }