====== Client API ====== Client API is used to communicate with rule engines. API interfaces and classes are located in ''[[http://www.hammurapi.com/products/rules/doc/api/com/hammurapi/reasoning/package-summary.html|com.hammurapi.reasoning]]'' package. {{:products:hammurapi_rules:specification:reasoning.gif|}} ===== Forward reasoning ===== {{:products:hammurapi_rules:specification:reasoningseqfwd.gif|}} The diagram above shows typical steps in working with a forward reasoning session: - Obtain a reference to a reasoning session factory. This step is implementation specific and is not covered by the specification. For example, in J2EE environment it can be JNDI lookup and in a standalone application it can be instantiation of a factory class with **new**. - Create a reasoning session. - Put facts to the session. - Execute rules. - Retrieve conclusions from the session. - Close the session. ===== Backward reasoning ===== {{:products:hammurapi_rules:specification:backwardreasoning.gif|}} This is a typical backward reasoning scenario: - Obtain a reference to a reasoning session factory. This step is implementation specific and is not covered by the specification. For example, in J2EE environment it can be JNDI lookup and in a standalone application it can be instantiation of a factory class with **new**. - Create a reasoning session providing an array of input fact sources. These sources can be database queries, files, other backward reasoning sessions, ... - Retrieve conclusions of desired type from the session. This operation can be performed multiple times for different or same conclusion types. - Close the session.