KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > reasoner > dig > DIGQueryAllConceptsTranslator


1 /*****************************************************************************
2  * Source code information
3  * -----------------------
4  * Original author Ian Dickinson, HP Labs Bristol
5  * Author email Ian.Dickinson@hp.com
6  * Package Jena 2
7  * Web http://sourceforge.net/projects/jena/
8  * Created July 19th 2003
9  * Filename $RCSfile: DIGQueryAllConceptsTranslator.java,v $
10  * Revision $Revision: 1.8 $
11  * Release status $State: Exp $
12  *
13  * Last modified on $Date: 2005/03/16 18:52:28 $
14  * by $Author: ian_dickinson $
15  *
16  * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
17  * [See end of file]
18  * ****************************************************************************/

19
20 // Package
21
///////////////
22
package com.hp.hpl.jena.reasoner.dig;
23
24 import org.w3c.dom.Document JavaDoc;
25
26 import com.hp.hpl.jena.rdf.model.Model;
27 import com.hp.hpl.jena.reasoner.TriplePattern;
28 import com.hp.hpl.jena.util.iterator.*;
29 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
30
31
32 // Imports
33
///////////////
34

35 /**
36  * <p>
37  * Translator that generates DIG allconcepts queries in response to a find query:
38  * <pre>
39  * * rdf:type owl:Class
40  * </pre>
41  * or similar.
42  * </p>
43  *
44  * @author Ian Dickinson, HP Labs (<a HREF="mailto:Ian.Dickinson@hp.com">email</a>)
45  * @version Release @release@ ($Id: DIGQueryAllConceptsTranslator.java,v 1.8 2005/03/16 18:52:28 ian_dickinson Exp $)
46  */

47 public class DIGQueryAllConceptsTranslator
48     extends DIGQueryTranslator
49 {
50
51     // Constants
52
//////////////////////////////////
53

54     // Static variables
55
//////////////////////////////////
56

57     // Instance variables
58
//////////////////////////////////
59

60     // Constructors
61
//////////////////////////////////
62

63     /**
64      * <p>Construct a translator for the DIG query all concepts.</p>
65      * @param predicate The predicate URI to trigger on
66      * @param object The object URI to trigger on
67      */

68     public DIGQueryAllConceptsTranslator( String JavaDoc predicate, String JavaDoc object ) {
69         super( ALL, predicate, object );
70     }
71     
72
73     // External signature methods
74
//////////////////////////////////
75

76
77     /**
78      * <p>Since known concept names are cached by the adapter, we can just look up the
79      * current set and map directly to triples</p>
80      * @param pattern The pattern to translate to a DIG query
81      * @param da The DIG adapter through which we communicate with a DIG reasoner
82      */

83     public ExtendedIterator find( TriplePattern pattern, DIGAdapter da ) {
84         return WrappedIterator.create( da.getKnownConcepts().iterator() )
85                               .mapWith( new DIGValueToNodeMapper() )
86                               .mapWith( new TripleSubjectFiller( pattern.getPredicate(), pattern.getObject() ) );
87     }
88     
89     
90     public Document JavaDoc translatePattern( TriplePattern pattern, DIGAdapter da ) {
91         // not used
92
return null;
93     }
94
95
96     public Document JavaDoc translatePattern( TriplePattern pattern, DIGAdapter da, Model premises ) {
97         // not used
98
return null;
99     }
100
101     public ExtendedIterator translateResponseHook( Document JavaDoc response, TriplePattern query, DIGAdapter da ) {
102         // not used
103
return null;
104     }
105
106
107     // Internal implementation methods
108
//////////////////////////////////
109

110     //==============================================================================
111
// Inner class definitions
112
//==============================================================================
113

114 }
115
116
117 /*
118  * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
119  * All rights reserved.
120  *
121  * Redistribution and use in source and binary forms, with or without
122  * modification, are permitted provided that the following conditions
123  * are met:
124  * 1. Redistributions of source code must retain the above copyright
125  * notice, this list of conditions and the following disclaimer.
126  * 2. Redistributions in binary form must reproduce the above copyright
127  * notice, this list of conditions and the following disclaimer in the
128  * documentation and/or other materials provided with the distribution.
129  * 3. The name of the author may not be used to endorse or promote products
130  * derived from this software without specific prior written permission.
131  *
132  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
133  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
134  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
135  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
136  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
137  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
138  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
139  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
140  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
141  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
142  */

143
Popular Tags