1 | /* -*- Mode: c; c-basic-offset: 2 -*- |
2 | * |
3 | * rdf_query.h - RDF Query Adaptor Factory and Query interfaces and definitions |
4 | * |
5 | * Copyright (C) 2002-2008, David Beckett http://www.dajobe.org/ |
6 | * Copyright (C) 2002-2005, University of Bristol, UK http://www.bristol.ac.uk/ |
7 | * |
8 | * This package is Free Software and part of Redland http://librdf.org/ |
9 | * |
10 | * It is licensed under the following three licenses as alternatives: |
11 | * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version |
12 | * 2. GNU General Public License (GPL) V2 or any newer version |
13 | * 3. Apache License, V2.0 or any newer version |
14 | * |
15 | * You may not use this file except in compliance with at least one of |
16 | * the above three licenses. |
17 | * |
18 | * See LICENSE.html or LICENSE.txt at the top of this package for the |
19 | * complete terms and further detail along with the license texts for |
20 | * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. |
21 | * |
22 | * |
23 | */ |
24 | |
25 | |
26 | #ifndef LIBRDF_QUERY_H |
27 | #define LIBRDF_QUERY_H |
28 | |
29 | #ifdef LIBRDF_INTERNAL |
30 | #include <rdf_query_internal.h> |
31 | #endif |
32 | |
33 | #ifdef __cplusplus |
34 | extern "C" { |
35 | #endif |
36 | |
37 | /* class methods */ |
38 | REDLAND_API |
39 | void librdf_query_register_factory(librdf_world *world, const char *name, const unsigned char *uri_string, void (*factory) (librdf_query_factory*)); |
40 | REDLAND_API REDLAND_DEPRECATED |
41 | int librdf_query_languages_enumerate(librdf_world* world, const unsigned int counter, const char **name, const unsigned char **uri_string); |
42 | REDLAND_API |
43 | const raptor_syntax_description* librdf_query_language_get_description(librdf_world* world, unsigned int counter); |
44 | |
45 | /* constructor */ |
46 | REDLAND_API |
47 | librdf_query* librdf_new_query(librdf_world* world, const char *name, librdf_uri* uri, const unsigned char *query_string, librdf_uri* base_uri); |
48 | REDLAND_API |
49 | librdf_query* librdf_new_query_from_query (librdf_query* old_query); |
50 | REDLAND_API |
51 | librdf_query* librdf_new_query_from_factory(librdf_world* world, librdf_query_factory* factory, const char *name, librdf_uri* uri, const unsigned char* query_string, librdf_uri* base_uri); |
52 | |
53 | /* destructor */ |
54 | REDLAND_API |
55 | void librdf_free_query(librdf_query *query); |
56 | |
57 | |
58 | /* methods */ |
59 | REDLAND_API |
60 | librdf_query_results* librdf_query_execute(librdf_query* query, librdf_model *model); |
61 | REDLAND_API |
62 | int librdf_query_get_limit(librdf_query *query); |
63 | REDLAND_API |
64 | int librdf_query_set_limit(librdf_query *query, int limit); |
65 | REDLAND_API |
66 | int librdf_query_get_offset(librdf_query *query); |
67 | REDLAND_API |
68 | int librdf_query_set_offset(librdf_query *query, int offset); |
69 | |
70 | REDLAND_API |
71 | librdf_stream* librdf_query_results_as_stream(librdf_query_results* query_results); |
72 | |
73 | REDLAND_API |
74 | int librdf_query_results_get_count(librdf_query_results* query_results); |
75 | REDLAND_API |
76 | int librdf_query_results_next(librdf_query_results* query_results); |
77 | REDLAND_API |
78 | int librdf_query_results_finished(librdf_query_results* query_results); |
79 | |
80 | REDLAND_API |
81 | int librdf_query_results_get_bindings(librdf_query_results* query_results, const char ***names, librdf_node **values); |
82 | REDLAND_API |
83 | librdf_node* librdf_query_results_get_binding_value(librdf_query_results* query_results, int offset); |
84 | REDLAND_API |
85 | const char* librdf_query_results_get_binding_name(librdf_query_results* query_results, int offset); |
86 | REDLAND_API |
87 | librdf_node* librdf_query_results_get_binding_value_by_name(librdf_query_results* query_results, const char *name); |
88 | REDLAND_API |
89 | int librdf_query_results_get_bindings_count(librdf_query_results* query_results); |
90 | REDLAND_API REDLAND_DEPRECATED |
91 | unsigned char* librdf_query_results_to_counted_string(librdf_query_results *query_results, librdf_uri *format_uri, librdf_uri *base_uri, size_t *length_p); |
92 | REDLAND_API |
93 | unsigned char* librdf_query_results_to_counted_string2(librdf_query_results *query_results, const char *name, const char *mime_type, librdf_uri *format_uri, librdf_uri *base_uri, size_t *length_p); |
94 | REDLAND_API REDLAND_DEPRECATED |
95 | unsigned char* librdf_query_results_to_string(librdf_query_results *query_results, librdf_uri *format_uri, librdf_uri *base_uri); |
96 | REDLAND_API |
97 | unsigned char* librdf_query_results_to_string2(librdf_query_results *query_results, const char *name, const char *mime_type, librdf_uri *format_uri, librdf_uri *base_uri); |
98 | REDLAND_API REDLAND_DEPRECATED |
99 | int librdf_query_results_to_file_handle(librdf_query_results *query_results, FILE *handle, librdf_uri *format_uri, librdf_uri *base_uri); |
100 | REDLAND_API |
101 | int librdf_query_results_to_file_handle2(librdf_query_results *query_results, FILE *handle, const char *name, const char *mime_type, librdf_uri *format_uri, librdf_uri *base_uri); |
102 | REDLAND_API REDLAND_DEPRECATED |
103 | int librdf_query_results_to_file(librdf_query_results *query_results, const char *name, librdf_uri *format_uri, librdf_uri *base_uri); |
104 | REDLAND_API |
105 | int librdf_query_results_to_file2(librdf_query_results *query_results, const char *name, const char *mime_type, librdf_uri *format_uri, librdf_uri *base_uri); |
106 | |
107 | REDLAND_API |
108 | void librdf_free_query_results(librdf_query_results* query_results); |
109 | |
110 | REDLAND_API |
111 | int librdf_query_results_is_bindings(librdf_query_results *query_results); |
112 | REDLAND_API |
113 | int librdf_query_results_is_boolean(librdf_query_results *query_results); |
114 | REDLAND_API |
115 | int librdf_query_results_is_graph(librdf_query_results *query_results); |
116 | REDLAND_API |
117 | int librdf_query_results_is_syntax(librdf_query_results* query_results); |
118 | |
119 | REDLAND_API |
120 | int librdf_query_results_get_boolean(librdf_query_results *query_results); |
121 | |
122 | /* query results formatter class */ |
123 | REDLAND_API |
124 | librdf_query_results_formatter* librdf_new_query_results_formatter2(librdf_query_results* query_results, const char *name, const char* mime_type, librdf_uri* uri); |
125 | REDLAND_API REDLAND_DEPRECATED |
126 | librdf_query_results_formatter* librdf_new_query_results_formatter(librdf_query_results* query_results, const char *name, librdf_uri* uri); |
127 | REDLAND_API REDLAND_DEPRECATED |
128 | librdf_query_results_formatter* librdf_new_query_results_formatter_by_mime_type(librdf_query_results* query_results, const char *mime_type); |
129 | REDLAND_API |
130 | void librdf_free_query_results_formatter(librdf_query_results_formatter* formatter); |
131 | REDLAND_API |
132 | int librdf_query_results_formatter_write(raptor_iostream *iostr, librdf_query_results_formatter* formatter, librdf_query_results* query_results, librdf_uri *base_uri); |
133 | |
134 | REDLAND_API |
135 | int librdf_query_results_formats_check(librdf_world* world, const char *name, librdf_uri* uri, const char *mime_type); |
136 | REDLAND_API REDLAND_DEPRECATED |
137 | int librdf_query_results_formats_enumerate(librdf_world* world, const unsigned int counter, const char **name, const char **label, const unsigned char **uri_string, const char **mime_type); |
138 | REDLAND_API |
139 | const raptor_syntax_description* librdf_query_results_formats_get_description(librdf_world* world, unsigned int counter); |
140 | |
141 | #ifdef __cplusplus |
142 | } |
143 | #endif |
144 | |
145 | #endif |
146 | |