KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > reasoner > test > TestInfGraph


1 /*
2   (c) Copyright 2004, 2005 Hewlett-Packard Development Company, LP, all rights reserved.
3   [See end of file]
4   $Id: TestInfGraph.java,v 1.4 2005/02/21 12:18:16 andy_seaborne Exp $
5 */

6
7 package com.hp.hpl.jena.reasoner.test;
8
9 import junit.framework.*;
10
11 import com.hp.hpl.jena.graph.Graph;
12 import com.hp.hpl.jena.graph.test.AbstractTestGraph;
13 import com.hp.hpl.jena.rdf.model.ModelFactory;
14 import com.hp.hpl.jena.reasoner.InfGraph;
15
16 /**
17      Needs extending; relys on knowing that the only InfGraph currently used is
18      the Jena-provided base. Needs to be made into an abstract test and
19      parametrised with the InfGraph being tested (hence getInfGraph).
20     @author hedgehog
21 */

22
23 public class TestInfGraph extends AbstractTestGraph
24     {
25     public TestInfGraph( String JavaDoc name )
26         { super( name ); }
27     
28     public static TestSuite suite()
29         { return new TestSuite( TestInfGraph.class ); }
30     
31     private InfGraph getInfGraph()
32         {
33         return (InfGraph) ModelFactory.createOntologyModel().getGraph();
34         }
35     
36     public Graph getGraph()
37         { return getInfGraph(); }
38     
39     public void testInfGraph()
40         {
41         InfGraph ig = getInfGraph();
42         assertSame( ig.getPrefixMapping(), ig.getRawGraph().getPrefixMapping() );
43         }
44     
45     public void testInfReification()
46         {
47         InfGraph ig = getInfGraph();
48         assertSame( ig.getReifier(), ig.getRawGraph().getReifier() );
49         }
50     
51     /**
52          Placeholder. Will need revision later.
53     */

54     public void testInfCapabilities()
55         {
56         // The default Ontology inference model is RDFS which is safe
57
assertTrue( getInfGraph().getCapabilities().findContractSafe() );
58         }
59     }
60
61 /*
62     (c) Copyright 2004, 2005 Hewlett-Packard Development Company, LP
63     All rights reserved.
64
65     Redistribution and use in source and binary forms, with or without
66     modification, are permitted provided that the following conditions
67     are met:
68
69     1. Redistributions of source code must retain the above copyright
70        notice, this list of conditions and the following disclaimer.
71
72     2. Redistributions in binary form must reproduce the above copyright
73        notice, this list of conditions and the following disclaimer in the
74        documentation and/or other materials provided with the distribution.
75
76     3. The name of the author may not be used to endorse or promote products
77        derived from this software without specific prior written permission.
78
79     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
80     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
81     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
82     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
83     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
84     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
85     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
86     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
87     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
88     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
89 */
Popular Tags