This discussion is archived
4 Replies Latest reply: Aug 28, 2012 4:47 PM by Davin Fifield RSS

Question search with Java application and stateless determinations server

913983 Newbie
Currently Being Moderated
We want to use a stateless (because of high-availability reqruirements) OPA determinations server with a java-based application, where we want to put our complex business logic decisions in OPA. How can we mimic the web-derterminations functionality of question search? During an evaluation of a rulebase, it is possible that not all attributes that are needed to reach a conclusion are available. If that situation occurs, we want to provide these attributes to the java appliation, which can search its database or ask extra questions. The decision report seems to contain this information, but if so, how should we interpret it? Is it possible to retrieve one or more following question(s) from it is are there any (sample) code available to do this?


Philip.
  • 1. Re: Question search with Java application and stateless determinations server
    Ben Rogers Journeyer
    Currently Being Moderated
    Hi Phillip,
    You can mimic web-determinations almost exactly using the ODS interview service. You create a session, and then run investigations in the same way as you do on screens, and the interview service will return the questions required until the goal is complete. This can interact with actual screens in the rulebase (even though you are not using OWD), so you can customise the order of data input (and the groups of data which need to be input) in the same way that you can with OWD.

    These are useful references:

    http://docs.oracle.com/html/E36316_01/Content/Tutorials%20and%20Samples/Eg_DS_Int_Service_Investigation.htm
    http://docs.oracle.com/html/E36316_01/Content/Technical%20Reference/DS_Interview_Service.htm

    This is normally suitable for an interview with custom UI layer instead of OWD.

    It may be much simpler in your case to stick with the ODS assess service and request a decision report but use the outcome-style as "base-attributes" on the first pass. This will list all the base attributes required to make that decision. Any base attribute which it needs, but are missing, will be listed as unknown-val. You could use this response to then search the database for the missing fields, and fire the request again with the additional fields.

    Those are a couple of options to explore!

    Cheers,
    Ben
  • 2. Re: Question search with Java application and stateless determinations server
    Davin Fifield Journeyer
    Currently Being Moderated
    Great answer Ben.

    It's also worth briefly pointing out that the OPA Determinations Server Interview web service is stateful (it keeps the interview session in memory between calls), whereas the Assess web service is completely stateless.

    Davin.
  • 3. Re: Question search with Java application and stateless determinations server
    913983 Newbie
    Currently Being Moderated
    Hi Ben,

    Thanks for the quick response. Given our requiremenst concerning high-availability, I have investigated the stateless solution some more. I built a sample rulebase to look into the behaviour of the "base-attributes" parameter.

    In the example below, I try to reach the top-level goal: "the opa implementation is succesful", first without adding any base attributes. All the relevant base attributes are shown, but how can I read the report to select the next question to ask: is it always the first unknown value under the topgoal?

    The following rulebase:

    the opa implementation is successful if
    the functionality is implemented according to specs
    or
    both
    the organization is enthusiastic about business rules
    and
    the business-rules are well-formed

    the business-rules are well-formed if
    the business-rules are divided into more rule sets
    and
    the business rules can be compiled

    the non-relevant goal is reached if
    the non-relevant question is asked

    Leads to the following webservice, in which I use the base-attributes parameter:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://oracle.com/determinations/server/10.4/Inferencetest/assess/types">
    <soapenv:Header/>
    <soapenv:Body>
    <typ:assess-request>
    <!--Optional:-->
    <typ:global-instance>
    <!--Optional:-->
    <typ:opa-impl-succesful unknown-outcome-style="base-attributes" known-outcome-style= "value-only">
    </typ:opa-impl-succesful>
    </typ:global-instance>
    </typ:assess-request>
    </soapenv:Body>
    </soapenv:Envelope>


    leads to:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:i18n="http://www.w3.org/2005/09/ws-i18n" xmlns:typ="http://oracle.com/determinations/server/10.4/Inferencetest/assess/types">
    <SOAP-ENV:Header>
    <i18n:international>
    <i18n:locale>en_US</i18n:locale>
    <i18n:tz>GMT+0200</i18n:tz>
    </i18n:international>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
    <typ:assess-response>
    <typ:global-instance>
    <typ:opa-impl-succesful type="boolean" inferred="false">
    <typ:unknown-val/>
    <typ:decision-report report-style="base-attributes">
    <typ:attribute-node id="dn:0" entity-id="global" instance-id="global" hypothetical-instance="false" attribute-id="opa-impl-succesful" type="boolean" text="Is the opa implementation successful?" inferred="false">
    <typ:unknown-val/>
    <typ:attribute-node id="dn:1" entity-id="global" instance-id="global" hypothetical-instance="false" attribute-id="func-impl-according-to-specs" type="boolean" text="Is the functionality implemented according to specs?" inferred="false">
    <typ:unknown-val/>
    </typ:attribute-node>
    <typ:attribute-node id="dn:2" entity-id="global" instance-id="global" hypothetical-instance="false" attribute-id="organisation-enthusiastic" type="boolean" text="Is the organization enthusiastic about business rules?" inferred="false">
    <typ:unknown-val/>
    </typ:attribute-node>
    <typ:attribute-node id="dn:4" entity-id="global" instance-id="global" hypothetical-instance="false" attribute-id="business-rules-divided-rule-sets" type="boolean" text="Are the business-rules divided into more rule sets?" inferred="false">
    <typ:unknown-val/>
    </typ:attribute-node>
    <typ:attribute-node id="dn:5" entity-id="global" instance-id="global" hypothetical-instance="false" attribute-id="rules-compilable" type="boolean" text="Can the business rules be compiled?" inferred="false">
    <typ:unknown-val/>
    </typ:attribute-node>
    </typ:attribute-node>
    </typ:decision-report>
    </typ:opa-impl-succesful>
    </typ:global-instance>
    </typ:assess-response>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    Edited by: Philip Jan de Lang on 28-aug-2012 16:34
  • 4. Re: Question search with Java application and stateless determinations server
    Davin Fifield Journeyer
    Currently Being Moderated
    Hi Philip, it would be a good idea to post this question on a separate thread, since this one is already marked as answered.

    Davin.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points