001: /******************************************************************
002: * File: TestCapabilities.java
003: * Created by: Dave Reynolds
004: * Created on: 29-Nov-2004
005: *
006: * (c) Copyright 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
007: * [See end of file]
008: * $Id: TestCapabilities.java,v 1.5 2008/01/02 12:08:19 andy_seaborne Exp $
009: *****************************************************************/package com.hp.hpl.jena.reasoner.rulesys.test;
010:
011: import com.hp.hpl.jena.rdf.model.Model;
012: import com.hp.hpl.jena.rdf.model.ModelFactory;
013: import com.hp.hpl.jena.reasoner.InfGraph;
014: import com.hp.hpl.jena.reasoner.Reasoner;
015: import com.hp.hpl.jena.reasoner.ReasonerRegistry;
016: import com.hp.hpl.jena.reasoner.rulesys.DAMLMicroReasonerFactory;
017:
018: import junit.framework.TestCase;
019: import junit.framework.TestSuite;
020:
021: /**
022: * Test harness for checking that graphs generated by the main
023: * reasoners report the correct capabilities to things like the RDF writer.
024: *
025: * @author <a href="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
026: * @version $Revision: 1.5 $
027: */
028:
029: public class TestCapabilities extends TestCase {
030:
031: /**
032: * Boilerplate for junit
033: */
034: public TestCapabilities(String name) {
035: super (name);
036: }
037:
038: /**
039: * Boilerplate for junit.
040: * This is its own test suite
041: */
042: public static TestSuite suite() {
043: return new TestSuite(TestCapabilities.class);
044: }
045:
046: /**
047: * Test capability returns.
048: */
049: public void testCapabilityValues() {
050: Object[][] testSpec = new Object[][] {
051: { ReasonerRegistry.getOWLMicroReasoner(), Boolean.TRUE },
052: { ReasonerRegistry.getOWLMiniReasoner(), Boolean.TRUE },
053: { ReasonerRegistry.getOWLReasoner(), Boolean.FALSE },
054: { ReasonerRegistry.getDIGReasoner(), Boolean.FALSE },
055: { ReasonerRegistry.getRDFSReasoner(), Boolean.TRUE },
056: { ReasonerRegistry.getRDFSSimpleReasoner(),
057: Boolean.TRUE },
058: { DAMLMicroReasonerFactory.theInstance().create(null),
059: Boolean.TRUE }, };
060: Model data = ModelFactory.createDefaultModel();
061: for (int i = 0; i < testSpec.length; i++) {
062: Object[] test = testSpec[i];
063: Reasoner r = (Reasoner) test[0];
064: Boolean safe = (Boolean) test[1];
065: InfGraph ig = r.bind(data.getGraph());
066: assertEquals(r.toString(), safe.booleanValue(), ig
067: .getCapabilities().findContractSafe());
068: }
069: }
070: }
071:
072: /*
073: (c) Copyright 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
074: All rights reserved.
075:
076: Redistribution and use in source and binary forms, with or without
077: modification, are permitted provided that the following conditions
078: are met:
079:
080: 1. Redistributions of source code must retain the above copyright
081: notice, this list of conditions and the following disclaimer.
082:
083: 2. Redistributions in binary form must reproduce the above copyright
084: notice, this list of conditions and the following disclaimer in the
085: documentation and/or other materials provided with the distribution.
086:
087: 3. The name of the author may not be used to endorse or promote products
088: derived from this software without specific prior written permission.
089:
090: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
091: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
092: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
093: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
094: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
095: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
096: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
097: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
098: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
099: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
100: */
|