001: /*
002: (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: All rights reserved.
004: [See end of file]
005: */
006:
007: package com.hp.hpl.jena.vocabulary.test;
008:
009: import junit.framework.TestSuite;
010:
011: import com.hp.hpl.jena.rdf.model.*;
012: import com.hp.hpl.jena.rdf.model.test.ModelTestBase;
013: import com.hp.hpl.jena.vocabulary.*;
014:
015: /**
016: Test the modelspec vocabulary, including ensuring that it
017: has the necessary typing information.
018: @author kers
019: */
020: public class TestVocabJenaModelSpec extends ModelTestBase {
021: public TestVocabJenaModelSpec(String name) {
022: super (name);
023: }
024:
025: public static TestSuite suite() {
026: return new TestSuite(TestVocabJenaModelSpec.class);
027: }
028:
029: public void testURI() {
030: assertEquals("http://jena.hpl.hp.com/2003/08/jms#",
031: JenaModelSpec.getURI());
032: assertEquals(JenaModelSpec.baseURI, JenaModelSpec.getURI());
033: }
034:
035: public void testProperties() {
036: assertEquals(jmsProperty("loadWith"), JenaModelSpec.loadWith);
037: assertEquals(jmsProperty("ontLanguage"),
038: JenaModelSpec.ontLanguage);
039: assertEquals(jmsProperty("docManager"),
040: JenaModelSpec.docManager);
041: assertEquals(jmsProperty("importMaker"),
042: JenaModelSpec.importMaker);
043: assertEquals(jmsProperty("reasonsWith"),
044: JenaModelSpec.reasonsWith);
045: assertEquals(jmsProperty("ruleSetURL"),
046: JenaModelSpec.ruleSetURL);
047: assertEquals(jmsProperty("ruleSet"), JenaModelSpec.ruleSet);
048: assertEquals(jmsProperty("schemaURL"), JenaModelSpec.schemaURL);
049: assertEquals(jmsProperty("hasRule"), JenaModelSpec.hasRule);
050: assertEquals(jmsProperty("policyPath"),
051: JenaModelSpec.policyPath);
052: assertEquals(jmsProperty("hasConnection"),
053: JenaModelSpec.hasConnection);
054: assertEquals(jmsProperty("dbUser"), JenaModelSpec.dbUser);
055: assertEquals(jmsProperty("dbPassword"),
056: JenaModelSpec.dbPassword);
057: assertEquals(jmsProperty("dbURL"), JenaModelSpec.dbURL);
058: assertEquals(jmsProperty("dbType"), JenaModelSpec.dbType);
059: assertEquals(jmsProperty("dbClass"), JenaModelSpec.dbClass);
060: assertEquals(jmsProperty("maker"), JenaModelSpec.maker);
061: assertEquals(jmsProperty("reificationMode"),
062: JenaModelSpec.reificationMode);
063: assertEquals(jmsProperty("reasoner"), JenaModelSpec.reasoner);
064: assertEquals(jmsProperty("fileBase"), JenaModelSpec.fileBase);
065: assertEquals(jmsProperty("typeCreatedBy"),
066: JenaModelSpec.typeCreatedBy);
067: assertEquals(jmsProperty("modelName"), JenaModelSpec.modelName);
068: }
069:
070: public void testResource() {
071: assertEquals(jmsResource("MakerSpec"), JenaModelSpec.MakerSpec);
072: assertEquals(jmsResource("FileMakerSpec"),
073: JenaModelSpec.FileMakerSpec);
074: assertEquals(jmsResource("MemMakerSpec"),
075: JenaModelSpec.MemMakerSpec);
076: assertEquals(jmsResource("RDBMakerSpec"),
077: JenaModelSpec.RDBMakerSpec);
078: assertEquals(jmsResource("ModelSpec"), JenaModelSpec.ModelSpec);
079: assertEquals(jmsResource("DefaultModelSpec"),
080: JenaModelSpec.DefaultModelSpec);
081: assertEquals(jmsResource("PlainModelSpec"),
082: JenaModelSpec.PlainModelSpec);
083: assertEquals(jmsResource("InfModelSpec"),
084: JenaModelSpec.InfModelSpec);
085: assertEquals(jmsResource("OntModelSpec"),
086: JenaModelSpec.OntModelSpec);
087: assertEquals(jmsResource("FileModelSpec"),
088: JenaModelSpec.FileModelSpec);
089: assertEquals(jmsResource("rsStandard"),
090: JenaModelSpec.rsStandard);
091: assertEquals(jmsResource("rsMinimal"), JenaModelSpec.rsMinimal);
092: assertEquals(jmsResource("rsConvenient"),
093: JenaModelSpec.rsConvenient);
094: }
095:
096: public void testMakerSubclasses() {
097: ensure(JenaModelSpec.MemMakerSpec, RDFS.subClassOf,
098: JenaModelSpec.MakerSpec);
099: ensure(JenaModelSpec.FileMakerSpec, RDFS.subClassOf,
100: JenaModelSpec.MakerSpec);
101: ensure(JenaModelSpec.RDBMakerSpec, RDFS.subClassOf,
102: JenaModelSpec.MakerSpec);
103: }
104:
105: public void testSpecSubclasses() {
106: ensure(JenaModelSpec.DefaultModelSpec, RDFS.subClassOf,
107: JenaModelSpec.ModelSpec);
108: ensure(JenaModelSpec.PlainModelSpec, RDFS.subClassOf,
109: JenaModelSpec.ModelSpec);
110: ensure(JenaModelSpec.InfModelSpec, RDFS.subClassOf,
111: JenaModelSpec.PlainModelSpec);
112: ensure(JenaModelSpec.FileModelSpec, RDFS.subClassOf,
113: JenaModelSpec.PlainModelSpec);
114: ensure(JenaModelSpec.OntModelSpec, RDFS.subClassOf,
115: JenaModelSpec.InfModelSpec);
116: }
117:
118: public void testDomains() {
119: ensure(JenaModelSpec.reificationMode, RDFS.domain,
120: JenaModelSpec.MakerSpec);
121: ensure(JenaModelSpec.maker, RDFS.domain,
122: JenaModelSpec.PlainModelSpec);
123: ensure(JenaModelSpec.modelName, RDFS.domain,
124: JenaModelSpec.ModelSpec);
125: ensure(JenaModelSpec.loadWith, RDFS.domain,
126: JenaModelSpec.ModelSpec);
127: //
128: ensure(JenaModelSpec.importMaker, RDFS.domain,
129: JenaModelSpec.OntModelSpec);
130: ensure(JenaModelSpec.ontLanguage, RDFS.domain,
131: JenaModelSpec.OntModelSpec);
132: ensure(JenaModelSpec.reasonsWith, RDFS.domain,
133: JenaModelSpec.InfModelSpec);
134: ensure(JenaModelSpec.fileBase, RDFS.domain,
135: JenaModelSpec.FileMakerSpec);
136: }
137:
138: protected void ensure(Resource S, Property P, RDFNode O) {
139: if (!JenaModelSpec.getSchema().contains(S, P, O))
140: fail("schema omits (" + nice(S) + " " + nice(P) + " "
141: + nice(O) + ")");
142: }
143:
144: protected Resource jmsResource(String string) {
145: return resource(JenaModelSpec.getURI() + string);
146: }
147:
148: protected Property jmsProperty(String string) {
149: return property(JenaModelSpec.getURI() + string);
150: }
151:
152: }
153:
154: /*
155: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
156: * All rights reserved.
157: *
158: * Redistribution and use in source and binary forms, with or without
159: * modification, are permitted provided that the following conditions
160: * are met:
161: * 1. Redistributions of source code must retain the above copyright
162: * notice, this list of conditions and the following disclaimer.
163: * 2. Redistributions in binary form must reproduce the above copyright
164: * notice, this list of conditions and the following disclaimer in the
165: * documentation and/or other materials provided with the distribution.
166: * 3. The name of the author may not be used to endorse or promote products
167: * derived from this software without specific prior written permission.
168: *
169: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
170: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
171: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
172: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
173: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
174: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
175: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
176: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
177: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
178: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
179: */
|