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?
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.
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.
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.
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: