1 /*
2 ##############################################################################
3 # 	Copyright (c) 2000-2006 All rights reserved
4 # 	Alberto Reggiori <areggiori@webweaving.org>
5 #	Dirk-Willem van Gulik <dirkx@webweaving.org>
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 #
11 # 1. Redistributions of source code must retain the above copyright
12 #    notice, this list of conditions and the following disclaimer.
13 #
14 # 2. Redistributions in binary form must reproduce the above copyright
15 #    notice, this list of conditions and the following disclaimer in
16 #    the documentation and/or other materials provided with the
17 #    distribution.
18 #
19 # 3. The end-user documentation included with the redistribution,
20 #    if any, must include the following acknowledgment:
21 #       "This product includes software developed by
22 #        Alberto Reggiori <areggiori@webweaving.org> and
23 #        Dirk-Willem van Gulik <dirkx@webweaving.org>."
24 #    Alternately, this acknowledgment may appear in the software itself,
25 #    if and wherever such third-party acknowledgments normally appear.
26 #
27 # 4. All advertising materials mentioning features or use of this software
28 #    must display the following acknowledgement:
29 #    This product includes software developed by the University of
30 #    California, Berkeley and its contributors.
31 #
32 # 5. Neither the name of the University nor the names of its contributors
33 #    may be used to endorse or promote products derived from this software
34 #    without specific prior written permission.
35 #
36 # 6. Products derived from this software may not be called "RDFStore"
37 #    nor may "RDFStore" appear in their names without prior written
38 #    permission.
39 #
40 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
41 # ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
44 # FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51 # OF THE POSSIBILITY OF SUCH DAMAGE.
52 #
53 # ====================================================================
54 #
55 # This software consists of work developed by Alberto Reggiori and
56 # Dirk-Willem van Gulik. The RDF specific part is based based on public
57 # domain software written at the Stanford University Database Group by
58 # Sergey Melnik. For more information on the RDF API Draft work,
59 # please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
60 # The DBMS TCP/IP server part is based on software originally written
61 # by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
62 # The Netherlands.
63 #
64 ##############################################################################
65 #
66 # $Id: rdfstore_iterator.h,v 1.6 2006/06/19 10:10:23 areggiori Exp $
67 #
68 */
69 
70 #ifndef _H_RDFSTORE_ITERATOR
71 #define _H_RDFSTORE_ITERATOR
72 
73 #include "rdfstore.h"
74 #include "rdfstore_compress.h"
75 
76 typedef struct rdfstore_iterator {
77         struct rdfstore * store;
78         unsigned int size; /* num of statements i.e. number of bits set in ids[] below */
79         unsigned char ids[RDFSTORE_MAXRECORDS_BYTES_SIZE]; /* keep the set of statements for search iterators i.e. bit vector 1 bit per statement */
80         unsigned int ids_size; /* its size in bytes also */
81         unsigned int remove_holes;
82         unsigned int st_counter;
83         unsigned int    pos;
84         } rdfstore_iterator;
85 
86 typedef rdfstore_iterator * RDFStore_Iterator;
87 
88 /* dispose iterator */
89 int rdfstore_iterator_close (
90 	rdfstore_iterator * me
91         );
92 
93 int rdfstore_iterator_hasnext (
94         rdfstore_iterator       * me
95         );
96 
97 RDF_Statement   *
98 rdfstore_iterator_next (
99         rdfstore_iterator       * me
100         );
101 
102 RDF_Node   *
103 rdfstore_iterator_next_subject (
104         rdfstore_iterator       * me
105         );
106 
107 RDF_Node   *
108 rdfstore_iterator_next_predicate (
109         rdfstore_iterator       * me
110         );
111 
112 RDF_Node   *
113 rdfstore_iterator_next_object (
114         rdfstore_iterator       * me
115         );
116 
117 RDF_Node   *
118 rdfstore_iterator_next_context (
119         rdfstore_iterator       * me
120         );
121 
122 RDF_Statement   *
123 rdfstore_iterator_current (
124         rdfstore_iterator       * me
125         );
126 
127 RDF_Node   *
128 rdfstore_iterator_current_subject (
129         rdfstore_iterator       * me
130         );
131 
132 RDF_Node   *
133 rdfstore_iterator_current_predicate (
134         rdfstore_iterator       * me
135         );
136 
137 RDF_Node   *
138 rdfstore_iterator_current_object (
139         rdfstore_iterator       * me
140         );
141 
142 RDF_Node   *
143 rdfstore_iterator_current_context (
144         rdfstore_iterator       * me
145         );
146 
147 RDF_Statement   *
148 rdfstore_iterator_first (
149         rdfstore_iterator       * me
150         );
151 
152 RDF_Node   *
153 rdfstore_iterator_first_subject (
154         rdfstore_iterator       * me
155         );
156 
157 RDF_Node   *
158 rdfstore_iterator_first_predicate (
159         rdfstore_iterator       * me
160         );
161 
162 RDF_Node   *
163 rdfstore_iterator_first_object (
164         rdfstore_iterator       * me
165         );
166 
167 RDF_Node   *
168 rdfstore_iterator_first_context (
169         rdfstore_iterator       * me
170         );
171 
172 RDF_Statement   *
173 rdfstore_iterator_each (
174         rdfstore_iterator       * me
175         );
176 
177 RDF_Node   *
178 rdfstore_iterator_each_subject (
179         rdfstore_iterator       * me
180         );
181 
182 RDF_Node   *
183 rdfstore_iterator_each_predicate (
184         rdfstore_iterator       * me
185         );
186 
187 RDF_Node   *
188 rdfstore_iterator_each_object (
189         rdfstore_iterator       * me
190         );
191 
192 RDF_Node   *
193 rdfstore_iterator_each_context (
194         rdfstore_iterator       * me
195         );
196 
197 int rdfstore_iterator_remove (
198         rdfstore_iterator       * me
199         );
200 
201 int rdfstore_iterator_contains (
202         rdfstore_iterator       * me,
203         RDF_Statement           * statement,
204         RDF_Node		* given_context
205         );
206 
207 rdfstore_iterator *
208 rdfstore_iterator_intersect (
209         rdfstore_iterator       * me,
210         rdfstore_iterator       * you
211         );
212 
213 rdfstore_iterator *
214 rdfstore_iterator_unite (
215         rdfstore_iterator       * me,
216         rdfstore_iterator       * you
217         );
218 
219 rdfstore_iterator *
220 rdfstore_iterator_subtract (
221         rdfstore_iterator       * me,
222         rdfstore_iterator       * you
223         );
224 
225 rdfstore_iterator *
226 rdfstore_iterator_complement (
227         rdfstore_iterator       * me
228         );
229 
230 rdfstore_iterator *
231 rdfstore_iterator_exor (
232         rdfstore_iterator       * me,
233         rdfstore_iterator       * you
234         );
235 
236 rdfstore_iterator *
237 rdfstore_iterator_duplicate (
238         rdfstore_iterator       * me
239         );
240 
241 unsigned int rdfstore_iterator_size (
242         rdfstore_iterator       * me
243         );
244 
245 #endif
246