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