001: /*****************************************************************************
002: * Source code information
003: * -----------------------
004: * Original author Ian Dickinson, HP Labs Bristol
005: * Author email Ian.Dickinson@hp.com
006: * Package Jena 2
007: * Web http://sourceforge.net/projects/jena/
008: * Created July 19th 2003
009: * Filename $RCSfile: DIGQueryAllConceptsTranslator.java,v $
010: * Revision $Revision: 1.11 $
011: * Release status $State: Exp $
012: *
013: * Last modified on $Date: 2008/01/02 12:07:11 $
014: * by $Author: andy_seaborne $
015: *
016: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
017: * [See end of file]
018: * ****************************************************************************/package com.hp.hpl.jena.reasoner.dig;
019:
020: import org.w3c.dom.Document;
021:
022: import com.hp.hpl.jena.rdf.model.Model;
023: import com.hp.hpl.jena.reasoner.TriplePattern;
024: import com.hp.hpl.jena.util.iterator.*;
025: import com.hp.hpl.jena.util.iterator.ExtendedIterator;
026:
027: // Imports
028: ///////////////
029:
030: /**
031: * <p>
032: * Translator that generates DIG allconcepts queries in response to a find query:
033: * <pre>
034: * * rdf:type owl:Class
035: * </pre>
036: * or similar.
037: * </p>
038: *
039: * @author Ian Dickinson, HP Labs (<a href="mailto:Ian.Dickinson@hp.com">email</a>)
040: * @version Release @release@ ($Id: DIGQueryAllConceptsTranslator.java,v 1.11 2008/01/02 12:07:11 andy_seaborne Exp $)
041: */
042: public class DIGQueryAllConceptsTranslator extends DIGQueryTranslator {
043:
044: // Constants
045: //////////////////////////////////
046:
047: // Static variables
048: //////////////////////////////////
049:
050: // Instance variables
051: //////////////////////////////////
052:
053: // Constructors
054: //////////////////////////////////
055:
056: /**
057: * <p>Construct a translator for the DIG query all concepts.</p>
058: * @param predicate The predicate URI to trigger on
059: * @param object The object URI to trigger on
060: */
061: public DIGQueryAllConceptsTranslator(String predicate, String object) {
062: super (ALL, predicate, object);
063: }
064:
065: // External signature methods
066: //////////////////////////////////
067:
068: /**
069: * <p>Since known concept names are cached by the adapter, we can just look up the
070: * current set and map directly to triples</p>
071: * @param pattern The pattern to translate to a DIG query
072: * @param da The DIG adapter through which we communicate with a DIG reasoner
073: */
074: public ExtendedIterator find(TriplePattern pattern, DIGAdapter da) {
075: return WrappedIterator.create(da.getKnownConcepts().iterator())
076: .mapWith(new DIGValueToNodeMapper()).mapWith(
077: new TripleSubjectFiller(pattern.getPredicate(),
078: pattern.getObject()));
079: }
080:
081: public Document translatePattern(TriplePattern pattern,
082: DIGAdapter da) {
083: // not used
084: return null;
085: }
086:
087: public Document translatePattern(TriplePattern pattern,
088: DIGAdapter da, Model premises) {
089: // not used
090: return null;
091: }
092:
093: public ExtendedIterator translateResponseHook(Document response,
094: TriplePattern query, DIGAdapter da) {
095: // not used
096: return null;
097: }
098:
099: // Internal implementation methods
100: //////////////////////////////////
101:
102: //==============================================================================
103: // Inner class definitions
104: //==============================================================================
105:
106: }
107:
108: /*
109: * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
110: * All rights reserved.
111: *
112: * Redistribution and use in source and binary forms, with or without
113: * modification, are permitted provided that the following conditions
114: * are met:
115: * 1. Redistributions of source code must retain the above copyright
116: * notice, this list of conditions and the following disclaimer.
117: * 2. Redistributions in binary form must reproduce the above copyright
118: * notice, this list of conditions and the following disclaimer in the
119: * documentation and/or other materials provided with the distribution.
120: * 3. The name of the author may not be used to endorse or promote products
121: * derived from this software without specific prior written permission.
122: *
123: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
124: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
125: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
126: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
127: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
128: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
129: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
130: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
131: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
132: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
133: */
|