yangz
yangz

Reputation: 53

How to set customized parameters to D3WEB in expert system?

I am developing an expert system using d3web. There is a set of parameters which are determined in my java application. How to set the parameters outside of d3web? There are so many parameters. Is it possible to save them in xml file?

Regards, Yang

Upvotes: 1

Views: 38

Answers (1)

Albrecht Striffler
Albrecht Striffler

Reputation: 61

So you are using d3web on an API level and want to set lots of values for the variables in your knowledge base? How to do this is mostly described here:

https://www.d3web.de/Wiki.jsp?page=How-To%20Create%20a%20Session

Check out the part about entering facts into the session. Basically, for each value you want to add into a d3web session, you create a fact using the FactFactory and then add it to the session's blackboard via #addValueFact(fact) The example on the docu page is not even the most convenient, you could also for example do the following

Fact fact = FactFactory.createUserEnteredFact(kb, "temperature", 25);
session.getBlackboard().addValueFact(fact);

If you want to add lots of values at the same instant, it is also advisable to do so in one propagation window. If you don't commit in the same propagation window, inference will be done after each new fact. The inference may take a small amount of time, so if you add thousands of values, you don't want if after each fact.

Open propagation window the following way:

session.getPropagationManager().openPropagation();
try {
    for (Fact fact : facts) {
        session.getBlackboard().addValueFact(fact);
    }
}
finally {
    session.getPropagationManager().commitPropagation();
}

Hope this helps!

Regards Albrecht

Upvotes: 0

Related Questions