KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > reasoner > rulesys > test > TestCapabilities


1 /******************************************************************
2  * File: TestCapabilities.java
3  * Created by: Dave Reynolds
4  * Created on: 29-Nov-2004
5  *
6  * (c) Copyright 2004, 2005 Hewlett-Packard Development Company, LP
7  * [See end of file]
8  * $Id: TestCapabilities.java,v 1.2 2005/02/21 12:18:11 andy_seaborne Exp $
9  *****************************************************************/

10
11 package com.hp.hpl.jena.reasoner.rulesys.test;
12
13 import com.hp.hpl.jena.rdf.model.Model;
14 import com.hp.hpl.jena.rdf.model.ModelFactory;
15 import com.hp.hpl.jena.reasoner.InfGraph;
16 import com.hp.hpl.jena.reasoner.Reasoner;
17 import com.hp.hpl.jena.reasoner.ReasonerRegistry;
18 import com.hp.hpl.jena.reasoner.rulesys.DAMLMicroReasonerFactory;
19
20 import junit.framework.TestCase;
21 import junit.framework.TestSuite;
22
23 /**
24  * Test harness for checking that graphs generated by the main
25  * reasoners report the correct capabilities to things like the RDF writer.
26  *
27  * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
28  * @version $Revision: 1.2 $
29  */

30
31 public class TestCapabilities extends TestCase {
32
33     /**
34      * Boilerplate for junit
35      */

36     public TestCapabilities( String JavaDoc name ) {
37         super( name );
38     }
39     
40     /**
41      * Boilerplate for junit.
42      * This is its own test suite
43      */

44     public static TestSuite suite() {
45         return new TestSuite( TestCapabilities.class );
46     }
47
48     /**
49      * Test capability returns.
50      */

51     public void testCapabilityValues() {
52         Object JavaDoc[][] testSpec = new Object JavaDoc[][] {
53                 {ReasonerRegistry.getOWLMicroReasoner(), Boolean.TRUE},
54                 {ReasonerRegistry.getOWLMiniReasoner(), Boolean.TRUE},
55                 {ReasonerRegistry.getOWLReasoner(), Boolean.FALSE},
56                 {ReasonerRegistry.getDIGReasoner(), Boolean.FALSE},
57                 {ReasonerRegistry.getRDFSReasoner(), Boolean.TRUE},
58                 {ReasonerRegistry.getRDFSSimpleReasoner(), Boolean.TRUE},
59                 {DAMLMicroReasonerFactory.theInstance().create(null), Boolean.TRUE},
60         };
61         Model data = ModelFactory.createDefaultModel();
62         for (int i = 0; i < testSpec.length; i++) {
63             Object JavaDoc[] test = testSpec[i];
64             Reasoner r = (Reasoner)test[0];
65             Boolean JavaDoc safe = (Boolean JavaDoc)test[1];
66             InfGraph ig = r.bind(data.getGraph());
67             assertEquals(r.toString(), safe.booleanValue(), ig.getCapabilities().findContractSafe());
68         }
69     }
70 }
71
72
73 /*
74     (c) Copyright 2004, 2005 Hewlett-Packard Development Company, LP
75     All rights reserved.
76
77     Redistribution and use in source and binary forms, with or without
78     modification, are permitted provided that the following conditions
79     are met:
80
81     1. Redistributions of source code must retain the above copyright
82        notice, this list of conditions and the following disclaimer.
83
84     2. Redistributions in binary form must reproduce the above copyright
85        notice, this list of conditions and the following disclaimer in the
86        documentation and/or other materials provided with the distribution.
87
88     3. The name of the author may not be used to endorse or promote products
89        derived from this software without specific prior written permission.
90
91     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
92     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
93     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
94     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
95     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
96     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
97     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
98     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
99     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
100     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
101 */

102
Popular Tags