Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
meta_search.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 
27 #ifndef META_SEARCH_H
28 #define META_SEARCH_H
29 
30 #include "jansson.h"
31 #include "irods_util_library.h"
32 
33 #include "linked_list.h"
34 #include "typedefs.h"
35 #include "query.h"
36 
37 
43 typedef struct IRodsSearch
44 {
50 } IRodsSearch;
51 
52 
61 typedef struct SearchTerm
62 {
69  const char *st_clause_s;
70 
76  int st_key_column_id;
77 
83  const char *st_key_s;
84 
85 
92  const char *st_op_s;
93 
94 
100  int st_value_column_id;
101 
107  const char *st_value_s;
108 
114  char *st_key_buffer_s;
115 
121  char *st_value_buffer_s;
122 } SearchTerm;
123 
124 
131 typedef struct SearchTermNode
132 {
135 
139 
140 
141 #ifdef __cplusplus
142 extern "C"
143 {
144 #endif
145 
146 
154 
155 
163 
164 
172 
173 
174 
175 
184 IRODS_UTIL_API QueryResults *DoIRodsSearch (IRodsSearch *search_p, struct IRodsConnection *connection_p);
185 
186 
202 IRODS_UTIL_API bool AddMetadataDataAttributeSearchTerm (IRodsSearch *search_p, const char *clause_s, const char *key_s, const char *op_s, const char *value_s);
203 
204 
205 
221 IRODS_UTIL_API bool AddIRodsSearchTerm (IRodsSearch *search_p, const char *clause_s, const char *key_s, const int key_id, const char *op_s, const char *value_s, const int value_id);
222 
223 
243 IRODS_UTIL_API int32 DetermineSearchTerms (LinkedList *terms_p, const json_t *json_p);
244 
245 
258 IRODS_UTIL_API QueryResults *DoMetaSearch (const IRodsSearch * const search_p, struct IRodsConnection *connection_p, int *select_column_ids_p, const int num_select_columns, const bool upper_case_flag, char *zone_s);
259 
260 
261 
262 
273 IRODS_UTIL_API QueryResults *DoMetaSearchForAllDataAndCollections (const IRodsSearch * const search_p, struct IRodsConnection *connection_p, const bool upper_case_flag, char *zone_s);
274 
275 
276 #ifdef __cplusplus
277 }
278 #endif
279 
280 
281 #endif /* META_SEARCH_H_ */
DoMetaSearch
QueryResults * DoMetaSearch(const IRodsSearch *const search_p, struct IRodsConnection *connection_p, int *select_column_ids_p, const int num_select_columns, const bool upper_case_flag, char *zone_s)
Perform a meta-based search.
IRodsSearch::AddMetadataDataAttributeSearchTerm
bool AddMetadataDataAttributeSearchTerm(IRodsSearch *search_p, const char *clause_s, const char *key_s, const char *op_s, const char *value_s)
Create and add a SearchTerm to an IRodsSearch.
SearchTermNode::stn_node
ListItem stn_node
The Listnode.
Definition: meta_search.h:134
query.h
IRodsConnection
This is a wrapper which hides the internals of the code and objects needed to access an iRODS system.
Definition: irods_connection.h:42
IRODS_UTIL_API
#define IRODS_UTIL_API
Definition: irods_util_library.h:46
SearchTerm
A datatype for storing the values needed for an iRODS search.
Definition: meta_search.h:61
irods_util_library.h
SearchTermNode
A datatype for storing a SearchTerm on a LinkedList.
Definition: meta_search.h:131
typedefs.h
IRodsSearch
A set of SearchTerms to use when running a search.
Definition: meta_search.h:43
IRodsSearch::FreeIRodsSearch
void FreeIRodsSearch(IRodsSearch *search_p)
Free an IRodsSearch.
LinkedList
A doubly-linked list that can be traversed in either direction.
Definition: linked_list.h:56
IRodsSearch::DetermineSearchTerms
int32 DetermineSearchTerms(LinkedList *terms_p, const json_t *json_p)
Parse a JSON fragment and add SearchTermNodes to a LinkedList.
IRodsSearch::AddIRodsSearchTerm
bool AddIRodsSearchTerm(IRodsSearch *search_p, const char *clause_s, const char *key_s, const int key_id, const char *op_s, const char *value_s, const int value_id)
Add a search term to an IRodsSearch.
DoMetaSearchForAllDataAndCollections
QueryResults * DoMetaSearchForAllDataAndCollections(const IRodsSearch *const search_p, struct IRodsConnection *connection_p, const bool upper_case_flag, char *zone_s)
Perform a meta-based search for all matching Data Objects and Collections.
IRodsSearch::ClearIRodsSearch
void ClearIRodsSearch(IRodsSearch *search_p)
Clear an IRodsSearch.
QueryResults
A datatype for holding an array of the results of a search on an iRODS server.
Definition: query.h:62
IRodsSearch::AllocateIRodsSearch
IRodsSearch * AllocateIRodsSearch(void)
Allocate an IRodsSearch.
linked_list.h
A doubly-linked list.
SearchTermNode::stn_term
SearchTerm stn_term
The SearchTerm to store on the list.
Definition: meta_search.h:137
IRodsSearch::DoIRodsSearch
QueryResults * DoIRodsSearch(IRodsSearch *search_p, struct IRodsConnection *connection_p)
Perform an iRODS search.
IRodsSearch::is_search_terms_p
LinkedList * is_search_terms_p
A LinkedList of SearchTermNodes.
Definition: meta_search.h:49
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43