KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > graph > query > QueryHandler


1 /*
2   (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3   [See end of file]
4   $Id: QueryHandler.java,v 1.16 2005/02/21 11:52:25 andy_seaborne Exp $
5 */

6
7 package com.hp.hpl.jena.graph.query;
8
9 import com.hp.hpl.jena.graph.*;
10 import com.hp.hpl.jena.util.iterator.*;
11
12 /**
13     a QueryHandler handles queries on behalf of a graph. It's primary purpose
14     is to isolate changes to the query interface away from the Graph; multiple
15     different Graph implementations can use the same QueryHandler class, such
16     as the built-in SimpleQueryHandler.
17
18     @author kers
19 */

20
21 public interface QueryHandler
22     {
23     /**
24         prepare a plan for generating bindings given the query _q_ and the result
25         variables _variables_.
26     */

27     public BindingQueryPlan prepareBindings( Query q, Node [] variables );
28
29     /**
30         produce a single Stage which will probe the underlying graph for triples
31         matching p and inject all the resulting bindings into the processing stream
32         (see Stage for details)
33     <p>
34         _map_ is the variable binding map to use and update. _constraints_ is
35         the current constraint expression: if this Stage can absorb some of the
36         ANDed constraints, it may do so, and remove them from the ExpressionSet.
37     */

38     public Stage patternStage( Mapping map, ExpressionSet constraints, Triple [] p );
39     
40     /**
41         deliver a plan for executing the tree-match query defined by _pattern_.
42     */

43     public TreeQueryPlan prepareTree( Graph pattern );
44     
45     /**
46         deliver an iterator over all the objects _o_ such that _(s, p, o)_ is in the
47         underlying graph; nulls count as wildcards. .remove() is not defined
48         on this iterator.
49     */

50     public ExtendedIterator objectsFor( Node s, Node p );
51
52     /**
53         deliver an iterator over all the subjects _s_ such that _(s, p, o)_ is in the
54         underlying graph; nulls count as wildcards. .remove() is not defined
55         on this iterator.
56     */

57     public ExtendedIterator subjectsFor( Node p, Node o );
58
59     /**
60          Answer an iterator over all the predicates <code>p</code> such that
61          <code>(s, p, o)</code> is in the underlying graph. .remove() is not
62          defined on this iterator.
63     */

64     public ExtendedIterator predicatesFor( Node s, Node o );
65     
66     /**
67         true iff the graph contains a triple in which n appears somewhere.
68         if n is a fluid node, it is not defined whether true or false is returned,
69         so don't do that.
70     */

71     public boolean containsNode( Node n );
72
73     }
74
75 /*
76     (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
77     All rights reserved.
78
79     Redistribution and use in source and binary forms, with or without
80     modification, are permitted provided that the following conditions
81     are met:
82
83     1. Redistributions of source code must retain the above copyright
84        notice, this list of conditions and the following disclaimer.
85
86     2. Redistributions in binary form must reproduce the above copyright
87        notice, this list of conditions and the following disclaimer in the
88        documentation and/or other materials provided with the distribution.
89
90     3. The name of the author may not be used to endorse or promote products
91        derived from this software without specific prior written permission.
92
93     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
94     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
95     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
96     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
97     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
99     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
100     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
101     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
102     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
103 */

104
Popular Tags