Source Code Cross Referenced for TestTrialOWLRules.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » reasoner » rulesys » test » 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 » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.reasoner.rulesys.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /******************************************************************
002:         * File:        TestTrialOWLRules.java
003:         * Created by:  Dave Reynolds
004:         * Created on:  09-Jul-2003
005:         * 
006:         * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
007:         * [See end of file]
008:         * $Id: TestTrialOWLRules.java,v 1.15 2008/01/02 12:08:20 andy_seaborne Exp $
009:         *****************************************************************/package com.hp.hpl.jena.reasoner.rulesys.test;
010:
011:        import com.hp.hpl.jena.rdf.model.*;
012:        import com.hp.hpl.jena.reasoner.*;
013:        import com.hp.hpl.jena.reasoner.rulesys.*;
014:        import com.hp.hpl.jena.util.FileManager;
015:        import com.hp.hpl.jena.vocabulary.RDF;
016:        import com.hp.hpl.jena.vocabulary.ReasonerVocabulary;
017:
018:        import junit.framework.TestCase;
019:        import junit.framework.TestSuite;
020:
021:        import java.io.IOException;
022:        import java.util.*;
023:
024:        /**
025:         * Test suite to test experimental versions of the OWL reasoner, not 
026:         * included in the master regression test suite.
027:         * 
028:         * @author <a href="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
029:         * @version $Revision: 1.15 $ on $Date: 2008/01/02 12:08:20 $
030:         */
031:        public class TestTrialOWLRules extends TestCase {
032:
033:            /** The name of the manifest file to test */
034:            protected String manifest;
035:
036:            /** Flag to control whether tracing and logging enabled */
037:            protected static boolean enableTracing = false;
038:
039:            /** Flag to control whether to print performance stats as we go */
040:            protected static boolean printStats = true;
041:
042:            /** Configuration spec for the reasoner under test */
043:            protected static Resource configuration;
044:
045:            static {
046:                Model m = ModelFactory.createDefaultModel();
047:                configuration = m
048:                        .createResource(GenericRuleReasonerFactory.URI);
049:                configuration.addProperty(ReasonerVocabulary.PROPruleMode,
050:                        "hybrid");
051:                configuration.addProperty(ReasonerVocabulary.PROPruleSet,
052:                        "etc/owl-fb-test.rules");
053:                configuration.addProperty(
054:                        ReasonerVocabulary.PROPenableOWLTranslation, "true");
055:            }
056:
057:            /**
058:             * Boilerplate for junit
059:             */
060:            public TestTrialOWLRules(String manifest) {
061:                super (manifest);
062:                this .manifest = manifest;
063:            }
064:
065:            /**
066:             * Boilerplate for junit.
067:             * This is its own test suite
068:             */
069:            public static TestSuite suite() {
070:                TestSuite suite = new TestSuite();
071:
072:                // Basic property and equivalence tests
073:                suite.addTest(new TestTrialOWLRules(
074:                        "SymmetricProperty/Manifest001.rdf"));
075:                suite.addTest(new TestTrialOWLRules(
076:                        "FunctionalProperty/Manifest001.rdf"));
077:                suite.addTest(new TestTrialOWLRules(
078:                        "FunctionalProperty/Manifest002.rdf"));
079:                suite.addTest(new TestTrialOWLRules(
080:                        "FunctionalProperty/Manifest003.rdf"));
081:                suite.addTest(new TestTrialOWLRules(
082:                        "InverseFunctionalProperty/Manifest001.rdf"));
083:                suite.addTest(new TestTrialOWLRules(
084:                        "InverseFunctionalProperty/Manifest002.rdf"));
085:                suite.addTest(new TestTrialOWLRules(
086:                        "InverseFunctionalProperty/Manifest003.rdf"));
087:                suite.addTest(new TestTrialOWLRules(
088:                        "rdf-charmod-uris/Manifest.rdf"));
089:                suite.addTest(new TestTrialOWLRules("I5.5/Manifest001.rdf"));
090:                suite.addTest(new TestTrialOWLRules("I5.5/Manifest002.rdf"));
091:                suite.addTest(new TestTrialOWLRules("I5.5/Manifest003.rdf"));
092:                suite.addTest(new TestTrialOWLRules("I5.5/Manifest004.rdf"));
093:                suite
094:                        .addTest(new TestTrialOWLRules(
095:                                "inverseOf/Manifest001.rdf"));
096:                suite.addTest(new TestTrialOWLRules(
097:                        "TransitiveProperty/Manifest001.rdf"));
098:                suite.addTest(new TestTrialOWLRules(
099:                        "equivalentClass/Manifest001.rdf")); // bx - long
100:                suite.addTest(new TestTrialOWLRules(
101:                        "equivalentClass/Manifest002.rdf")); // bx - long but terminates
102:                suite.addTest(new TestTrialOWLRules(
103:                        "equivalentClass/Manifest003.rdf")); // bx - long but terminates
104:                suite.addTest(new TestTrialOWLRules(
105:                        "equivalentClass/Manifest005.rdf")); // bx - timeout
106:                suite.addTest(new TestTrialOWLRules(
107:                        "equivalentProperty/Manifest001.rdf")); // bx - long but terminates
108:                suite.addTest(new TestTrialOWLRules(
109:                        "equivalentProperty/Manifest002.rdf")); // bx - long but terminates
110:                suite.addTest(new TestTrialOWLRules(
111:                        "equivalentProperty/Manifest003.rdf"));
112:                suite.addTest(new TestTrialOWLRules("I4.6/Manifest001.rdf"));
113:                suite.addTest(new TestTrialOWLRules("I4.6/Manifest002.rdf"));
114:                suite.addTest(new TestTrialOWLRules("I5.1/Manifest001.rdf")); // bx - v. long but terminates
115:                suite.addTest(new TestTrialOWLRules("I5.24/Manifest001.rdf"));
116:                suite
117:                        .addTest(new TestTrialOWLRules(
118:                                "I5.24/Manifest002-mod.rdf"));
119:                suite.addTest(new TestTrialOWLRules(
120:                        "equivalentProperty/Manifest006.rdf"));
121:                suite.addTest(new TestTrialOWLRules(
122:                        "intersectionOf/Manifest001.rdf")); // bx - takes a long time
123:
124:                // Disjointness tests
125:                suite.addTest(new TestTrialOWLRules(
126:                        "differentFrom/Manifest001.rdf"));
127:                suite.addTest(new TestTrialOWLRules(
128:                        "disjointWith/Manifest001.rdf"));
129:                suite.addTest(new TestTrialOWLRules(
130:                        "disjointWith/Manifest002.rdf"));
131:                suite.addTest(new TestTrialOWLRules(
132:                        "AllDifferent/Manifest001.rdf")); // bx gets lost
133:
134:                // Restriction tests
135:                suite.addTest(new TestTrialOWLRules(
136:                        "allValuesFrom/Manifest001.rdf")); // bx - long but terminates
137:                suite.addTest(new TestTrialOWLRules(
138:                        "allValuesFrom/Manifest002.rdf")); // bx - slow
139:                suite.addTest(new TestTrialOWLRules(
140:                        "someValuesFrom/Manifest002.rdf")); // bx - slow
141:                suite.addTest(new TestTrialOWLRules(
142:                        "maxCardinality/Manifest001.rdf"));
143:                suite.addTest(new TestTrialOWLRules(
144:                        "maxCardinality/Manifest002.rdf"));
145:                suite.addTest(new TestTrialOWLRules(
146:                        "FunctionalProperty/Manifest005-mod.rdf"));
147:                suite
148:                        .addTest(new TestTrialOWLRules(
149:                                "I5.24/Manifest004-mod.rdf")); // bx - long
150:                suite.addTest(new TestTrialOWLRules(
151:                        "localtests/Manifest001.rdf")); // bx - long but terminates
152:                suite.addTest(new TestTrialOWLRules(
153:                        "localtests/Manifest002.rdf")); // bx - long but terminates
154:                suite.addTest(new TestTrialOWLRules(
155:                        "cardinality/Manifest001-mod.rdf")); // bx gets lost
156:                suite.addTest(new TestTrialOWLRules(
157:                        "cardinality/Manifest002-mod.rdf")); // bx gets lost
158:                suite.addTest(new TestTrialOWLRules(
159:                        "cardinality/Manifest003-mod.rdf")); // bx gets lost
160:                suite.addTest(new TestTrialOWLRules(
161:                        "cardinality/Manifest004-mod.rdf")); // bx gets lost
162:                suite
163:                        .addTest(new TestTrialOWLRules(
164:                                "I5.24/Manifest003-mod.rdf"));
165:                suite.addTest(new TestTrialOWLRules(
166:                        "cardinality/Manifest005-mod.rdf")); // bx gets lost
167:                suite.addTest(new TestTrialOWLRules(
168:                        "cardinality/Manifest006-mod.rdf")); // bx gets lost
169:                suite.addTest(new TestTrialOWLRules(
170:                        "equivalentClass/Manifest004.rdf")); // bx - timeout
171:
172:                // Needs prototype creation rule
173:                //        suite.addTest(new TestTrialOWLRules("someValuesFrom/Manifest001.rdf")); // bx needs creation rule
174:
175:                // Duplications of tests included earlier
176:                //        suite.addTest(new TestTrialOWLRules("differentFrom/Manifest002.rdf"));  // Duplication of AllDifferent#1
177:                //        suite.addTest(new TestTrialOWLRules("distinctMembers/Manifest001.rdf"));  // Duplication of AllDifferent#1
178:
179:                // Consistency tests - not yet implemented by tester
180:                //      suite.addTest(new TestTrialOWLRules("I5.3/Manifest005.rdf"));
181:                //      suite.addTest(new TestTrialOWLRules("I5.3/Manifest006.rdf"));
182:                //      suite.addTest(new TestTrialOWLRules("I5.3/Manifest007.rdf"));
183:                //      suite.addTest(new TestTrialOWLRules("I5.3/Manifest008.rdf"));
184:                //      suite.addTest(new TestTrialOWLRules("I5.3/Manifest009.rdf"));
185:                //      suite.addTest(new TestTrialOWLRules("Nothing/Manifest001.rdf"));
186:                //      suite.addTest(new TestTrialOWLRules("miscellaneous/Manifest001.rdf"));
187:                //      suite.addTest(new TestTrialOWLRules("miscellaneous/Manifest002.rdf"));
188:
189:                // Non-feature tests
190:                //      suite.addTest(new TestTrialOWLRules("I3.2/Manifest001.rdf"));
191:                //      suite.addTest(new TestTrialOWLRules("I3.2/Manifest002.rdf"));
192:                //      suite.addTest(new TestTrialOWLRules("I3.2/Manifest003.rdf"));
193:                //      suite.addTest(new TestTrialOWLRules("I3.4/Manifest001.rdf"));
194:                //      suite.addTest(new TestTrialOWLRules("I4.1/Manifest001.rdf"));
195:
196:                // Outside (f)lite set - hasValue, oneOf, complementOf, unionOf
197:                /*
198:                suite.addTest(new TestTrialOWLRules("unionOf/Manifest001.rdf"));
199:                suite.addTest(new TestTrialOWLRules("unionOf/Manifest002.rdf"));
200:                suite.addTest(new TestTrialOWLRules("oneOf/Manifest001.rdf"));
201:                suite.addTest(new TestTrialOWLRules("oneOf/Manifest002.rdf"));
202:                suite.addTest(new TestTrialOWLRules("oneOf/Manifest003.rdf"));
203:                suite.addTest(new TestTrialOWLRules("oneOf/Manifest004.rdf"));
204:                suite.addTest(new TestTrialOWLRules("complementOf/Manifest001.rdf"));
205:                suite.addTest(new TestTrialOWLRules("FunctionalProperty/Manifest004.rdf"));
206:                suite.addTest(new TestTrialOWLRules("InverseFunctionalProperty/Manifest004.rdf"));
207:                suite.addTest(new TestTrialOWLRules("equivalentClass/Manifest007.rdf"));
208:                suite.addTest(new TestTrialOWLRules("equivalentClass/Manifest006.rdf"));
209:                suite.addTest(new TestTrialOWLRules("equivalentProperty/Manifest004.rdf"));
210:                suite.addTest(new TestTrialOWLRules("equivalentProperty/Manifest005.rdf"));
211:                suite.addTest(new TestTrialOWLRules("Nothing/Manifest002.rdf"));
212:                 */
213:
214:                return suite;
215:            }
216:
217:            /**
218:             * The test runner
219:             */
220:            protected void runTest() throws IOException {
221:                OWLWGTester tester = new OWLWGTester(GenericRuleReasonerFactory
222:                        .theInstance(), this , configuration);
223:                //        OWLWGTester tester = new OWLWGTester(OWLExptRuleReasonerFactory.theInstance(), this, null);
224:                tester.runTests(manifest, enableTracing, printStats);
225:            }
226:
227:            /**
228:             * Boiler plate code for loading up and exploring a specific test case
229:             * for use during debugging.
230:             */
231:            public static void main(String[] args) {
232:                Model premises = FileManager.get().loadModel(
233:                        "file:testing/wg/someValuesFrom/premises001.rdf");
234:                Reasoner reasoner = GenericRuleReasonerFactory.theInstance()
235:                        .create(configuration);
236:                InfModel conclusions = ModelFactory.createInfModel(reasoner,
237:                        premises);
238:
239:                System.out.println("Premises = ");
240:                for (Iterator i = premises.listStatements(); i.hasNext();) {
241:                    System.out.println(" - " + i.next());
242:                }
243:
244:                Resource i = conclusions
245:                        .getResource("http://www.w3.org/2002/03owlt/someValuesFrom/premises001#i");
246:                Property p = conclusions
247:                        .getProperty("http://www.w3.org/2002/03owlt/someValuesFrom/premises001#p");
248:                Resource c = conclusions
249:                        .getResource("http://www.w3.org/2002/03owlt/someValuesFrom/premises001#c");
250:                Resource r = conclusions
251:                        .getResource("http://www.w3.org/2002/03owlt/someValuesFrom/premises001#r");
252:                Resource v = (Resource) i.getRequiredProperty(p).getObject();
253:                System.out.println("Value of i.p = " + v);
254:                System.out.println("Types of v are: ");
255:                for (Iterator it2 = conclusions.listStatements(v, RDF.type,
256:                        (RDFNode) null); it2.hasNext();) {
257:                    System.out.println(" - " + it2.next());
258:                }
259:                //        System.out.println("Things of type r are: ");
260:                //        for (Iterator it = conclusions.listStatements(null, RDF.type, r); it.hasNext(); ) {
261:                //            System.out.println(" - " + it.next());
262:                //        }
263:                //        System.out.println("Types of i are: ");
264:                //        for (Iterator it = conclusions.listStatements(i, RDF.type, (RDFNode)null); it.hasNext(); ) {
265:                //            System.out.println(" - " + it.next());
266:                //        }
267:                //        System.out.println("Things of type r are: ");
268:                //        for (Iterator it = conclusions.listStatements(null, RDF.type, r); it.hasNext(); ) {
269:                //            System.out.println(" - " + it.next());
270:                //        }
271:
272:            }
273:        }
274:
275:        /*
276:         (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
277:         All rights reserved.
278:
279:         Redistribution and use in source and binary forms, with or without
280:         modification, are permitted provided that the following conditions
281:         are met:
282:
283:         1. Redistributions of source code must retain the above copyright
284:         notice, this list of conditions and the following disclaimer.
285:
286:         2. Redistributions in binary form must reproduce the above copyright
287:         notice, this list of conditions and the following disclaimer in the
288:         documentation and/or other materials provided with the distribution.
289:
290:         3. The name of the author may not be used to endorse or promote products
291:         derived from this software without specific prior written permission.
292:
293:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
294:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
295:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
296:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
297:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
298:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
299:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
300:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
301:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
302:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
303:         */
ww___w__.___j__a___v___a_2s.c_o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.