01: /*
02: * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package test.org.mandarax.reference;
19:
20: /**
21: * Test case for cut.
22: * R(x) :- A(x),!,B(x)
23: * A(x) :- C(x)
24: * A(x) :- D(x)
25: * A(a)
26: * A(b)
27: * C(c)
28: * D(d)
29: * B(a)
30: * B(b)
31: * No result expected: first substitution on the left side of the cut is c, but (c)
32: * is not supported.
33: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
34: * @version 3.4 <7 March 05>
35: * @since 2.1
36: */
37: public class TestCut5 extends TestCut {
38: /**
39: * @see test.org.mandarax.reference.cut.TestCut#feedKnowledgeBase(KnowledgeBase)
40: */
41: public void feedKnowledgeBase(
42: org.mandarax.kernel.KnowledgeBase knowledge) {
43: kb.add(lfs.rule(this .prereq2("A", "x"), this .cut(), this
44: .prereq2("B", "x"), this .fact2("R", "x")));
45: kb.add(lfs.rule(this .prereq2("C", "x"), this .fact2("A", "x")));
46: kb.add(lfs.rule(this .prereq2("D", "x"), this .fact2("A", "x")));
47: kb.add(this .fact1("A", "a"));
48: kb.add(this .fact1("A", "b"));
49: kb.add(this .fact1("C", "c"));
50: kb.add(this .fact1("D", "d"));
51: kb.add(this .fact1("B", "a"));
52: kb.add(this .fact1("B", "b"));
53: }
54:
55: /**
56: * Get the expected results.
57: * @return an array of expected results.
58: */
59: protected String[] getExpectedResults() {
60: return new String[] {};
61: }
62:
63: /**
64: * Convert the object to a string.
65: * @return a string
66: */
67: public String toString() {
68: return "Test case for cut 5";
69: }
70:
71: }
|