package com.hammurapi.reasoning.impl;

import java.lang.reflect.Method;
import java.util.List;

import com.hammurapi.reasoning.Derivation;
import com.hammurapi.reasoning.ForwardReasoningSession;
import com.hammurapi.reasoning.Handle;

/**
 * Knowledge base holds facts and mapping of handles to facts.
 * Collections created by the knowledge base shall be tied to
 * the knowledge base and shall return null for invalid (removed) 
 * objects.
 * @author Pavel Vlasov
 *
 */
public interface KnowledgeBase<F> extends CollectionManager<Object>, ForwardReasoningSession<F> {
	
	interface PutDerivedResult<F> {
		
		/**
		 * @return Fact handle.
		 */
		Handle<F> getHandle();
		
		/**
		 * @return True if facts was added to the knowledge base. False, if fact was already present in the knowledge base. 
		 */
		boolean isNew();
	}
	
	PutDerivedResult<F> putConclusion(F obj, Object rule, String ruleName, String ruleDescription, Method method, List<Handle<F>> handleList);
}
