This page (revision-16) was last changed on 06-Jun-2017 09:17 by Albrecht Striffler

This page was created on 17-Dec-2012 14:42 by Markus Friedrich

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
16 06-Jun-2017 09:17 6 KB Albrecht Striffler to previous
15 11-May-2016 14:14 6 KB Albrecht Striffler to previous | to last
14 03-May-2016 12:06 6 KB Albrecht Striffler to previous | to last
13 17-Mar-2015 08:02 6 KB Markus Friedrich to previous | to last
12 12-Mar-2015 01:45 6 KB Albrecht Striffler to previous | to last
11 12-Mar-2015 01:42 6 KB Albrecht Striffler to previous | to last
10 26-Feb-2015 11:50 6 KB Albrecht Striffler to previous | to last
9 25-Feb-2013 14:43 6 KB Albrecht Striffler to previous | to last
8 25-Feb-2013 13:00 6 KB Albrecht Striffler to previous | to last
7 25-Feb-2013 12:50 6 KB Albrecht Striffler to previous | to last
6 25-Feb-2013 12:50 6 KB Albrecht Striffler to previous | to last
5 18-Feb-2013 12:53 6 KB Albrecht Striffler to previous | to last
4 17-Dec-2012 17:45 6 KB constin to previous | to last
3 17-Dec-2012 14:56 6 KB Markus Friedrich to previous | to last
2 17-Dec-2012 14:49 5 KB Markus Friedrich to previous | to last
1 17-Dec-2012 14:42 5 KB Markus Friedrich to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 changed one line
!!! Running a d3web Case Session
[{TableOfContents }]
At line 3 changed 2 lines
Once, you have created a {{KnowledgeBase}} instance (for example, by [Loading a knowledge base]), you can run a problem-solving session.
During a problem-solving session you enter Question-Value pairs (facts) and the system will derive appropriate solutions for the entered facts.
!!! Running a d3web [Session|https://isci.informatik.uni-wuerzburg.de/javadoc/d3web/de/d3web/core/session/Session.html]
At line 6 changed one line
!! Creating a new Case Session
Once, you have created a [KnowledgeBase|https://isci.informatik.uni-wuerzburg.de/javadoc/d3web/de/d3web/core/knowledge/KnowledgeBase.html] instance (for example, by [Loading a knowledge base|How-To Load a Knowledge Base]), you can run a problem-solving session.
During a problem-solving session you enter Question-Value pairs ([Fact|https://isci.informatik.uni-wuerzburg.de/javadoc/d3web/de/d3web/core/session/blackboard/Fact.html]) and the system will derive appropriate solutions for the entered facts.
At line 8 removed 2 lines
Case sessions are represented by instances of {{Session}}.
Use the {{SessionFactory}} to quickly create a new {{Session}} instance for the {{KnowledgeBase}} instance with name {{knowledgeBase}}:
At line 9 added 5 lines
!! Creating a new Session
Sessions are represented by instances of {{Session}}.
Use the {{SessionFactory}} to quickly create a new {{Session}} instance for the {{KnowledgeBase}} instance:
At line 20 added one line
At line 19 changed 2 lines
The {{Interview}}, instantiated with the Session, determines the next question to be presented to the user. More precisely, a {{FormStrategy}} computes the next {{From}} that is presented in the dialog.
A Form consists of a title and an {{interviewObject}} (a Question of a QContainer):
The [Interview|https://isci.informatik.uni-wuerzburg.de/javadoc/d3web/de/d3web/core/session/interviewmanager/Interview.html], which can be accessed from the session by using the interview problem solver (PSMethod), determines the next question to be presented to the user. More precisely, a {{FormStrategy}} computes the next {{From}} that is presented in the dialog.
A Form consists of a title and a list of active questions:
At line 24 changed 2 lines
Form form = session.getInterview().nextForm();
InterviewObject interviewObject = form.getInterviewObject();
Interview interview = session.getSessionObject(session.getPSMethodInstance(PSMethodInterview.class));
Form form = interview.nextForm();
List<Question> activeQuestions = form.getActiveQuestions();
At line 33 changed one line
session.getInterviewManager().setFormStrategy(new NextUnansweredQuestionFormStrategy());
interview.setFormStrategy(new NextUnansweredQuestionFormStrategy());
At line 38 removed one line
At line 45 changed 3 lines
Fact fact = FactFactory.createFact(question, value,
PSMethodUserSelected.getInstance(),
PSMethodUserSelected.getInstance());
Question question = kb.getManager().searchQuestion("QuestionName");
ChoiceValue value = new ChoiceValue("ChoiceName");
Fact fact = FactFactory.createFact(session, question, value,
PSMethodUserSelected.getInstance(),
PSMethodUserSelected.getInstance());
At line 51 changed one line
At line 62 added one line
At line 68 added one line
At line 62 changed 2 lines
for (Solution solution : knowledgeBase.getSolutions()) {
Rating state = session.getBlackboard().getState(solution);
for (Solution solution : knowledgeBase.getManager().getSolutions()) {
Rating state = session.getBlackboard().getRating(solution);
At line 79 added one line
Sometimes it is easier (and a bit faster) to just get all solutions in a particular state, e.g. all established solutions:
At line 81 added 10 lines
%%prettify
{{{
out.println("All established solutions:");
for (Solution solution : session.getBlackboard().getSolutions(Rating.State.ESTABLISHED)) {
out.println(solution);
}
}}}
/%
At line 83 changed 2 lines
Please note, that the session manages a {{Protocol}}, where all entered findings (question/value tuples) are stored in a chronological order.
Please note, that the session manages a {{Protocol}}, where entered findings (question/value tuples) are stored in a chronological order.
At line 110 added one line
At line 95 changed one line
At line 97 changed 2 lines
// Create a case (problem-solving session and set all specified
// question/answers
// Create a case (problem-solving session and set
// all specified question/answers
At line 103 changed 2 lines
Fact fact1 = FactFactory.createFact(pregnant, yes, PSMethodUserSelected
.getInstance(), PSMethodUserSelected.getInstance());
Fact fact1 = FactFactory.createUserEnteredFact(
pregnant, yes);
At line 108 changed 3 lines
Fact fact2 = FactFactory.createFact(weight, new NumValue(80),
PSMethodUserSelected.getInstance(),
PSMethodUserSelected.getInstance());
Fact fact2 = FactFactory.createUserEnteredFact(
weight, new NumValue(80));
At line 113 changed one line
At line 116 changed 3 lines
for (Solution solution : knowledgeBase.getSolutions()) {
Rating state = session.getBlackboard().getState(solution);
if (!state.hasState(Rating.State.UNCLEAR))
for (Solution solution : knowledgeBase.getManager().getSolutions()) {
Rating state = session.getBlackboard().getRating(solution);
if (!state.hasState(Rating.State.UNCLEAR)) {
At line 139 added one line
}
At line 133 changed 2 lines
// - pregnant [oc]
// - weight [num]
// -- pregnant [oc]
// -- weight [num]
At line 138 changed 2 lines
KnowledgeBaseManagement kbm = KnowledgeBaseManagement.createInstance();
QASet root = kbm.getKnowledgeBase().getRootQASet();
KnowledgeBase kb = KnowledgeBaseUtils.createKnowledgeBase();
QASet root = kb.getRootQASet();
At line 141 changed 5 lines
demoQuestions = kbm.createQContainer("demoQuestions", root);
pregnant = kbm.createQuestionOC("pregnant", demoQuestions, new String[] { "yes",
"no" });
yes = new ChoiceValue(kbm.findChoice(pregnant, "yes"));
weight = kbm.createQuestionNum("weight", "weight", demoQuestions);
demoQuestions = new QContainer(root, "demoQuestions");
pregnant = new QuestionOC(demoQuestions, "pregnant", "yes", "no");
yes = new ChoiceValue(KnowledgeBaseUtils.findChoice(pregnant, "yes"));
weight = new QuestionNum(demoQuestions, "weight");
At line 147 changed 2 lines
dangerousMood = kbm.createSolution("dangerousMood");
dangerousMood = new Solution(kb.getRootSolution(), "dangerousMood");
At line 150 changed 3 lines
kbm.getKnowledgeBase().setInitQuestions(Arrays.asList(demoQuestions));
// Define the magic rule: preganant=yes AND weight > 70 => dangerousMood (P7)
kb.setInitQuestions(Arrays.asList(demoQuestions));
// Define the magic rule: preganant=yes AND weight > 70 => dangerousMood
// (P7)
At line 155 changed 4 lines
terms.add(new CondNumGreater(weight, Double.valueOf(70)));
RuleFactory.createHeuristicPSRule("r1", dangerousMood, Score.P7, new CondAnd(terms));
return kbm.getKnowledgeBase();
terms.add(new CondNumGreater(weight, (double) 70));
RuleFactory.createHeuristicPSRule(dangerousMood, Score.P7, new CondAnd(terms));
return kb;
At line 163 removed one line
At line 165 changed one line
howto
howto create Session