001: /******************************************************************
002: * File: OWLMicroReasonerFactory.java
003: * Created by: Dave Reynolds
004: * Created on: 21-Mar-2004
005: *
006: * (c) Copyright 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP, all rights reserved.
007: * [See end of file]
008: * $Id: OWLMicroReasonerFactory.java,v 1.11 2008/01/02 12:07:47 andy_seaborne Exp $
009: *****************************************************************/package com.hp.hpl.jena.reasoner.rulesys;
010:
011: import com.hp.hpl.jena.reasoner.*;
012: import com.hp.hpl.jena.reasoner.rulesys.Util;
013: import com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveReasoner;
014: import com.hp.hpl.jena.rdf.model.*;
015: import com.hp.hpl.jena.vocabulary.*;
016:
017: /**
018: * Reasoner factory for the OWL micro configuration.
019: * This only supports:
020: * <ul>
021: * <li>RDFS entailments</li>
022: * <li>basic OWL axioms like ObjectProperty subClassOf Property</li>
023: * <li>intersectionOf, equivalentClass and forward implication of unionOf sufficient for traversal
024: * of explicit class hierachies<.li>
025: * <li>Property axioms (inversOf, SymmetricProperty, TransitiveProperty, equivalentProperty)</li>
026: * </ul>
027: * There is some experimental support for the cheaper class restriction handlingly which
028: * should not be relied on at this point.
029: *
030: * @author <a href="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
031: * @version $Revision: 1.11 $ on $Date: 2008/01/02 12:07:47 $
032: */
033: public class OWLMicroReasonerFactory implements ReasonerFactory {
034:
035: /** Single global instance of this factory */
036: private static ReasonerFactory theInstance = new OWLMicroReasonerFactory();
037:
038: /** Static URI for this reasoner type */
039: public static final String URI = "http://jena.hpl.hp.com/2003/OWLMicroFBRuleReasoner";
040:
041: /** Cache of the capabilities description */
042: protected Model capabilities;
043:
044: /**
045: * Return the single global instance of this factory
046: */
047: public static ReasonerFactory theInstance() {
048: return theInstance;
049: }
050:
051: /**
052: * Constructor method that builds an instance of the associated Reasoner
053: * @param configuration a set of arbitrary configuration information to be
054: * passed the reasoner encoded within an RDF graph
055: */
056: public Reasoner create(Resource configuration) {
057: OWLMicroReasoner reasoner = new OWLMicroReasoner(this );
058: if (configuration != null) {
059: Boolean doLog = Util.checkBinaryPredicate(
060: ReasonerVocabulary.PROPderivationLogging,
061: configuration);
062: if (doLog != null) {
063: reasoner.setDerivationLogging(doLog.booleanValue());
064: }
065: Boolean doTrace = Util.checkBinaryPredicate(
066: ReasonerVocabulary.PROPtraceOn, configuration);
067: if (doTrace != null) {
068: reasoner.setTraceOn(doTrace.booleanValue());
069: }
070: }
071: return reasoner;
072: }
073:
074: /**
075: * Return a description of the capabilities of this reasoner encoded in
076: * RDF. This method is normally called by the ReasonerRegistry which caches
077: * the resulting information so dynamically creating here is not really an overhead.
078: */
079: public Model getCapabilities() {
080: if (capabilities == null) {
081: capabilities = ModelFactory.createDefaultModel();
082: Resource base = capabilities.createResource(getURI());
083: base
084: .addProperty(ReasonerVocabulary.nameP,
085: "OWL Mini Reasoner")
086: .addProperty(
087: ReasonerVocabulary.descriptionP,
088: "Experimental mini OWL reasoner.\n"
089: + "Can separate tbox and abox data if desired to reuse tbox caching or mix them.")
090: .addProperty(ReasonerVocabulary.supportsP,
091: RDFS.subClassOf).addProperty(
092: ReasonerVocabulary.supportsP,
093: RDFS.subPropertyOf).addProperty(
094: ReasonerVocabulary.supportsP, RDFS.member)
095: .addProperty(ReasonerVocabulary.supportsP,
096: RDFS.range).addProperty(
097: ReasonerVocabulary.supportsP, RDFS.domain)
098: .addProperty(
099: ReasonerVocabulary.supportsP,
100: TransitiveReasoner.directSubClassOf
101: .toString()) // TODO -- typing
102: .addProperty(
103: ReasonerVocabulary.supportsP,
104: TransitiveReasoner.directSubPropertyOf
105: .toString()) // TODO -- typing
106: // TODO - add OWL elements supported
107: .addProperty(ReasonerVocabulary.supportsP,
108: OWL.ObjectProperty).addProperty(
109: ReasonerVocabulary.supportsP,
110: OWL.DatatypeProperty).addProperty(
111: ReasonerVocabulary.supportsP,
112: OWL.FunctionalProperty).addProperty(
113: ReasonerVocabulary.supportsP,
114: OWL.SymmetricProperty).addProperty(
115: ReasonerVocabulary.supportsP,
116: OWL.TransitiveProperty).addProperty(
117: ReasonerVocabulary.supportsP,
118: OWL.InverseFunctionalProperty)
119:
120: .addProperty(ReasonerVocabulary.supportsP,
121: OWL.hasValue).addProperty(
122: ReasonerVocabulary.supportsP,
123: OWL.intersectionOf).addProperty(
124: ReasonerVocabulary.supportsP, OWL.unionOf) // Only partial
125:
126: .addProperty(ReasonerVocabulary.versionP, "0.1");
127: }
128: return capabilities;
129: }
130:
131: /**
132: * Return the URI labelling this type of reasoner
133: */
134: public String getURI() {
135: return URI;
136: }
137:
138: }
139:
140: /*
141: (c) Copyright 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
142: All rights reserved.
143:
144: Redistribution and use in source and binary forms, with or without
145: modification, are permitted provided that the following conditions
146: are met:
147:
148: 1. Redistributions of source code must retain the above copyright
149: notice, this list of conditions and the following disclaimer.
150:
151: 2. Redistributions in binary form must reproduce the above copyright
152: notice, this list of conditions and the following disclaimer in the
153: documentation and/or other materials provided with the distribution.
154:
155: 3. The name of the author may not be used to endorse or promote products
156: derived from this software without specific prior written permission.
157:
158: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
159: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
160: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
161: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
162: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
163: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
164: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
165: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
166: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
167: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
168: */
|