KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > vocabulary > test > TestVocabJenaModelSpec


1 /*
2     (c) Copyright 2005 Hewlett-Packard Development Company, LP
3     All rights reserved.
4     [See end of file]
5 */

6
7 package com.hp.hpl.jena.vocabulary.test;
8
9 import junit.framework.TestSuite;
10
11 import com.hp.hpl.jena.rdf.model.*;
12 import com.hp.hpl.jena.rdf.model.test.ModelTestBase;
13 import com.hp.hpl.jena.vocabulary.*;
14
15 /**
16     Test the modelspec vocabulary, including ensuring that it
17     has the necessary typing information.
18     @author kers
19 */

20 public class TestVocabJenaModelSpec extends ModelTestBase
21     {
22     public TestVocabJenaModelSpec( String JavaDoc name )
23         { super( name ); }
24     
25     public static TestSuite suite()
26         { return new TestSuite( TestVocabJenaModelSpec.class ); }
27     
28     public void testURI()
29         {
30         assertEquals( "http://jena.hpl.hp.com/2003/08/jms#", JenaModelSpec.getURI() );
31         assertEquals( JenaModelSpec.baseURI, JenaModelSpec.getURI() );
32         }
33     
34     public void testProperties()
35         {
36         assertEquals( jmsProperty( "loadWith" ), JenaModelSpec.loadWith );
37         assertEquals( jmsProperty( "ontLanguage" ), JenaModelSpec.ontLanguage );
38         assertEquals( jmsProperty( "docManager" ), JenaModelSpec.docManager );
39         assertEquals( jmsProperty( "importMaker" ), JenaModelSpec.importMaker );
40         assertEquals( jmsProperty( "reasonsWith" ), JenaModelSpec.reasonsWith );
41         assertEquals( jmsProperty( "ruleSetURL" ), JenaModelSpec.ruleSetURL );
42         assertEquals( jmsProperty( "ruleSet" ), JenaModelSpec.ruleSet );
43         assertEquals( jmsProperty( "schemaURL" ), JenaModelSpec.schemaURL );
44         assertEquals( jmsProperty( "hasRule" ), JenaModelSpec.hasRule );
45         assertEquals( jmsProperty( "policyPath" ), JenaModelSpec.policyPath );
46         assertEquals( jmsProperty( "hasConnection" ), JenaModelSpec.hasConnection );
47         assertEquals( jmsProperty( "dbUser" ), JenaModelSpec.dbUser );
48         assertEquals( jmsProperty( "dbPassword" ), JenaModelSpec.dbPassword );
49         assertEquals( jmsProperty( "dbURL" ), JenaModelSpec.dbURL );
50         assertEquals( jmsProperty( "dbType" ), JenaModelSpec.dbType );
51         assertEquals( jmsProperty( "dbClass" ), JenaModelSpec.dbClass );
52         assertEquals( jmsProperty( "maker" ), JenaModelSpec.maker );
53         assertEquals( jmsProperty( "reificationMode" ), JenaModelSpec.reificationMode );
54         assertEquals( jmsProperty( "reasoner" ), JenaModelSpec.reasoner );
55         assertEquals( jmsProperty( "fileBase" ), JenaModelSpec.fileBase );
56         assertEquals( jmsProperty( "typeCreatedBy" ), JenaModelSpec.typeCreatedBy );
57         assertEquals( jmsProperty( "modelName" ), JenaModelSpec.modelName );
58         }
59     
60     public void testResource()
61         {
62         assertEquals( jmsResource( "MakerSpec" ), JenaModelSpec.MakerSpec );
63         assertEquals( jmsResource( "FileMakerSpec" ), JenaModelSpec.FileMakerSpec );
64         assertEquals( jmsResource( "MemMakerSpec" ), JenaModelSpec.MemMakerSpec );
65         assertEquals( jmsResource( "RDBMakerSpec" ), JenaModelSpec.RDBMakerSpec );
66         assertEquals( jmsResource( "ModelSpec" ), JenaModelSpec.ModelSpec );
67         assertEquals( jmsResource( "DefaultModelSpec" ), JenaModelSpec.DefaultModelSpec );
68         assertEquals( jmsResource( "PlainModelSpec" ), JenaModelSpec.PlainModelSpec );
69         assertEquals( jmsResource( "InfModelSpec" ), JenaModelSpec.InfModelSpec );
70         assertEquals( jmsResource( "OntModelSpec" ), JenaModelSpec.OntModelSpec );
71         assertEquals( jmsResource( "FileModelSpec" ), JenaModelSpec.FileModelSpec );
72         assertEquals( jmsResource( "rsStandard" ), JenaModelSpec.rsStandard );
73         assertEquals( jmsResource( "rsMinimal" ), JenaModelSpec.rsMinimal );
74         assertEquals( jmsResource( "rsConvenient" ), JenaModelSpec.rsConvenient );
75         }
76     
77     public void testMakerSubclasses()
78         {
79         ensure( JenaModelSpec.MemMakerSpec, RDFS.subClassOf, JenaModelSpec.MakerSpec );
80         ensure( JenaModelSpec.FileMakerSpec, RDFS.subClassOf, JenaModelSpec.MakerSpec );
81         ensure( JenaModelSpec.RDBMakerSpec, RDFS.subClassOf, JenaModelSpec.MakerSpec );
82         }
83     
84     public void testSpecSubclasses()
85         {
86         ensure( JenaModelSpec.DefaultModelSpec, RDFS.subClassOf, JenaModelSpec.ModelSpec );
87         ensure( JenaModelSpec.PlainModelSpec, RDFS.subClassOf, JenaModelSpec.ModelSpec );
88         ensure( JenaModelSpec.InfModelSpec, RDFS.subClassOf, JenaModelSpec.PlainModelSpec );
89         ensure( JenaModelSpec.FileModelSpec, RDFS.subClassOf, JenaModelSpec.PlainModelSpec );
90         ensure( JenaModelSpec.OntModelSpec, RDFS.subClassOf, JenaModelSpec.InfModelSpec );
91         }
92     
93     public void testDomains()
94         {
95         ensure( JenaModelSpec.reificationMode, RDFS.domain, JenaModelSpec.MakerSpec );
96         ensure( JenaModelSpec.maker, RDFS.domain, JenaModelSpec.PlainModelSpec );
97         ensure( JenaModelSpec.modelName, RDFS.domain, JenaModelSpec.ModelSpec );
98     //
99
ensure( JenaModelSpec.importMaker, RDFS.domain, JenaModelSpec.OntModelSpec );
100         ensure( JenaModelSpec.ontLanguage, RDFS.domain, JenaModelSpec.OntModelSpec );
101         ensure( JenaModelSpec.reasonsWith, RDFS.domain, JenaModelSpec.InfModelSpec );
102         ensure( JenaModelSpec.fileBase, RDFS.domain, JenaModelSpec.FileMakerSpec );
103         }
104     
105     protected void ensure( Resource S, Property P, RDFNode O )
106         {
107         if (!JenaModelSpec.getSchema().contains( S, P, O ))
108             fail( "schema omits (" + nice( S ) + " " + nice( P ) + " " + nice( O ) + ")" );
109         }
110
111     protected Resource jmsResource( String JavaDoc string )
112         { return resource( JenaModelSpec.getURI() + string ); }
113
114     protected Property jmsProperty( String JavaDoc string )
115         { return property( JenaModelSpec.getURI() + string );}
116
117     }
118
119
120 /*
121  * (c) Copyright 2005 Hewlett-Packard Development Company, LP
122  * All rights reserved.
123  *
124  * Redistribution and use in source and binary forms, with or without
125  * modification, are permitted provided that the following conditions
126  * are met:
127  * 1. Redistributions of source code must retain the above copyright
128  * notice, this list of conditions and the following disclaimer.
129  * 2. Redistributions in binary form must reproduce the above copyright
130  * notice, this list of conditions and the following disclaimer in the
131  * documentation and/or other materials provided with the distribution.
132  * 3. The name of the author may not be used to endorse or promote products
133  * derived from this software without specific prior written permission.
134  *
135  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
136  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
137  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
138  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
139  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
140  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
144  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145 */
Popular Tags