Source Code Cross Referenced for RDFClauseSetKBIntegrationTestCase.java in  » Rule-Engine » Mandarax » test » org » mandarax » rdf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Rule Engine » Mandarax » test.org.mandarax.rdf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * Copyright (C) 1999-2004 <a href="mailto:mandarax@jbdietrich.com">Jens
03:         * Dietrich </a>
04:         * 
05:         * This library is free software; you can redistribute it and/or modify it under
06:         * the terms of the GNU Lesser General Public License as published by the Free
07:         * Software Foundation; either version 2 of the License, or (at your option) any
08:         * later version.
09:         * 
10:         * This library is distributed in the hope that it will be useful, but WITHOUT
11:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12:         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13:         * details.
14:         * 
15:         * You should have received a copy of the GNU Lesser General Public License
16:         * along with this library; if not, write to the Free Software Foundation, Inc.,
17:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18:         */
19:        package test.org.mandarax.rdf;
20:
21:        import java.net.URL;
22:        import java.util.List;
23:        import org.mandarax.kernel.ClauseSet;
24:        import org.mandarax.kernel.KnowledgeBase;
25:        import org.mandarax.kernel.Predicate;
26:        import org.mandarax.rdf.RDFClauseSet;
27:        import org.mandarax.rdf.RDFUtils;
28:        import org.mandarax.reference.AdvancedKnowledgeBase;
29:
30:        /**
31:         * Test case for the integration of RDFClauseSets into knowledge bases. In
32:         * particular, we test here whether indexing works correctly (unlike
33:         * SQLClauseSets, RDFClauseSets contain generally more than one predicates).
34:         * @author <A HREF="mailto:j.b.dietrich@massey.ac.nz">Jens Dietrich </A> <A HREF="mailto:paschke@in.tum.de">Adrian Paschke</A>
35:         * @version 1.1 <01 August 2004>
36:         * @since 0.1
37:         */
38:        public class RDFClauseSetKBIntegrationTestCase extends
39:                AbstractRDFTestCase {
40:            /**
41:             * Check whether the clause set is correctly indexed for all of the
42:             * predicates it contains.
43:             * @throws an exception (indicating that the test case has failed)
44:             */
45:            public void test1() throws Exception {
46:                KnowledgeBase kb = new AdvancedKnowledgeBase();
47:                URL url = this .getClass().getResource(
48:                        TEST_DATA_ROOT + "chap0302.rdf");
49:                RDFClauseSet clauseSet = new RDFClauseSet(url);
50:                // this line is ok for testing, but should not be used for 
51:                // with large amounts real world 
52:                clauseSet.setPredicates(RDFUtils.findPredicates(url));
53:                kb.add(clauseSet);
54:                // the predicates in clauseSet
55:                Predicate p1 = p(PSTCN, "author");
56:                Predicate p2 = p(PSTCN, "title");
57:                Predicate p3 = p(PSTCN, "series");
58:                Predicate p4 = p(PSTCN, "contains");
59:                Predicate p5 = p(PSTCN, "alsoContains");
60:                Predicate p6 = p(PSTCN, "seriesTitle");
61:                testMembership(kb.getClauseSets(p1), clauseSet);
62:                testMembership(kb.getClauseSets(p2), clauseSet);
63:                testMembership(kb.getClauseSets(p3), clauseSet);
64:                testMembership(kb.getClauseSets(p4), clauseSet);
65:                testMembership(kb.getClauseSets(p5), clauseSet);
66:                testMembership(kb.getClauseSets(p6), clauseSet);
67:                assertTrue(true);
68:            }
69:
70:            /**
71:             * Test whether a clause set is the only clause set in a list.
72:             * @param cs a clause set
73:             * @param list a list
74:             * @exception an assertion error is thrown if there is none or more than one clause set in the list
75:             */
76:            private void testMembership(List list, ClauseSet cs)
77:                    throws Exception {
78:                if (list.size() > 1)
79:                    assertTrue(
80:                            "More than one clause set found when only one clause set was expected",
81:                            false);
82:                if (list.size() == 0)
83:                    assertTrue(
84:                            "No clause set found when one clause set was expected",
85:                            false);
86:                if (list.get(0) != cs)
87:                    assertTrue("Wrong clause set found", false);
88:            }
89:
90:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.