1redland(3)             Redland RDF Application Framework            redland(3)
2
3
4

NAME

6       redland - Resource Description Framework (RDF) Library
7

VERSION

9       1.0.16
10

SYNOPSIS

12        #include <redland.h>
13

DESCRIPTION

15       redland is a library providing support for the Resource Description
16       Framework (RDF) written in ANSI C with APIs in several other languages.
17
18       This manual page lists most of the redland public API functions but
19       does not claim to be a complete summary of the entire API.  For the
20       complete API with full details of the function interface, see the HTML
21       API documentation either on the Redland web site at
22       <http://librdf.org/> or with the software release in the docs/api
23       directory.
24

FUNCTIONS

26       The functions defined by redland are all defined with the "librdf_"
27       prefix
28
29   class world
30       librdf_world* librdf_new_world(void)
31       void librdf_free_world(librdf_world* world)
32       void librdf_world_open(librdf_world* world)
33       void librdf_world_set_error(librdf_world* world, void* user_data, void
34       (*error_fn)(void* user_data, const char* msg, ...))
35       void librdf_world_set_warning(librdf_world* world, void* user_data,
36       void (*warning_fn)(void* user_data, const char* msg, ...))
37       void librdf_world_set_digest(librdf_world*, const char* name)
38       void librdf_world_set_uris_hash(librdf_world* world, librdf_hash*
39       uris_hash)
40       const char* librdf_world_get_feature(librdf_world* world, librdf_uri*
41       feature)
42       int librdf_world_set_feature(librdf_world* world, librdf_uri* feature,
43       const char* value)
44
45   class iterator
46       librdf_iterator* librdf_new_iterator(librdf_world* world, void*
47       context, int (*is_end)(void*), void* (*get_next)(void*), void
48       (*finished)(void*))
49       void librdf_free_iterator(librdf_iterator*)
50       int librdf_iterator_end(librdf_iterator* iterator)
51       int librdf_iterator_finished(librdf_iterator* iterator)
52       int librdf_iterator_next(librdf_iterator* iterator)
53       void* librdf_iterator_get_object(librdf_iterator* iterator)
54       void* librdf_iterator_get_context(librdf_iterator* iterator)
55       void* librdf_iterator_get_key(librdf_iterator* iterator)
56       void* librdf_iterator_get_value(librdf_iterator* iterator)
57       int librdf_iterator_add_map(librdf_iterator* iterator, void*
58       (*fn)(void* context, void* item), void* context)
59       void* librdf_iterator_map_remove_duplicate_nodes(void* item, void*
60       user_data)
61
62   class digest
63       void librdf_digest_register_factory(librdf_world* world, const char*
64       name, void (*factory) (librdf_digest_factory*))
65       librdf_digest_factory* librdf_get_digest_factory(librdf_world* world,
66       const char* name)
67       librdf_digest* librdf_new_digest(librdf_world* world, char* name)
68       librdf_digest* librdf_new_digest_from_factory(librdf_world* world,
69       librdf_digest_factory* factory)
70       void librdf_free_digest(librdf_digest* digest)
71       void librdf_digest_init(librdf_digest* digest)
72       void librdf_digest_update(librdf_digest* digest, unsigned char* buf,
73       size_t length)
74       void librdf_digest_final(librdf_digest* digest)
75       void* librdf_digest_get_digest(librdf_digest* digest)
76       char* librdf_digest_to_string(librdf_digest* digest)
77       void librdf_digest_print(librdf_digest* digest, FILE* fh)
78
79   class uri
80       librdf_uri* librdf_new_uri(librdf_world* world, const unsigned char *
81       string)
82       librdf_uri* librdf_new_uri_from_uri(librdf_uri* uri)
83       librdf_uri* librdf_new_uri_from_uri_local_name(librdf_uri* uri, const
84       unsigned char* local_name)
85       void librdf_free_uri(librdf_uri* uri)
86       unsigned char* librdf_uri_as_string(librdf_uri* uri)
87       unsigned char* librdf_uri_as_counted_string(librdf_uri* uri, size_t*
88       len_p)
89       librdf_digest* librdf_uri_get_digest(librdf_uri* uri)
90       void librdf_uri_print>(librdf_uri* uri, FILE* fh)
91       unsigned char* librdf_uri_to_string(librdf_uri* uri)
92       unsigned char* librdf_uri_to_counted_string(librdf_uri* uri, size_t*
93       len_p)
94       int librdf_uri_equals(librdf_uri* first_uri, librdf_uri* second_uri)
95       int librdf_uri_is_file_uri(librdf_uri* uri)
96       const char* librdf_uri_to_filename(librdf_uri* uri)
97       librdf_uri* librdf_new_uri_normalised_to_base(const unsigned char*
98       uri_string, librdf_uri* source_uri, librdf_uri* base_uri)
99       librdf_uri* librdf_new_uri_relative_to_base(librdf_uri* base_uri, const
100       unsigned char* uri_string)
101       librdf_uri* librdf_new_uri_from_filename(librdf_world* world, const
102       char* filename)
103
104   class node
105       librdf_node* librdf_new_node(librdf_world* world)
106       librdf_node* librdf_new_node_from_uri_string(librdf_world* world, const
107       char* string)
108       librdf_node* librdf_new_node_from_uri(librdf_world* world, librdf_uri*
109       uri)
110       librdf_node* librdf_new_node_from_uri_local_name(librdf_world* world,
111       librdf_uri* uri, const char* local_name)
112       librdf_node* librdf_new_node_from_normalised_uri_string(librdf_world*
113       world, const char* uri_string, librdf_uri* source_uri, librdf_uri*
114       base_uri)
115       librdf_node* librdf_new_node_from_literal(librdf_world* world, const
116       char* string, const char* xml_language, int xml_space, int is_wf_xml)
117       librdf_node* librdf_new_node_from_typed_literal(librdf_world* world,
118       const unsigned char* string, const char* xml_language, librdf_uri*
119       datatype_uri)
120       librdf_node* librdf_new_node_from_blank_identifier(librdf_world* world,
121       const unsigned char* identifier)
122       librdf_node* librdf_new_node_from_node(librdf_node* node)
123       void librdf_node_init(librdf_world* world, librdf_node* node)
124       void librdf_free_node(librdf_node* r)
125       librdf_uri* librdf_node_get_uri(librdf_node* node)
126       librdf_node_type librdf_node_get_type(librdf_node* node)
127       unsigned char* librdf_node_get_literal_value(librdf_node* node)
128       unsigned char*
129       librdf_node_get_literal_value_as_counted_string(librdf_node* node,
130       size_t* len_p)
131       char* librdf_node_get_literal_value_as_latin1(librdf_node* node)
132       char* librdf_node_get_literal_value_language(librdf_node* node)
133       int librdf_node_get_literal_value_is_wf_xml(librdf_node* node)
134       librdf_uri* librdf_node_get_literal_value_datatype_uri(librdf_node*
135       node)
136       int librdf_node_get_li_ordinal(librdf_node* node)
137       unsigned char* librdf_node_get_blank_identifier(librdf_node* node)
138       int librdf_node_is_resource(librdf_node* node)
139       int librdf_node_is_literal(librdf_node* node)
140       int librdf_node_is_blank(librdf_node* node)
141       librdf_digest* librdf_node_get_digest(librdf_node* node)
142       size_t librdf_node_encode(librdf_node* node, unsigned char* buffer,
143       size_t length)
144       size_t librdf_node_decode(librdf_node* node, unsigned char* buffer,
145       size_t length)
146       unsigned char* librdf_node_to_string(librdf_node* node)
147       unsigned char* librdf_node_to_counted_string(librdf_node* node, size_t*
148       len_p)
149       void librdf_node_print(librdf_node* node, FILE* fh)
150       int librdf_node_equals(librdf_node* first_node, librdf_node*
151       second_node)
152
153   class concepts
154       The library provides macros for all of the RDF and RDFS concepts -
155       nodes and URIs.  For example, "LIBRDF_MS_Alt" for the librdf_node for
156       the rdf:Alt concept and "LIBRDF_MS_Alt_URI" for the librdf_uri for the
157       URI reference of rdf:Alt.
158
159       "LIBRDF_URI_RDF_MS" and "LIBRDF_URI_RDF_SCHEMA" provide the librdf_uri
160       objects for the RDF and RDFS namespace URIs.  They must be copied using
161       librdf_new_uri_from_uri to be shared correctly.
162
163       void librdf_get_concept_by_name(librdf_world* world, int is_ms, const
164       char* name, librdf_uri **uri_p, librdf_node **node_p)
165
166   class statement
167       librdf_statement* librdf_new_statement(librdf_world* world)
168       librdf_statement* librdf_new_statement_from_statement(librdf_statement*
169       statement)
170       librdf_statement* librdf_new_statement_from_nodes(librdf_world* world,
171       librdf_node* subject, librdf_node* predicate, librdf_node* object)
172       void librdf_statement_init(librdf_world* world, librdf_statement*
173       statement)
174       void librdf_statement_clear(librdf_statement* statement)
175       void librdf_free_statement(librdf_statement* statement)
176       librdf_node* librdf_statement_get_subject(librdf_statement* statement)
177       void librdf_statement_set_subject(librdf_statement* statement,
178       librdf_node* subject)
179       librdf_node* librdf_statement_get_predicate(librdf_statement*
180       statement)
181       void librdf_statement_set_predicate(librdf_statement* statement,
182       librdf_node* predicate)
183       librdf_node* librdf_statement_get_object(librdf_statement* statement)
184       void librdf_statement_set_object(librdf_statement* statement,
185       librdf_node* object)
186       int librdf_statement_is_complete(librdf_statement* statement)
187       char* librdf_statement_to_string(librdf_statement* statement)
188       void librdf_statement_print(librdf_statement* statement, FILE* fh)
189       int librdf_statement_equals(librdf_statement* statement1,
190       librdf_statement* statement2)
191       int librdf_statement_match(librdf_statement* statement,
192       librdf_statement* partial_statement)
193       size_t librdf_statement_encode(librdf_statement* statement, unsigned
194       char* buffer, size_t length)
195       size_t librdf_statement_encode_parts(librdf_statement* statement,
196       unsigned char* buffer, size_t length, librdf_statement_part fields)
197       size_t librdf_statement_decode(librdf_statement* statement, unsigned
198       char* buffer, size_t length)
199       size_t librdf_statement_decode_parts(librdf_statement* statement,
200       librdf_node** context_node, unsigned char* buffer, size_t length)
201
202   class model
203       librdf_model* librdf_new_model(librdf_world* world, librdf_storage*
204       storage, char* options_string)
205       librdf_model* librdf_new_model_with_options(librdf_world* world,
206       librdf_storage* storage, librdf_hash* options)
207       librdf_model* librdf_new_model_from_model(librdf_model* model)
208       void librdf_free_model(librdf_model* model)
209       int librdf_model_size(librdf_model* model)
210       int librdf_model_add(librdf_model* model, librdf_node* subject,
211       librdf_node* predicate, librdf_node* object)
212       int librdf_model_add_string_literal_statement(librdf_model* model,
213       librdf_node* subject, librdf_node* predicate, char* string, char*
214       xml_language, int xml_space, int is_wf_xml)
215       int librdf_model_add_typed_literal_statement(librdf_model* model,
216       librdf_node* subject, librdf_node* predicate, const unsigned char*
217       string, char* xml_language, librdf_uri* datatype_uri)
218       int librdf_model_add_statement(librdf_model* model, librdf_statement*
219       statement)
220       int librdf_model_add_statements(librdf_model* model, librdf_stream*
221       statement_stream)
222       int librdf_model_remove_statement(librdf_model* model,
223       librdf_statement* statement)
224       int librdf_model_contains_statement(librdf_model* model,
225       librdf_statement* statement)
226       int librdf_model_has_arc_in(librdf_model* model, librdf_node* node,
227       librdf_node* property)
228       int librdf_model_has_arc_out(librdf_model* model, librdf_node* node,
229       librdf_node* property)
230       librdf_stream* librdf_model_as_stream(librdf_model* model)
231       librdf_stream* librdf_model_find_statements(librdf_model* model,
232       librdf_statement* statement)
233       librdf_stream* librdf_model_find_statements_in_context(librdf_model*
234       model, librdf_statement* statement, librdf_node* context_node)
235       librdf_stream* librdf_model_find_statements_with_options(librdf_model*
236       model, librdf_statement* statement, librdf_node* context_node,
237       librdf_hash* options)
238       librdf_iterator* librdf_model_get_contexts(librdf_model* model)
239       librdf_iterator* librdf_model_get_sources(librdf_model* model,
240       librdf_node* arc, librdf_node* target)
241       librdf_iterator* librdf_model_get_arcs(librdf_model* model,
242       librdf_node* source, librdf_node* target)
243       librdf_iterator* librdf_model_get_targets(librdf_model* model,
244       librdf_node* source, librdf_node* arc)
245       librdf_node* librdf_model_get_source(librdf_model* model, librdf_node*
246       arc, librdf_node* target)
247       librdf_node* librdf_model_get_arc(librdf_model* model, librdf_node*
248       source, librdf_node* target)
249       librdf_node* librdf_model_get_target(librdf_model* model, librdf_node*
250       source, librdf_node* arc)
251       librdf_iterator* librdf_model_get_arcs_in(librdf_model* model,
252       librdf_node* node)
253       librdf_iterator* librdf_model_get_arcs_out(librdf_model* model,
254       librdf_node* node)
255       int librdf_model_add_submodel(librdf_model* model, librdf_model*
256       sub_model)
257       int librdf_model_remove_submodel(librdf_model* model, librdf_model*
258       sub_model)
259       void librdf_model_print(librdf_model* model, FILE* fh)
260       int librdf_model_context_add_statement(librdf_model* model,
261       librdf_node* context, librdf_statement* statement)
262       int librdf_model_context_add_statements(librdf_model* model,
263       librdf_node* context, librdf_stream* stream)
264       int librdf_model_context_remove_statement(librdf_model* model,
265       librdf_node* context, librdf_statement* statement)
266       int librdf_model_context_remove_statements(librdf_model* model,
267       librdf_node* context)
268       librdf_stream* librdf_model_context_as_stream(librdf_model* model,
269       librdf_node* context)
270       librdf_stream* librdf_model_query(librdf_model* model, librdf_query*
271       query)
272       librdf_stream* librdf_model_query_string(librdf_model* model, const
273       char* name, librdf_uri* uri, const unsigned char* query_string)
274       void librdf_model_sync(librdf_model* model)
275       librdf_storage* librdf_model_get_storage(librdf_model* model)
276       librdf_node* librdf_model_get_feature(librdf_model* model, librdf_uri*
277       feature) =item int librdf_model_set_feature(librdf_model* model,
278       librdf_uri* feature, librdf_node* value)
279
280   class storage
281       void librdf_storage_register_factory(const char* name, void (*factory)
282       (librdf_storage_factory*))
283       librdf_storage* librdf_new_storage(librdf_world* world, char*
284       storage_name, char* name, char* options_string)
285       librdf_storage* librdf_new_storage_with_options(librdf_world* world,
286       char* storage_name, char* name, librdf_hash* options)
287       librdf_storage* librdf_new_storage_from_storage(librdf_storage*
288       old_storage)
289       librdf_storage* librdf_new_storage_from_factory(librdf_world* world,
290       librdf_storage_factory* factory, char* name, librdf_hash* options)
291       void librdf_free_storage(librdf_storage* storage)
292       int librdf_storage_open(librdf_storage* storage, librdf_model* model)
293       int librdf_storage_close(librdf_storage* storage)
294       int librdf_storage_get(librdf_storage* storage, void* key, size_t
295       key_len, void **value, size_t* value_len, unsigned int flags)
296       int librdf_storage_size(librdf_storage* storage)
297       int librdf_storage_add_statement(librdf_storage* storage,
298       librdf_statement* statement)
299       int librdf_storage_add_statements(librdf_storage* storage,
300       librdf_stream* statement_stream)
301       int librdf_storage_remove_statement(librdf_storage* storage,
302       librdf_statement* statement)
303       int librdf_storage_contains_statement(librdf_storage* storage,
304       librdf_statement* statement)
305       librdf_stream* librdf_storage_serialise(librdf_storage* storage)
306       librdf_stream* librdf_storage_find_statements(librdf_storage* storage,
307       librdf_statement* statement)
308       librdf_iterator* librdf_storage_get_sources(librdf_storage* storage,
309       librdf_node* arc, librdf_node* target)
310       librdf_iterator* librdf_storage_get_arcs(librdf_storage* storage,
311       librdf_node* source, librdf_node* target)
312       librdf_iterator* librdf_storage_get_targets(librdf_storage* storage,
313       librdf_node* source, librdf_node* arc)
314       librdf_iterator* librdf_storage_get_arcs_in(librdf_storage* storage,
315       librdf_node* node)
316       librdf_iterator* librdf_storage_get_arcs_out(librdf_storage* storage,
317       librdf_node* node)
318       int librdf_storage_has_arc_in(librdf_storage* storage, librdf_node*
319       node, librdf_node* property)
320       int librdf_storage_has_arc_out(librdf_storage* storage, librdf_node*
321       node, librdf_node* property)
322       int librdf_storage_context_add_statement(librdf_storage* storage,
323       librdf_node* context, librdf_statement* statement)
324       int librdf_storage_context_add_statements(librdf_storage* storage,
325       librdf_node* context, librdf_stream* stream)
326       int librdf_storage_context_remove_statement(librdf_storage* storage,
327       librdf_node* context, librdf_statement* statement)
328       int librdf_storage_context_remove_statements(librdf_storage* storage,
329       librdf_node* context)
330       librdf_stream* librdf_storage_context_as_stream(librdf_storage*
331       storage, librdf_node* context)
332       int librdf_storage_supports_query(librdf_storage* storage,
333       librdf_query* query)
334       librdf_stream* librdf_storage_query(librdf_storage* storage,
335       librdf_query* query)
336       void librdf_storage_sync(librdf_storage* storage)
337
338   class parser
339       void librdf_parser_register_factory(librdf_world* world, const char*
340       name, const char* mime_type, const char* uri_string, void (*factory)
341       (librdf_parser_factory*))
342       librdf_parser* librdf_new_parser(librdf_world* world, const char* name,
343       const char* mime_type, librdf_uri* type_uri)
344       librdf_parser* librdf_new_parser_from_factory(librdf_world* world,
345       librdf_parser_factory* factory)
346       void librdf_free_parser(librdf_parser* parser)
347       librdf_stream* librdf_parser_parse_as_stream(librdf_parser* parser,
348       librdf_uri* uri, librdf_uri* base_uri)
349       int librdf_parser_parse_into_model(librdf_parser* parser, librdf_uri*
350       uri, librdf_uri* base_uri, librdf_model* model)
351       librdf_stream* librdf_parser_parse_string_as_stream(librdf_parser*
352       parser, const unsigned char* string, librdf_uri* base_uri)
353       int librdf_parser_parse_string_into_model(librdf_parser* parser, const
354       unsigned char* string, librdf_uri* base_uri, librdf_model* model)
355       void librdf_parser_set_error(librdf_parser* parser, void* user_data,
356       void (*error_fn)(void* user_data, const char* msg, ...))
357       void librdf_parser_set_warning(librdf_parser* parser, void* user_data,
358       void (*warning_fn)(void* user_data, const char* msg, ...))
359       librdf_node* librdf_parser_get_feature(librdf_parser* parser,
360       librdf_uri* feature)
361       int librdf_parser_set_feature(librdf_parser* parser, librdf_uri*
362       feature, librdf_node* value)
363
364   class serializer
365       librdf_serializer* librdf_new_serializer(librdf_world* world, const
366       char *name, const char *mime_type, librdf_uri *type_uri)
367       librdf_serializer* librdf_new_serializer_from_factory(librdf_world*
368       world, librdf_serializer_factory *factory)
369       void librdf_free_serializer(librdf_serializer *serializer)
370       int librdf_serializer_serialize_model(librdf_serializer* serializer,
371       FILE* handle, librdf_uri* base_uri, librdf_model* model)
372       int librdf_serializer_serialize_model_to_file(librdf_serializer*
373       serializer, const char *name, librdf_uri* base_uri, librdf_model*
374       model)
375       void librdf_serializer_set_error(librdf_serializer* serializer, void
376       *user_data, void (*error_fn)(void *user_data, const char *msg, ...))
377       void librdf_serializer_set_warning(librdf_serializer* serializer, void
378       *user_data, void (*warning_fn)(void *user_data, const char *msg, ...))
379       librdf_node* librdf_serializer_get_feature(librdf_serializer*
380       serializer, librdf_uri* feature)
381       int librdf_serializer_set_feature(librdf_serializer* serializer,
382       librdf_uri* feature, librdf_node* value)b
383       int librdf_serializer_set_namespace(librdf_serializer* serializer,
384       librdf_uri* uri, const char* prefix)
385
386   class stream
387       librdf_stream* librdf_new_stream(librdf_world* world, void* context,
388       int (*end_of_stream)(void*), librdf_statement*
389       (*next_statement)(void*), void (*finished)(void*))
390       librdf_stream* librdf_new_stream_from_node_iterator(librdf_iterator*
391       iterator, librdf_statement* statement, librdf_statement_part field)
392       void librdf_free_stream(librdf_stream* stream)
393       int librdf_stream_end(librdf_stream* stream)
394       int librdf_stream_next(librdf_stream* stream)
395       librdf_statement* librdf_stream_get_object(librdf_stream* stream)
396       void* librdf_stream_get_context(librdf_stream* stream)
397       void librdf_stream_set_map(librdf_stream* stream, librdf_statement*
398       (*map)(void* context, librdf_statement* statement), void* map_context)
399       void librdf_stream_print(librdf_stream* stream, FILE* fh)
400

EXAMPLES

402         #include <redland.h>
403
404         librdf_storage *storage;
405         librdf_model* model;
406         librdf_statement* statement;
407         librdf_world* world
408
409         world=librdf_new_world();
410
411         librdf_world_open(world);
412
413         storage=librdf_new_storage(world, "hashes", "test", "hash-type='bdb',dir='.'");
414         model=librdf_new_model(world, storage, NULL);
415         statement=librdf_new_statement_from_nodes(world, librdf_new_node_from_uri_string(world, "http://purl.org/net/dajobe/"), librdf_new_node_from_uri_string(world, "http://purl.org/dc/elements/1.1/creator"), librdf_new_node_from_literal(world, "Dave Beckett", NULL, 0));
416
417         librdf_model_add_statement(model, statement);
418         librdf_free_statement(statement);
419
420         librdf_model_print(model, stdout);
421
422         librdf_free_model(model);
423         librdf_free_storage(storage);
424         librdf_free_world(world);
425

SEE ALSO

427       libraptor(3), libxml(4).
428

HISTORY

430       The redland RDF library was created by Dave Beckett in June 2000.
431

AUTHOR

433       Dave Beckett <http://purl.org/net/dajobe/>,
434
435
436
43728-Jun-2012                     redland 1.0.16                      redland(3)
Impressum