1libraptor(3) Library Functions Manual libraptor(3)
2
3
4
6 libraptor - Raptor RDF parser and serializer library
7
9 #include <raptor.h>
10
11 raptor_init();
12 raptor_parser *p=raptor_new_parser("rdfxml");
13 raptor_set_statement_handler(p,NULL,print_triples);
14 raptor_uri *file_uri=raptor_new_uri("http://example.org/");
15 raptor_parse_file(p,file_uri,base_uri);
16 raptor_parse_uri(p,uri,NULL);
17 raptor_free_parser(p);
18 raptor_free_uri(file_uri);
19 raptor_finish();
20
21 cc file.c -lraptor
22
24 The Raptor library provides a high-level interface to a set of parsers
25 and serializers that generate Resource Description Framework (RDF)
26 triples by parsing syntaxes or serialize the triples into syntaxes.
27
28 The supported parsing syntaxes are RDF/XML, N-Triples, Turtle, RSS tag
29 soup including Atom 0.3 and the serializing syntaxes are RDF/XML, N-
30 Triples and RSS 1.0. The RDF/XML parser can use either expat or libxml
31 XML parsers for providing the SAX event stream. The library functions
32 are arranged in an object-oriented style with constructors, destructors
33 and method calls. The statements and error messages are delivered via
34 callback functions.
35
36 Raptor contains a URI-reference parsing and resolving (not retrieval)
37 class (raptor_uri) sufficient for dealing with URI-references inside
38 RDF. This functionality is modular and can be transparently replaced
39 with another existing and compatible URI implementation.
40
41 It also provides a URI-retrieval class (raptor_www) for wrapping exist‐
42 ing library such as libcurl, libxml2 or BSD libfetch that provides full
43 or partial retrieval of data from URIs and an I/O stream abstraction
44 (raptor_iostream) for supportin serializing to a variety of outputs.
45
46 Raptor uses Unicode strings for RDF literals and URIs and preserves
47 them throughout the library. It uses the UTF-8 encoding of Unicode at
48 the API for passing in or returning Unicode strings. It is intended
49 that the preservation of Unicode for URIs will support International‐
50 ized Resource Identifiers (IRIs) which are still under development and
51 standardisation.
52
54 raptor_init()
55
56 raptor_finish()
57 Initialise and cleanup the library. These must be called before
58 any raptor class such as raptor_parser, raptor_uri is created or
59 used.
60
62 This class provides the functionality of turning syntaxes into RDF
63 triples - RDF parsing.
64
66 raptor_parser* raptor_new_parser(name)
67 Create a new raptor parser object for the parser with name name
68 currently either "rdfxml", "turtle" or "rss-tag-soup" for the
69 RSS Tag Soup parser.
70
71 raptor_parser* raptor_new_parser_for_content(raptor_uri *uri, const
72 char *mime_type, const unsigned char *buffer, size_t len, const
73 unsigned char *identifier)
74 Create a new raptor parser object for a syntax identified by URI
75 uri, MIME type mime_type, some initial content buffer of size
76 len or content with identifier identifier. See the rap‐
77 tor_guess_parser_name description for further details.
78
80 void raptor_free_parser(raptor_parser *parser)
81 Destroy a Raptor parser object.
82
84 Several methods can be registered for the parser that return a vari‐
85 able-argument message in the style of printf(3). These also return a
86 raptor_locator that can contain URI, file, line, column and byte counts
87 of where the message is about. This structure can be used with the rap‐
88 tor_format_locator, raptor_print_locator functions below or the struc‐
89 tures fields directly, which are defined in raptor.h
90
91 void raptor_set_fatal_error_handler(raptor_parser* parser, void
92 *user_data, raptor_message_handler handler)
93 Set the parser fatal error handler callback.
94
95 void raptor_set_error_handler(raptor_parser* parser, void *user_data,
96 raptor_message_handler handler)
97 Set the parser non-fatal error handler callback.
98
99 void raptor_set_warning_handler(raptor_parser* parser, void *user_data,
100 raptor_message_handler handler)
101 Set the parser warning message handler callback.
102
103 raptor_set_namespace_handler(raptor_parser* parser, void* user_data,
104 raptor_namespace_handler handler)
105 Set the namespace declaration handler callback.
106
108 The parser allows the registration of a callback function to return the
109 statements to the application.
110
111 void raptor_set_statement_handler(raptor_parser* parser, void
112 *user_data, raptor_statement_handler handler)
113 Set the statement callback function for the parser. The rap‐
114 tor_statement structure is defined in raptor.h and includes
115 fields for the subject, predicate, object of the statements
116 along with their types and for literals, language and datatype.
117
119 These methods perform the entire parsing in one method. Statements
120 warnings, errors and fatal errors are delivered via the registered
121 statement, error etc. handler functions.
122
123 In both of these methods, the base URI is required for the RDF/XML
124 parser (name "rdfxml") and Turtle parser (name "turtle"). The N-
125 Triples parser (name "ntriples") or RSS Tag Soup parser (name "rss-tag-
126 soup") do not use this.
127
128 int raptor_parse_file(raptor_parser* parser, raptor_uri *uri, rap‐
129 tor_uri *base_uri)
130 Parse the given filename (a URI like file:filename) according to
131 the optional base URI base_uri. If uri is NULL, read from stan‐
132 dard input and base_uri is then required.
133
134 int raptor_parse_file_stream(raptor_parser* parser, FILE* stream, const
135 char* filename, raptor_uri *base_uri)
136 Parse the given C FILE* stream according to the base URI
137 base_uri (required). filename is optional and if given, is used
138 for error messages via the raptor_locator structure.
139
140 int raptor_parse_uri(raptor_parser* parser, raptor_uri* uri, rap‐
141 tor_uri *base_uri)
142 Parse the URI according to the base URI base_uri, or NULL if not
143 needed. If no base URI is given, the uri is used. This method
144 depends on the raptor_www subsystem (see WWW Class section
145 below) and an existing underlying URI retrieval implementation
146 such as libcurl, libxml or BSD libfetch to retrieve the content.
147
149 These methods perform the parsing in parts by working on multiple
150 chunks of memory passed by the application. Statements warnings,
151 errors and fatal errors are delivered via the registered statement,
152 error etc. handler functions.
153
154 int raptor_start_parse(raptor_parser* parser, const char *uri)
155 Start a parse of chunked content with the base URI uri or NULL
156 if not needed. The base URI is required for the RDF/XML parser
157 (name "rdfxml") and Turtle parser (name "turtle"). The N-
158 Triples parser (name "ntriples") or RSS Tag Soup parser (name
159 "rss-tag-soup") do not use this.
160
161 int raptor_parse_chunk(raptor_parser* parser, const unsigned char
162 *buffer, size_t len, int is_end)
163 Parse the memory at buffer of size len returning statements via
164 the statement handler callback. If is_end is non-zero, it indi‐
165 cates the end of the parsing stream. This method can only be
166 called after raptor_start_parse.
167
169 const char* raptor_get_mime_type(raptor_parser* rdf_parser)
170 Return the MIME type for the parser.
171
172 void raptor_set_parser_strict(raptor_parser *parser, int is_strict)
173 Set the parser to strict (is_strict not zero) or lax (default)
174 mode. The detail of the strictness can be controlled by rap‐
175 tor_set_feature.
176
177 int raptor_set_feature(raptor_parser *parser, raptor_feature feature,
178 int value)
179 Set a parser feature feature to a particular value. Returns non
180 0 on failure or if the feature is unknown. The current defined
181 parser features are:
182 Feature Values
183 RAPTOR_FEATURE_SCANNING Boolean (non 0 true)
184 RAPTOR_FEATURE_ASSUME_IS_RDF Boolean (non 0 true)
185 RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES Boolean (non 0 true)
186 RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES Boolean (non 0 true)
187 RAPTOR_FEATURE_ALLOW_BAGID Boolean (non 0 true)
188 RAPTOR_FEATURE_ALLOW_RDF_TYPE_RDF_LIST Boolean (non 0 true)
189 RAPTOR_FEATURE_NORMALIZE_LANGUAGE Boolean (non 0 true)
190 RAPTOR_FEATURE_NON_NFC_FATAL Boolean (non 0 true)
191 RAPTOR_FEATURE_WARN_OTHER_PARSETYPES Boolean (non 0 true)
192 RAPTOR_FEATURE_CHECK_RDF_ID Boolean (non 0 true)
193 RAPTOR_FEATURE_RELATIVE_URIS Boolean (non 0 true)
194 RAPTOR_FEATURE_START_URI Boolean (non 0 true)
195 RAPTOR_FEATURE_NO_NET Boolean (non 0 true)
196 APTOR_FEATURE_HTML_TAG_SOUP Boolean (non 0 true)
197 APTOR_FEATURE_MICROFORMATS Boolean (non 0 true)
198 APTOR_FEATURE_HTML_LINK Boolean (non 0 true)
199 APTOR_FEATURE_WWW_TIMEOUT Integer
200 RAPTOR_FEATURE_RESOURCE_BORDER String
201 RAPTOR_FEATURE_LITERAL_BORDER String
202 RAPTOR_FEATURE_BNODE_BORDER String
203 RAPTOR_FEATURE_RESOURCE_FILL String
204 RAPTOR_FEATURE_LITERAL_FILL String
205 RAPTOR_FEATURE_BNODE_FILL String
206
207 If the scanning feature is true (default false), then the RDF/XML
208 parser will look for embedded rdf:RDF elements inside the XML content,
209 and not require that the XML start with an rdf:RDF root element.
210
211 If the assume_is_rdf feature is true (default false), then the RDF/XML
212 parser will assume the content is RDF/XML, not require that rdf:RDF
213 root element, and immediately interpret the content as RDF/XML.
214
215 If the allow_non_ns_attributes feature is true (default true), then the
216 RDF/XML parser will allow non-XML namespaced attributes to be accepted
217 as well as rdf: namespaced ones. For example, 'about' and 'ID' will be
218 interpreted as if they were rdf:about and rdf:ID respectively.
219
220 If the allow_other_parsetypes feature is true (default true) then the
221 RDF/XML parser will allow unknown parsetypes to be present and will
222 pass them on to the user. Unimplemented at present.
223
224 If the allow_bagid feature is true (default true) then the RDF/XML
225 parser will support the rdf:bagID attribute that was removed from the
226 RDF/XML language when it was revised. This support may be removed in
227 future.
228
229 If the allow_rdf_type_rdf_list feature is true (default false) then the
230 RDF/XML parser will generate the idList rdf:type rdf:List triple in the
231 handling of rdf:parseType="Collection". This triple was removed during
232 the revising of RDF/XML after collections were initially added.
233
234 If the normalize_language feature is true (default true) then XML lan‐
235 guage values such as from xml:lang will be normalized to lowercase.
236
237 If the non_nfc_fatal feature is true (default false) then illegal Uni‐
238 code Normal Form C in literals will give a fatal error, otherwise it
239 gives a warning.
240
241 If the check_rdf_id feature is true (default true) then rdf:ID values
242 will be checked for duplicates and cause an error if found.
243
244 If the no_net feature is true (default false) then network requests are
245 denied.
246
247 If the html_tag_soup feature is true (default true), use a lax HTML
248 parser if an XML parser fails when read HTML for GRDDL parser.
249
250 If the microformats feature is true (default true), look for microfor‐
251 mats for GRDDL parser.
252
253 if the html_link feature is true (default true), look for head
254 <link> to type rdf/xml for GRDDL parser
255
256 If the www_timeout feature is set to an integer larger than 0, it sets
257 the timeout in seconds for internal WWW URI requests for the GRDDL
258 parser.
259
260 raptor_parser_set_feature_string(raptor_parser *parser, raptor_feature
261 feature, const unsigned char *value)
262 Set a parser feature feature to a particular string value.
263 Returns non 0 on failure or if the feature is unknown. The cur‐
264 rent defined parser features are given in raptor_set_feature and
265 at present only take integer values. If an integer value feature
266 is set with this function, value is interpreted as an integer
267 and then that value is used.
268
269 int raptor_get_feature(raptor_parser* parser, raptor_feature feature)
270 Get parser feature integer values. The allowed feature values
271 and types are given under raptor_features_enumerate.
272
273 const unsigned char* raptor_parser_get_feature_string(raptor_parser
274 *parser, raptor_feature feature)
275 Get parser feature string values. The allowed feature values and
276 types are given under raptor_features_enumerate.
277
278 unsigned int raptor_get_feature_count(void)
279 Get the count of features defined. Prefered to the compile
280 time-only symbol RAPTOR_FEATURE_LAST which returns the maximum
281 value, not the count. Added raptor_get_need_base_uri
282
283 int raptor_feature_value_type(const raptor_feature feature)
284 Get a raptor feature value tyype - integer or string.
285
286 raptor_locator* raptor_get_locator(raptor_parser* rdf_parser)
287 Return the current raptor_locator object for the parser. This
288 is a public structure defined in raptor.h that can be used
289 directly, or formatted via raptor_print_locator.
290
291 void raptor_get_name(raptor_parser *parser)
292 Return the string short name for the parser.
293
294 void raptor_get_label(raptor_parser *parser)
295 Return a string label for the parser.
296
297 void raptor_set_default_generate_id_parameters(raptor_parser*
298 rdf_parser, char *prefix, int base)
299 Control the default method for generation of IDs for blank nodes
300 and bags. The method uses a short string prefix and an integer
301 base to generate the identifier which is not guaranteed to be a
302 strict concatenation. If prefix is NULL, the default is used.
303 If base is less than 1, it is initialised to 1.
304
305 void raptor_set_generate_id_handler(raptor_parser* parser, void
306 *user_data, raptor_generate_id_handler handler)
307 Allow full customisation of the generated IDs by setting a call‐
308 back handler and associated user_data that is called whenever a
309 blank node or bag identifier is required. The memory returned
310 is deallocated inside raptor. Some systems require this to be
311 allocated inside the same library, in which case the rap‐
312 tor_alloc_memory function may be useful.
313
314 void raptor_parser_set_uri_filter(raptor_parser* parser, rap‐
315 tor_uri_filter_func filter, void* user_data)
316 Set the URI filter function filter for URIs retrieved during
317 parsing by the the raptor_parser.
318
319 int raptor_get_need_base_uri(raptor_parser* rdf_parser)
320 Get a boolean whether this parser needs a base URI to start
321 parsing.
322
323 unsigned char* raptor_parser_generate_id(raptor_parser* rdf_parser,
324 raptor_genid_type type)
325 Generate an ID for a parser of type type, either RAP‐
326 TOR_GENID_TYPE_BNODEID or RAPTOR_GENID_TYPE_BAGID. This uses
327 any configuration set by raptor_set_generate_id_handler.
328
329 void raptor_set_graph_handler(raptor_parser* parser, void* user_data,
330 raptor_graph_handler handler)
331 Set the graph handler callback.
332
334 int raptor_parsers_enumerate(const unsigned int counter, const char
335 **name, const char **label)
336 Return the parser name/label for a parser with a given integer
337 counter, returning non-zero if no such parser at that offset
338 exists. The counter should start from 0 and be incremented by 1
339 until the function returns non-zero.
340
341 int raptor_syntaxes_enumerate(const unsigned int counter, const char
342 **name, const char **label, const char **mime_type, const unsigned char
343 **uri-string)
344 Return the name, label, mime type or URI string (all optional)
345 for a parser syntax with a given integer counter, returning non-
346 zero if no such syntax parser at that offset exists. The
347 counter should start from 0 and be incremented by 1 until the
348 function returns non-zero.
349
350 int raptor_features_enumerate(const raptor_feature feature, const char
351 **name, raptor_uri **uri, const char **label)
352 Return the name, URI, string label (all optional) for a parser
353 feature, returning non-zero if no such feature exists.
354
355 Raptor features have URIs that are constructed from the URI http://fea‐
356 ture.librdf.org/raptor- and the name so for example feature scanForRDF
357 has URI http://feature.librdf.org/raptor-scanForRDF
358
359 int raptor_syntax_name_check(const char *name)
360 Check name is a known syntax name.
361
362 const char* raptor_guess_parser_name(raptor_uri *uri, const char
363 *mime_type, const unsigned char *buffer, size_t len, const unsigned
364 char *identifier)
365 Guess a parser name for a syntax identified by URI uri, MIME
366 type mime_type, some initial content buffer of size len or with
367 content identifier identifier. All of these parameters are
368 optional and only used if not NULL. The parser is chosen by
369 scoring the hints that are given.
370
371 raptor_feature raptor_feature_from_uri(raptor_uri *uri)
372 Turn a URI uri into a raptor feature identifier, or <0 if the
373 feature is unknown. The URIs are described below rap‐
374 tor_set_feature.
375
377 void raptor_print_statement(const raptor_statement* const statement,
378 FILE *stream)
379 Print a raptor statement object in a simple format for debugging
380 only. The format of this output is not guaranteed to remain the
381 same between releases.
382
383 void raptor_print_statement_as_ntriples(const raptor_statement* state‐
384 ment, FILE *stream)
385 Print a raptor statement object in N-Triples format, using all
386 the escapes as defined in http://www.w3.org/TR/rdf-
387 testcases/#ntriples ⟨http://www.w3.org/TR/rdf-
388 testcases/#ntriples⟩
389
390 raptor_statement_part_as_counted_string(const void *term, raptor_iden‐
391 tifier_type type, raptor_uri* literal_datatype, const unsigned char
392 *literal_language, size_t* len_p)
393
394 char* raptor_statement_part_as_string(const void *term, raptor_identi‐
395 fier_type type, raptor_uri* literal_datatype, const unsigned char *lit‐
396 eral_language)
397 Turns part of raptor statement into N-Triples format, using all
398 the escapes as defined in http://www.w3.org/TR/rdf-
399 testcases/#ntriples ⟨http://www.w3.org/TR/rdf-
400 testcases/#ntriples⟩ The part (subject, predicate, object) of
401 the raptor_statement is passed in as term, the part type (sub‐
402 ject_type, predicate_type, object_type) is passed in as type.
403 When the part is a literal, the literal_datatype and lit‐
404 eral_language fields are set, otherwise NULL (usually
405 object_datatype, object_literal_language).
406
407 If raptor_statement_part_as_counted_string is used, the length
408 of the returned string is stored in *len_p if not NULL.
409
411 int raptor_format_locator(char *buffer, size_t length, raptor_locator*
412 locator)
413 This method takes a raptor_locator object as passed to an error,
414 warning or other handler callback and formats it into the buffer
415 of size length bytes. If buffer is NULL or length is insuffi‐
416 cient for the size of the formatted locator, returns the number
417 of additional bytes required in the buffer to write the locator.
418
419 In particular, if this form is used:
420 length=raptor_format_locator(NULL, 0, locator) it will return
421 in length the size of a buffer that can be allocated for locator
422 and a second call will perform the formatting:
423 raptor_format_locator(buffer, length, locator)
424
425
426 void raptor_print_locator(FILE *stream, raptor_locator* locator)
427 This method takes a raptor_locator object as passed to an error,
428 warning or other handler callback, formats and prints it to the
429 given stdio stream.
430
431 int raptor_locator_line(raptor_locator *locator)
432 Returns the line number in a locator structure or <0 if not
433 available.
434
435 int raptor_locator_column(raptor_locator *locator)
436 Returns the column number in a locator structure or <0 if not
437 available.
438
439 int raptor_locator_byte(raptor_locator *locator)
440 Returns the byte offset in a locator structure or <0 if not
441 available.
442
443 const char * raptor_locator_file(raptor_locator *locator)
444 Returns the filename in a locator structure or NULL if not
445 available. Note the returned pointer is to a shared string that
446 must be copied if needed.
447
448 const char * raptor_locator_uri(raptor_locator *locator)
449 Returns the URI string in a locator structure or NULL if not
450 available. Note this does not return a raptor_uri* pointer and
451 the returned pointer is to a shared string that must be copied
452 if needed.
453
455 void raptor_print_ntriples_string(FILE* stream, const char* string,
456 const char delim)
457 This is a standalone function that prints the given string
458 according to N-Triples escaping rules, expecting to be termi‐
459 nated by delimiter delim which is usually either ', " or <. If
460 a null delimiter \0 is given, no extra escaping is performed.
461
462 int raptor_iostream_write_string_ntriples(raptor_iostream *iostr, const
463 unsigned char *string, size_t len, const char delim)
464 Write an N-Triples encoded version of the given string to
465 iostream iostr. If delim is given, that is the ending delimeter
466 of the encoded string and it will be escaped in the output as
467 appropriate. Useful delim values are ', " and >. If a null
468 delimiter \0 is given, no extra escaping is performed.
469
470 void raptor_iostream_write_statement_ntriples(raptor_iostream* iostr,
471 const raptor_statement *statement)
472 Write an N-Triples encoded version of the raptor_statement
473 statement to iostream iostr.
474
475 void raptor_iostream_write_string_turtle(raptor_iostream* iostr, const
476 unsigned char* string, size_t len)
477 Write an UTF-8 string of length len using the Turtle
478 "longString" triple quoting format to the iostream iostr.
479
480 const char* raptor_ntriples_term_as_string (raptor_ntriples_term_type
481 term)
482 Deprecated, for internal use.
483
485 int raptor_xml_any_escape_string(const unsigned char* string, size_t
486 len, unsigned char* buffer, size_t length, char quote, int xml_version,
487 raptor_simple_message_handler error_handler, void* error_data)
488
489 int raptor_xml_escape_string(const unsigned char *string, size_t len,
490 unsigned char *buffer, size_t length, char quote, raptor_message_han‐
491 dler error_handler, void *error_data)
492 Apply the XML escaping rules to the string given in (string,
493 len) into the buffer of size length. If quote is given, the
494 escaped content is for an XML attribute and the appropriate
495 quote character XML element content (CDATA). The error_handler
496 method along with error_data allow error reporting to be given.
497 If buffer is NULL, returns the size of the buffer required to
498 escape. Otherwise the return value is the number of bytes used
499 or <0 on failure.
500
501 When an xml_version argument is present and has a value 10 (XML
502 1.0) or 11 (XML 1.1) then that version is used. The default
503 with no argument is to generate XML 1.0.
504
505 int raptor_iostream_write_xml_any_escaped_string(raptor_iostream*
506 iostr, const unsigned char* string, size_t len, char quote, int
507 xml_version, raptor_simple_message_handler error_handler, void*
508 error_data)
509
510 int raptor_iostream_write_xml_escaped_string(raptor_iostream* iostr,
511 const unsigned char *string, size_t len, char quote, raptor_simple_mes‐
512 sage_handler error_handler, void *error_data)
513 Write an XML-escaped version of the string given in (string,
514 len) to iostream iostr. If quote is given, the escaped content
515 is for an XML attribute and the appropriate quote character is
516 used, otherwise it is XML element content (CDATA). The
517 error_handler method along with error_data allow error reporting
518 to be given.
519
520 When an xml_version argument is present and has a value 10 (XML
521 1.0) or 11 (XML 1.1) then that version is used. The default
522 with no argument is to generate XML 1.0.
523
524 int raptor_xml_name_check(const unsigned char *string, size_t length,
525 int xml_version)
526 Check that the given string of length bytes is a legal XML name
527 according to XML 1.0 or XML 1.1. xml_version is set to 10 or 11
528 respectively. Returns non-zero if the name is legal.
529
531 void raptor_free_memory(void *ptr)
532 Free memory allocated inside raptor. Some systems require mem‐
533 ory allocated in a library to be deallocated inside that
534 library. This function can be used in that situation to free
535 memory allocated by raptor, such as the result of the _to_ meth‐
536 ods that return allocated memory such as raptor_uri_to_filename,
537 raptor_uri_to_string, raptor_uri_to_relative_counted_uri_string,
538 raptor_uri_to_relative_uri_string or raptor_new_names‐
539 pace_parts_from_string.
540
541 void* raptor_alloc_memory(size_t size)
542 Allocate memory inside the raptor library. Some systems require
543 memory allocated in a library to be deallocated inside that
544 library. This function can be used in that situation to allo‐
545 cate memory for raptor to free later, such as inside the handler
546 function declared with raptor_set_generate_id_handler which
547 returns new memory.
548
549 void* raptor_calloc_memory(size_t nmemb, size_t size)
550 Allocate zeroed array of items inside raptor. Some systems
551 require memory allocated in a library to be deallocated inside
552 that library. This function can be used in that situation to
553 clear an array of allocated memory for raptor to use, for free‐
554 ing later, such as inside the handler function declared with
555 raptor_set_generate_id_handler which returns new memory.
556
558 int raptor_unicode_char_to_utf8(raptor_unichar c, unsigned char *out‐
559 put)
560 Turn a Unicode character into UTF8 bytes in output of size c
561 bytes which must be of sufficient size. Returns the number of
562 bytes encoded or <0 on failure.
563
564 int raptor_utf8_to_unicode_char(raptor_unichar *output, const unsigned
565 char *input, int length)
566 Decode a sequence UTF8 bytes in input of size length into a Uni‐
567 code character in output returning the number of bytes used or
568 <0 on failure.
569
570 int raptor_utf8_check(const unsigned char *string, size_t length)
571 Check that a given string is legal UTF-8 encoding and includes
572 only legal Unicode characters U+0 to U+0x10ffff inclusive.
573 Returns non-0 if the string is good.
574
575 int raptor_unicode_is_xml11_namestartchar(raptor_unichar c)
576
577 int raptor_unicode_is_xml10_namestartchar(raptor_unichar c)
578
579 int raptor_unicode_is_xml11_namechar(raptor_unichar c)
580
581 int raptor_unicode_is_xml10_namechar(raptor-unichar c)
582 Check that given Unicode characters are allowed as XML 1.0 or
583 XML 1.0 names - either as the starting character (*_names‐
584 tartchar) or continuing character (*_namechar). Returns non-0
585 if the character is allowed.
586
588 char* raptor_vsnprintf(const char *message, va_list arguments)
589 Compatibility wrapper around vsnprintf.
590
592 There are several read-only static variables in the raptor library:
593
594 const char * const raptor_short_copyright_string
595 Short copyright string, suitable for one line.
596
597 const char * const raptor_copyright_string
598 Full copyright over several lines including URLs.
599
600 const char * const raptor_version_string
601 The version as a string
602
603 const unsigned int raptor_version_major
604 The major version number as an integer.
605
606 const unsigned int raptor_version_minor
607 The minor version number as an integer.
608
609 const unsigned int raptor_version_release
610 The release version number as an integer.
611
612 const unsigned int raptor_version_decimal
613 The version number as a single decimal.
614
615 const char * const raptor_license_string
616 The license string over several lines including URLs.
617
618 const char * const raptor_home_url_string
619 The home page URL as a string.
620
622 This class provides the functionality of turning RDF triples into syn‐
623 taxes - RDF serializing.
624
626 raptor_serializer* raptor_new_serializer(const char *name)
627 Create a new raptor serializer object for the serializer with
628 name name currently either "rdfxml" or "ntriples". or "rss-1.0"
629 for the RSS 1.0 serializer.
630
632 void raptor_free_serializer(raptor_serializer* rdf_serializer)
633 Destroy a Raptor serializer object.
634
636 int raptor_serialize_start(raptor_serializer* rdf_serializer, rap‐
637 tor_uri *uri, raptor_iostream *iostream)
638 Start to serialize content using the given iostream to write to
639 with optional base URI uri. Note that some syntaxes may refuse
640 to serialize without a base URI, such as RDF/XML.
641
642 int raptor_serialize_start_to_filename(raptor_serializer* rdf_serial‐
643 izer, const char *filename)
644 Start to serialize content to the file filename which is opened
645 for writing. The base URI is calculated from the file name.
646
647 int raptor_serialize_start_to_string(raptor_serializer* rdf_serializer,
648 raptor_uri *uri, void **string_p, size_t *length_p)
649 Start to serialize content to a string. string_p must point to
650 a void* pointer that will be used at the end of serializing to
651 store the newly allocated string. length_p if not NULL, it will
652 be used to store the length of the new string. The serializing
653 is done with optional base URI uri however some syntaxes may
654 refuse to serialize without a base URI, such as RDF/XML.
655
656 int raptor_serialize_start_to_file_handle(raptor_serializer* rdf_seri‐
657 alizer, raptor_uri *uri, FILE *handle)
658 Start to serialize content to the already open C Standard I/O
659 FILE* handle with the base URI uri, which is optional and may be
660 NULL. Note that some syntaxes may refuse to serialize without a
661 base URI, such as RDF/XML.
662
663 int raptor_serialize_statement(raptor_serializer* rdf_serializer, const
664 raptor_statement *statement)
665 Serialize a single statement using the serializer.
666
667 int raptor_serialize_end(raptor_serializer* rdf_serializer)
668 End the serializing. This may close and delete resources used
669 in serializing. No more calls to raptor_serialize_statement or
670 raptor_serialize_end may be done at this point.
671
672 raptor_iostream* raptor_serializer_get_iostream(raptor_serializer
673 *serializer)
674 Return a pointer to the raptor_iostream* used by the serializer.
675
676 int raptor_serializer_set_namespace(raptor_serializer* serializer, rap‐
677 tor_uri *uri, const char *prefix)
678 Set a suggested namespace URI/prefix mapping for use in serial‐
679 izing.
680
682 void raptor_serializer_set_error_handler(raptor_serializer* serializer,
683 void *user_data, raptor_message_handler handler)
684 Set the serializer non-fatal error handler callback.
685
686 void raptor_serializer_set_warning_handler(raptor_serializer* serial‐
687 izer, void *user_data, raptor_message_handler handler)
688 Set the serializer warning message handler callback.
689
690 raptor_locator* raptor_serializer_get_locator(raptor_serializer*
691 rdf_serializer)
692 Return the current raptor_locator object for the serializer.
693 This is a public structure defined in raptor.h that can be used
694 directly, or formatted via raptor_print_locator.
695
696 int raptor_serializer_set_feature(raptor_serializer *serializer, rap‐
697 tor_feature feature, int value)
698 Set a serializer feature feature to a particular value. Returns
699 non 0 on failure or if the feature is unknown. The current
700 defined serializer features are:
701 Feature Values
702 RAPTOR_FEATURE_RELATIVE_URIS Boolean (non 0 true)
703 RAPTOR_FEATURE_START_URI URI String
704
705 If the relative_uris feature is true (default false) then when serial‐
706 ising, preference is given to generating relative URIs where possible.
707
708 If the start_uri feature is set to a URI it is used by the serializer
709 to start serializing from.
710
711 int raptor_serializer_get_feature(raptor_serializer* serializer, rap‐
712 tor_feature feature)
713 Get serializer features, the allowed feature values are avail‐
714 able
715
717 int raptor_serializers_enumerate(const unsigned int counter, const char
718 **name, const char **label, const char **mime_type, const unsigned char
719 **uri_string)
720 Return the serializer name/label for a serializer with a given
721 integer counter, returning non-zero if no such parser at that
722 offset exists. The counter should start from 0 and be incre‐
723 mented by 1 until the function returns non-zero.
724
725 int raptor_serializer_syntax_name_check(const char *name)
726 Check name is a known serializer syntax name.
727
729 Raptor has a raptor_uri class must be used for manipulating and passing
730 URI references. The default internal implementation uses char* strings
731 for URIs, manipulating them and constructing them. This URI implemen‐
732 tation can be replaced by any other that provides the equivalent func‐
733 tionality, using the raptor_uri_set_handler function.
734
735
737 There a several constructors for raptor_uri to build them from char*
738 strings and existing raptor_uri objects.
739
740 raptor_uri* raptor_new_uri(const unsigned char* uri_string)
741 Create a raptor URI from a string URI-reference uri_string.
742
743 raptor_uri* raptor_new_uri_from_uri_local_name(raptor_uri* uri, const
744 unsigned char* local_name)
745 Create a raptor URI from a string URI-reference local_name rela‐
746 tive to an existing URI-reference. This performs concatenation
747 of the local_name to the uri and not relative URI resolution,
748 which is done by the raptor_new_uri_relative_to_base construc‐
749 tor.
750
751 raptor_uri* raptor_new_uri_relative_to_base(raptor_uri* base_uri, const
752 unsigned char* uri_string)
753 Create a raptor URI from a string URI-reference uri_string using
754 relative URI resolution to the base_uri.
755
756 raptor_uri* raptor_new_uri_from_id(raptor_uri* base_uri, const unsigned
757 char* id)
758 Create a raptor URI from a string RDF ID id concatenated to the
759 base_uri base URI.
760
761 raptor_uri* raptor_new_uri_for_rdf_concept(const char* name)
762 Create a raptor URI for the RDF namespace concept name.
763
764 raptor_uri* raptor_new_uri_for_xmlbase(raptor_uri* old_uri))
765 Create a raptor URI suitable for use with xml:base (throw away
766 fragment)
767
769 void raptor_free_uri(raptor_uri* uri)
770 Destroy a raptor URI object.
771
773 int raptor_uri_equals(raptor_uri* uri1, raptor_uri* uri2)
774 Return non-zero if the given URIs are equal.
775
776 raptor_uri* raptor_uri_copy(raptor_uri* uri)
777 Return a copy of the given raptor URI uri.
778
779 unsigned char* raptor_uri_as_counted_string(raptor_uri *uri, size_t*
780 len_p)
781
782 unsigned char* raptor_uri_as_string(raptor_uri* uri)
783 Return a shared pointer to a string representation of the given
784 raptor URI uri. This string is shared and must not be freed
785 (otherwise see the raptor_uri_to_* methods below). If rap‐
786 tor_uri_as_counted_string is used, the length of the returned
787 string is stored in *len_p if not NULL.
788
789 unsigned char* raptor_uri_to_counted_string(raptor_uri *uri, size_t
790 *len_p)
791
792 unsigned char* raptor_uri_to_string(raptor_uri *uri)
793 Return a to a newly alloced string representation of the given
794 raptor URI uri. This string must be freed by the caller using
795 raptor_free_memory. If raptor_uri_to_counted_string is used,
796 the length of the returned string is stored in *len_p if not
797 NULL.
798
799 unsigned char* raptor_uri_to_relative_counted_uri_string(raptor_uri
800 *base_uri, raptor_uri *reference_uri, size_t *length_p)
801
802 unsigned char* raptor_uri_to_relative_uri_string(raptor_uri *base_uri,
803 raptor_uri *reference_uri)
804 Return a new relative URI string of a URI reference_uri against
805 a base URI base_uri. The returned string must be freed with
806 raptor_free_memory. If raptor_uri_to_relative_counted_string is
807 used, the length of the returned string is stored in *len_p if
808 not NULL.
809
810 void raptor_uri_print(const raptor_uri* uri, FILE *stream)
811 Print URI uri to the file handle stream.
812
813 int raptor_iostream_write_uri(raptor_iostream* iostr, raptor_uri* uri)
814 Write the raptor_uri uri to the iostream ostr.
815
817 void raptor_uri_resolve_uri_reference (const unsigned char* base_uri,
818 const unsigned char* reference_uri, char unsigned* buffer, size_t
819 length)
820 This is a standalone function that resolves the relative URI
821 reference_uri against the base URI base_uri according to the URI
822 resolution rules in RFC2396. The resulting URI is stored in
823 buffer which is of length bytes. If this is too small, no work
824 will be done.
825
826 char *raptor_uri_filename_to_uri_string(const unsigned char* filename)
827 This is a standalone function that turns a local filename (Win‐
828 dows or Unix style as appropriate for platform) into a URI
829 string (file).
830 The returned string must be freed by the caller. Some systems
831 require memory allocated in a library to be deallocated inside
832 that library in which case raptor_free_memory may be used.
833
834 char *raptor_uri_uri_string_to_filename(const unsigned char*
835 uri_string)
836
837 char *raptor_uri_uri_string_to_filename(const unsigned char*
838 uri_string, unsigned char **fragment_p)
839 These are standalone functions that turn a URI string that rep‐
840 resents a local filename (file:) into a filename, with optional
841 URI fragment. If fragment_p is not NULL it points to the loca‐
842 tion to store a newly allocated string containing the fragment.
843 The returned strings must be freed by the caller. Some systems
844 require memory allocated in a library to be deallocated inside
845 that library in which case raptor_free_memory may be used.
846
847 int raptor_uri_is_file_uri(const unsigned char* uri_string)
848 DEPRECATED in 1.4.9. Returns non-zero if the given URI string
849 represents a filename. Use raptor_uri_uri_string_is_file_uri in
850 preference.
851
852 int raptor_uri_uri_string_is_file_uri(const unsigned char* uri_string)
853 Returns non-zero if the given URI string represents a filename.
854
856 void raptor_uri_set_handler(const raptor_uri_handler *handler, void
857 *context)
858 Change the URI class implementation to the functions provided by
859 the handler URI implementation. The context user data is passed
860 in to the handler URI implementation calls.
861
862 void raptor_uri_get_handler(raptor_uri_handler **handler, void **con‐
863 text)
864 Return the current raptor URI class implementation handler and
865 context
866
867
869 This is a small wrapper class around existing WWW libraries in order to
870 provide HTTP GET or better URI retrieval for Raptor. It is not
871 intended to be a general purpose WWW retrieval interface.
872
874 void raptor_www_init(void)
875
876 void raptor_www_finish(void)
877 Initialise or terminate the raptor_www infrastructure. rap‐
878 tor_www_init and raptor_finish are called by raptor_init and
879 raptor_finish respecitively, otherwise must be called once each.
880
881 NOTE Several of the WWW library implementations require once-only
882 initialisation and termination functions to be called, however
883 raptor cannot determine whether this is already done before the
884 library is initialised in raptor_www_init or terminated in rap‐
885 tor_www_finish, so always performs it. This can be changed by
886 raptor_www_no_www_library_init_finish.
887
888 void raptor_www_no_www_library_init_finish(void)
889 If this is called before raptor_www_init, it will not call the
890 underlying WWW library global initialise or terminate functions.
891 The application code must perform both operations.
892
893 For example with curl, after this function is called, neither
894 curl_global_init nor curl_global_cleanup will be called during
895 raptor_www_init or raptor_www_finish respectively.
896
898 raptor_www *raptor_www_new(void)
899
900 raptor_www *raptor_www_new_with_connection(void* connection)
901 Create a raptor WWW object capable of URI retrieval. If connec‐
902 tion is given, it must match the connection object of the under‐
903 lying WWW implementation. At present, this is only for libcurl,
904 and allows you to re-use an existing curl handle, or use one
905 which has been set up with some desired qualities.
906
908 void raptor_www_free(raptor_www *www)
909 Destroy a raptor WWW object.
910
912 void raptor_www_set_user_agent(raptor_www *www, const char *user_agent)
913 Set the user agent, for HTTP requests typically.
914
915 void raptor_www_set_proxy(raptor_www *www, const char *proxy)
916 Set the HTTP proxy - usually a string of the form
917 http://server:port
918
919 raptor_www_set_write_bytes_handler(raptor_www *www, rap‐
920 tor_www_write_bytes_handler handler, void *user_data)
921 Set the handler to receive bytes written by the raptor_www
922 implementation.
923
924 void raptor_www_set_content_type_handler(raptor_www *www, rap‐
925 tor_www_content_type_handler handler, void *user_data)
926 Set the handler to receive the HTTP Content-Type value, when/if
927 discovered during retrieval by the raptor_www implementation.
928
929 void raptor_www_set_http_accept(raptor_www *www, const char *value)
930 Set the WWW HTTP Accept: header to value. If value is NULL, an
931 empty header is sent.
932
933 void raptor_www_set_error_handler(raptor_www *www, raptor_message_han‐
934 dler error_handler, void *error_data)
935 Set the error handler routine for the raptor_www class. This
936 takes the same arguments as the raptor_parser error, warning
937 handler methods.
938
939 void raptor_www_set_uri_filter(raptor_www* www, raptor_uri_filter_func
940 filter, void* user_data)
941 Set the URI filter function filter for URIs retrieved by the
942 raptor_www object.
943
944 void* raptor_www_get_connection(raptor_www *www)
945 Return the underlying WWW library connection object. For exam‐
946 ple, for libcurl this is the curl_handle.
947
948 void raptor_www_set_connection_timeout(raptor_www* www, int timeout)
949 Set the WWW connection timeout in seconds.
950
951 raptor_uri* raptor_www_get_final_uri(raptor_www* www)
952 Get the final URI from a WWW retrieval, which may include redi‐
953 rections.
954
956 int raptor_www_fetch(raptor_www *www, raptor_uri *uri)
957 Retrieve the given URL, returning non zero on failure.
958
959 int raptor_www_fetch_to_string(raptor_www *www, raptor_uri *uri, void
960 **string_p, size_t *length_p, void *(*malloc_handler)(size_t size))
961 Retrieve the given URL to a string. string_p must point to a
962 void* pointer that will be used to store the newly allocated
963 string. length_p if not NULL, it will be used to store the
964 length of the new string.
965
966 void raptor_www_abort(raptor_www *www, const char *reason)
967 Abort an ongoing raptor WWW operation. Typically used within one
968 of the raptor WWW handlers.
969
971 This is a class for handling XML QNames consisting of the pair of (a
972 URI from a namespace, a local name) along with an optional value --
973 useful for XML attributes. This is used with the raptor_names‐
974 pace_stack and raptor_namespace classes to handle a stack of rap‐
975 tor_namespace that build on raptor_qname.
976
978 There are two constructors for raptor_qname to build qnames with
979 optional values on a stack of names.
980
981 raptor_qname* raptor_new_qname(raptor_namespace_stack *nstack, const
982 unsigned char *name, const unsigned char *value, raptor_simple_mes‐
983 sage_handler error_handler, void *error_data)
984 Create a raptor QName name (a possibly :-separated name) with
985 name to be resolved against the given nstack namespace stack.
986 An optional value can be given, and if there is an error, the
987 error_handler and error_data will be used to invoke the call‐
988 back.
989
990 raptor_qname* raptor_new_qname_from_namespace_local_name (raptor_names‐
991 pace *ns, const unsigned char *local_name, const unsigned char *value)
992 Create a raptor QName using the namespace name of the rap‐
993 tor_namespace ns and the local name local_name, along with
994 optional value value. Errors are reported using the error han‐
995 dling and data of the namespace.
996
997 raptor_qname* raptor_qname_copy(raptor_qname *qname)
998 Create a raptor QName from an existing one, returning NULL on
999 failure.
1000
1002 void raptor_free_qname(raptor_qname* name)
1003 Destroy a raptor qname object.
1004
1006 int raptor_qname_equal(raptor_qname* name1, raptor_qname *name2)
1007 Return non-zero if the given QNames are equal.
1008
1009 int raptor_iostream_write_qname(raptor_iostream* iostr, raptor_qname
1010 *qname)
1011 Write the raptor_qname qname to the iostream ostr.
1012
1014 raptor_uri* raptor_qname_string_to_uri(raptor_namespace_stack *nstack,
1015 const unsigned char *name, size_t name_len, raptor_simple_message_han‐
1016 dler error_handler, void *error_data)
1017 Return the URI corresponding to the QName according to the RDF
1018 method; concatenating the namespace's name (URI) with the local
1019 name. Takes the same arguments as raptor_new_qname but does not
1020 create a raptor_qname object.
1021
1022 raptor_namespace* raptor_qname_get_namespace(raptor_qname* name)
1023 Return the raptor_namespace used by the QName. Will never be
1024 NULL even for the default namespace in which case the URI of the
1025 returned namespace object will be NULL.
1026
1028 An XML namespace class - each entry is on a stack and consists of a
1029 name (URI) and prefix. The prefix or the name but not both may be
1030 empty. If the prefix is empty, it defines the default prefix. If the
1031 name is empty, it undefines the given prefix.
1032
1034 raptor_namespace* raptor_new_namespace(raptor_namespace_stack *nstack,
1035 const unsigned char *prefix, const unsigned char *ns_uri_string, int
1036 depth)
1037
1038 raptor_namespace* raptor_new_namespace_from_uri(raptor_namespace_stack
1039 *nstack, const unsigned char *prefix, raptor_uri* ns_uri, int depth)
1040 Create a new raptor_namespace object on the given namespace
1041 stack nstack with prefix prefix and namespace name either from
1042 URI string ns_uri_string or from copying URI ns_uri.
1043
1044 If prefix is NULL, it defines the URI for the default namespace prefix.
1045 If the namespace name (ns_uri_string or ns_uri) is NULL, it undefines
1046 the given prefix in the current scope. Both prefix and URI may be NULL
1047 to undefine the default namespace. depth signifies the position of the
1048 namespace on the stack; 0 is the bottom of the stack and generally the
1049 first depth for user namespace declarations.
1050
1051 Namespaces declared on the same depth (such as on the same XML element,
1052 typically) can be handily freed with raptor_namespaces_end_for_depth
1053 method on the namespace stack class.
1054
1056 void raptor_free_namespace(raptor_namespace *ns)
1057 Destroy a raptor namespace object.
1058
1060 raptor_uri* raptor_namespace_get_uri(const raptor_namespace *ns)
1061 Return the namespace name (URI) of the namespace.
1062
1063 const unsigned char* raptor_namespace_get_prefix(const raptor_namespace
1064 *ns)
1065 Return the prefix of the namespace.
1066
1067 const unsigned char* raptor_namespace_get_counted_prefix(const rap‐
1068 tor_namespace* ns, size_t* length_p)
1069 Return the prefix of the namespace as a string with optional
1070 count stored in the variable address length_p if it is not NULL.
1071
1072 unsigned char *raptor_namespaces_format(const raptor_namespace *ns,
1073 size_t *length_p)
1074 Format the namespace as a string and return it as a new string,
1075 returning the length of the resulting string in length_p if it
1076 is not NULL. The string format is suitable for emitting in XML
1077 to declare the namespace.
1078
1079 int raptor_iostream_write_namespace(raptor_iostream* iostr, rap‐
1080 tor_namespace *ns)
1081 Write a formatted namespace declaration like xmlns... to an
1082 iostream iostr.
1083
1085 int raptor_namespace_copy(raptor_namespace_stack *nstack, raptor_names‐
1086 pace *ns, int new_depth)
1087 Copy the namespace from the current stack to the new one, nstack
1088 at depth new_depth.
1089
1090 int raptor_new_namespace_parts_from_string(unsigned char *string,
1091 unsigned char **prefix, unsigned char **uri_string)
1092 Parse string with an XML-style namespace declaration like
1093 xmlns="", xmlns="uri", xmlns:prefix="" or xmlns:prefix="uri"
1094 into the strings pointed to by prefix string and a uri_string.
1095 Empty prefixes or namespace names return NULL pointers.
1096 Returned strings must be freed by the caller using rap‐
1097 tor_free_memory.
1098
1100 A stack of raptor_namespace objects where the namespaces on top of the
1101 stack have wider scope and override earlier (lower) namespace declara‐
1102 tions. Intended to match the XML namespace declaring semantics using
1103 xmlns attributes.
1104
1106 raptor_namespace_stack* raptor_new_namespaces(raptor_uri_handler
1107 *uri_handler, void *uri_context, raptor_simple_message_handler
1108 error_handler, void *error_data, int defaults)
1109
1110 int raptor_namespaces_init(raptor_namespace_stack *nstack, rap‐
1111 tor_uri_handler *handler, void *context, raptor_simple_message_handler
1112 error_handler, void *error_data, int defaults)
1113 Create or initialise a new raptor_namespace_stack object with
1114 the given URI and error handlers. raptor_namespaces_new allo‐
1115 cates new memory for the namespace stack and raptor_names‐
1116 paces_init initialises an existing declared nstack, which could
1117 be statically allocated. Note that raptor_uri_get_handler can
1118 be useful to return the current raptor URI handler/context. The
1119 defaults argument describes which default namespaces are
1120 declared in the empty stack. At present, 0 is none, 1 for just
1121 the XML namespace and 2 is for a typical set of namespaces used
1122 for RDF, RDFS, Dublin Core, OWL, ... that may vary over time.
1123
1124 In versions 1.4.16 or newer this returns an integer result,
1125 non-0 on failure.
1126
1128 void raptor_free_namespaces(raptor_namespace_stack *nstack)
1129 Destroy a namespace stack object, freeing the nstack (goes with
1130 raptor_new_namespaces).
1131
1132 void raptor_namespaces_clear(raptor_namespace_stack *nstack)
1133 Clear a statically allocated namespace stack; does not free the
1134 nstack. (goes with raptor_namespaces_init).
1135
1137 void raptor_namespaces_start_namespace(raptor_namespace_stack *nstack,
1138 raptor_namespace *nspace)
1139 Start the given nspace on the stack, at the depth already
1140 defined.
1141
1142 int raptor_namespaces_start_namespace_full(raptor_namespace_stack
1143 *nstack, const unsigned char *prefix, const unsigned char *nspace, int
1144 depth)
1145 Create a new raptor_namespace and start it on the stack. See
1146 raptor_new_namespace for the meaning of the argumens.
1147
1148 void raptor_namespaces_end_for_depth(raptor_namespace_stack *nstack,
1149 int depth)
1150 End (and free) all namespaces on the stack at the given depth.
1151
1152 raptor_namespace* raptor_namespaces_get_default_namespace (rap‐
1153 tor_namespace_stack *nstack)
1154 Return the current default raptor_namespace of the namespace
1155 stack or NULL if there is none.
1156
1157 raptor_namespace* raptor_namespaces_find_namespace_by_uri(raptor_names‐
1158 pace_stack *nstack, raptor_uri *ns_uri)
1159 Find the first namespace on the stack with the given uri ns_uri
1160 or NULL if there is none.
1161
1162 raptor_namespace *raptor_namespaces_find_namespace_by_uri(raptor_names‐
1163 pace_stack *nstack, const unsigned char *prefix, int prefix_length)
1164 Find the first namespace on the stack with the given namespace
1165 prefix or NULL if there is none.
1166
1167 int raptor_namespaces_namespace_in_scope(raptor_namespace_stack
1168 *nstack, const raptor_namespace *nspace)
1169 Return non-zero if the raptor_namespace nspace is declared on
1170 the stack; i.e. in scope if this is a stack of XML namespaces.
1171
1173 raptor_qname* raptor_namespaces_qname_from_uri(raptor_namespace_stack*
1174 nstack, raptor_uri* uri, int xml_version)
1175 Create a raptor QName from the URI uri if the URI is squal one
1176 of the namespace URIs on the namespace stack nstack URIs con‐
1177 catenated to a legal XML name for the given XML version. URIs
1178 are created and errors are reported using the namespace stack
1179 fields. Fails if it cannot be legally described with any of the
1180 namespaces.
1181
1183 A class for ordered sequences of items, adding at either end of the
1184 sequence. The method names should be familiar to Perl users.
1185
1187 raptor_sequence* raptor_new_sequence(raptor_sequence_free_handler*
1188 free_handler, raptor_sequence_print_handler* print_handler)
1189 Create a new empty sequence, with optional handler for freeing
1190 elements (as used by raptor_free_sequence and printing out ele‐
1191 ments (used by raptor_sequence_print).
1192
1194 void raptor_free_sequence(raptor_sequence* seq)
1195 Destoy a sequence object, freeing any items if the free handler
1196 was defined in the constructor.
1197
1199 int raptor_sequence_size(raptor_sequence* seq)
1200 Return the number of items in the sequence.
1201
1202 int raptor_sequence_set_at(raptor_sequence* seq, int idx, void *data)
1203 Set the sequence item at index idx to the value data, extending
1204 it if necessary.
1205
1206 int raptor_sequence_push(raptor_sequence* seq, void *data)
1207 Add item data to the end of the sequence.
1208
1209 int raptor_sequence_shift(raptor_sequence* seq, void *data)
1210 Add item data to the start of the sequence.
1211
1212 void* raptor_sequence_get_at(raptor_sequence* seq, int idx)
1213 Get the sequence item at index idx or NULL if no such index
1214 exists.
1215
1216 void* raptor_sequence_pop(raptor_sequence* seq)
1217 Remove and return an item from the end of the sequence, or NULL
1218 if is empty.
1219
1220 void* raptor_sequence_unshift(raptor_sequence* seq)
1221 Remove and return an item from the start of the sequence, or
1222 NULL if is empty.
1223
1224 void raptor_sequence_sort(raptor_sequence* seq, int(*compare)(const
1225 void *, const void *))
1226 Sort the sequence using the given comparison function compare
1227 which is passed to qsort(3) internally.
1228
1229 int raptor_compare_strings(const void *a, const void *b)
1230 Helper function useful with raptor_sequence_sort.
1231
1232 void raptor_sequence_set_print_handler(raptor_sequence *seq, rap‐
1233 tor_sequence_print_handler *print_handler)
1234 Set the print handler for the sequence, an alternative to set‐
1235 ting it in the constructor.
1236
1237 void raptor_sequence_print_string(char *data, FILE *fh)
1238 Helper print handler function useful for printing out sequences
1239 of strings.
1240
1241 void raptor_sequence_print_uri(char *data, FILE *fh)
1242 Helper print handler function useful for printing out sequences
1243 of raptor_uri* objects.
1244
1245 void raptor_sequence_print(raptor_sequence* seq, FILE* fh)
1246 Print out the sequence in a debug format to the given file han‐
1247 dler fh. NOTE: The exact format is not guaranteed to remain the
1248 same between releases.
1249
1250 int raptor_sequence_join(raptor_sequence* dest, raptor_sequence *src)
1251 Join two sequences moving all items from sequence src to the end
1252 of sequence dest. After this operation, sequence src will be
1253 empty (zero size) but will have the same item capacity as
1254 before.
1255
1257 A class for growing strings, small chunks at a time.
1258
1260 raptor_stringbuffer* raptor_new_stringbuffer(void)
1261 Create a new stringbuffer.
1262
1264 void raptor_free_stringbuffer(raptor_stringbuffer* stringbuffer)
1265 Destroy a stringbuffer.
1266
1268 int raptor_stringbuffer_append_counted_string(raptor_stringbuffer*
1269 stringbuffer, const unsigned char *string, size_t length, int do_copy)
1270 Append a string of length bytes to a stringbuffer, copying it
1271 only if do_copy is non-0.
1272
1273 int raptor_stringbuffer_append_string(raptor_stringbuffer* string‐
1274 buffer, const unsigned char* string, int do_copy)
1275 Append a string to a stringbuffer, copying it only if do_copy is
1276 non-0.
1277
1278 int raptor_stringbuffer_append_decimal(raptor_stringbuffer* string‐
1279 buffer, int integer)
1280 Append a formatted decimal integer to a stringbuffer.
1281
1282 int raptor_stringbuffer_append_stringbuffer(raptor_stringbuffer*
1283 stringbuffer, raptor_stringbuffer* append)
1284 Append a stringbuffer append to a stringbuffer. The append
1285 stringbuffer is emptied but not destroyed.
1286
1287 int raptor_stringbuffer_prepend_counted_string(raptor_stringbuffer*
1288 stringbuffer, const unsigned char* string, size_t length, int do_copy)
1289 Prepend a string of length bytes to the start of a stringbuffer,
1290 copying it only if do_copy is non-0.
1291
1292 int raptor_stringbuffer_prepend_string(raptor_stringbuffer* string‐
1293 buffer, const unsigned char* string, int do_copy)
1294 Prepend a string to the start of a stringbuffer, copying it only
1295 if do_copy is non-0.
1296
1297 unsigned char * raptor_stringbuffer_as_string(raptor_stringbuffer*
1298 stringbuffer)
1299 Return the stringbuffer as a single string. The string is
1300 shared and should be copied if needed.
1301
1302 size_t raptor_stringbuffer_length(raptor_stringbuffer* stringbuffer)
1303 Return the length of the stringbuffer.
1304
1305 int raptor_stringbuffer_copy_to_string(raptor_stringbuffer* string‐
1306 buffer, unsigned char *string, size_t length)
1307 Copy the stringbuffer into a single string buffer string of size
1308 length. Returns non-0 on failure.
1309
1311 This class provides an I/O stream that can write to filenames, FILE*,
1312 strings and user-defined output via callbacks.
1313
1315 raptor_iostream* raptor_new_iostream_from_handler(void* context, const
1316 raptor_iostream_handler *handler)
1317 Create a new raptor iostream from a user-defined rap‐
1318 tor_iostream_handler handler that is called with the passed-in
1319 context for the write operations.
1320
1321 raptor_iostream* raptor_new_iostream_to_sink(void)
1322 Create a new raptor iostream that discards all written output.
1323
1324 raptor_iostream* raptor_new_iostream_to_filename(const char *filename)
1325 Create a new raptor iostream that creates and writes to a new
1326 file filename.
1327
1328 raptor_iostream* raptor_new_iostream_to_file_handle(FILE *handle)
1329 Create a new raptor iostream that creates and writes to an
1330 existing, already opened, C Standard I/O handle FILE* handle.
1331
1332 raptor_iostream* raptor_new_iostream_to_string(void **string_p, size_t
1333 *length_p, void *(*malloc_handler)(size_t size))
1334 Create a new raptor iostream which creates a new string once
1335 raptor_free_iostream is called. The new string pointer is writ‐
1336 ten in string, the length in length_p (if not NULL) and the mem‐
1337 ory allocation is made using the malloc_handler, or if NULL,
1338 raptor's default memory allocator.
1339
1341 void raptor_free_iostream(raptor_iostream *iostr)
1342 Destroy a Raptor iostream object.
1343
1345 int raptor_iostream_write_bytes(raptor_iostream *iostr, const void
1346 *ptr, size_t size, size_t nmemb)
1347 Write a counted set of elements to an iostream. Inmemb is the
1348 count of elements of size size, starting at memory ptr. Similar
1349 to fwrite(3) and write(2).
1350
1351 int raptor_iostream_write_byte(raptor_iostream *iostr, const int byte)
1352 Write a single byte an iostream. Similar to fputc(3).
1353
1354 void raptor_iostream_write_end(raptor_iostream *iostr)
1355 Finish writing to an iostream.
1356
1357 int raptor_iostream_write_string(raptor_iostream *iostr, const void
1358 *string)
1359 Write a NUL-terminated string to an iostream. Similar to
1360 fputs(3).
1361
1362 int raptor_iostream_write_counted_string(raptor_iostream *iostr, const
1363 void *string, size_t len)
1364 Write a string of length len to an iostream.
1365
1366 size_t raptor_iostream_get_bytes_written_count(raptor_iostream *iostr)
1367 Return the number of bytes written so far to the iostream.
1368
1369 int raptor_iostream_write_decimal(raptor_iostream *iostr, int integer)
1370 Write a decimal formatted integer integer to the iostream.
1371
1372 int raptor_iostream_format_hexadecimal(raptor_iostream *iostr, unsigned
1373 int integer, int width)
1374 Write a hexadecimal formatted unsigned integer to the iostream,
1375 left-padded with '0's to width columns.
1376
1377 int raptor_iostream_write_stringbuffer(raptor_iostream* iostr, rap‐
1378 tor_stringbuffer *sb)
1379 Write the stringbuffer to an iostream iostr.
1380
1382 This class provides an XML element that can be used with the XML Writer
1383 Class to generate XML documents.
1384
1386 raptor_xml_element* raptor_new_xml_element(raptor_qname* name, const
1387 unsigned char* xml_language, raptor_uri* xml_base)
1388 Create a new XML element with the element name name in the con‐
1389 text of xml:lang xml_language and base URI xml_base.
1390
1391 raptor_xml_element* raptor_new_xml_element_from_names‐
1392 pace_local_name(raptor_namespace *ns, const unsigned char *name, const
1393 unsigned char* xml_language, raptor_uri* xml_base
1394 Create a new XML element based on the given XML namespace and
1395 localname in the context of xml:lang xml_language and base URI
1396 xml_base.
1397
1399 void raptor_free_xml_element(raptor_xml_element *element)
1400 Destroy a XML element object.
1401
1403 raptor_qname* raptor_xml_element_get_name(raptor_xml_element* xml_ele‐
1404 ment)
1405 Get the XML element QName of XML element xml_element.
1406
1407 void raptor_xml_element_set_attributes(raptor_xml_element* xml_element,
1408 raptor_qname **attributes, int count)
1409 Set the attributes on XML element xml_element to the array of
1410 QNames in array attributes of size count.
1411
1412 raptor_qname** raptor_xml_element_get_attributes(raptor_xml_element*
1413 xml_element)
1414 Get the attributes of an XML element xml_element as an array of
1415 QNames. As set by void raptor_xml_element_set_attributes.
1416
1417 int raptor_xml_element_get_attributes_count(raptor_xml_element*
1418 xml_element)
1419 Get the number of attributes of an XML element xml_element as
1420 set by void raptor_xml_element_set_attributes.
1421
1422 int raptor_xml_element_declare_namespace(raptor_xml_element* xml_ele‐
1423 ment, raptor_namespace* nspace)
1424 Declare an XML namespace nspace expliclitly on XML element
1425 xml_element. Namespaces used in the element or attribute names
1426 are automatically declared, this method allows additional ones
1427 to be done.
1428
1429 int raptor_xml_element_is_empty(raptor_xml_element* xml_element)
1430 Return non-0 if the XML element is empty.
1431
1432 int raptor_iostream_write_xml_element(raptor_iostream* iostr, rap‐
1433 tor_xml_element *element, raptor_namespace_stack* nstack, int is_empty,
1434 int is_end, raptor_simple_message_handler error_handler, void*
1435 error_data, int depth)
1436 Write a XML element xml_element to iostream ostr. This is done
1437 in context of an XML namespace stack nstack and at depth depth
1438 in the stack (see Namespace class constructors).
1439
1440 The element may be an empty element if is_empty is non-zero or
1441 may be a close element if is_end is non-zero (else is a start
1442 element). The error_handler method along with error_data allow
1443 error reporting to be given.
1444
1446 This class provides the functionality to generate simple XML documents
1447 consisting of elements with attributes, character data and comments.
1448 The documents can be written to an iostream.
1449
1451 raptor_xml_writer* raptor_new_xml_writer(raptor_namespace_stack*
1452 nstack, raptor_uri_handler* uri_handler, void* uri_context, rap‐
1453 tor_iostream* iostr, raptor_simple_message_handler error_handler, void
1454 *error_data, int canonicalize)
1455 Create a new XML Writer writing to iostream iostr. The
1456 error_handler method along with error_data allow error reporting
1457 to be given. nstack is either an existing namespace stack to be
1458 used or if NULL, a new one with only the XML namespace defined
1459 is created. Note that raptor_uri_get_handler can be useful to
1460 return the current raptor URI handler/context. canonicalize is
1461 currently unused and should be set to 1 but may allow non-canon‐
1462 ical XML writing to be allowed in future.
1463
1465 void raptor_free_xml_writer(raptor_xml_writer* xml_writer)
1466 Destroy a XML Writer object.
1467
1469 void raptor_xml_writer_empty_element(raptor_xml_writer* xml_writer,
1470 raptor_xml_element *element)
1471 Write XML element element as an empty element (no element con‐
1472 tent) to the XML Writer xml_writer.
1473
1474 void raptor_xml_writer_start_element(raptor_xml_writer* xml_writer,
1475 raptor_xml_element *element)
1476 Write a start element along with an attributes and namespace
1477 declarations for XML element element to the XML Writer
1478 xml_writer.
1479
1480 void raptor_xml_writer_end_element(raptor_xml_writer* xml_writer, rap‐
1481 tor_xml_element *element)
1482 Write an end element form for XML element element to the XML
1483 Writer xml_writer.
1484
1485 void raptor_xml_writer_cdata(raptor_xml_writer* xml_writer, const
1486 unsigned char *str)
1487 Write XML character data in str to the XML Writer xml_writer.
1488 The characters in str will be XML escaped.
1489
1490 void raptor_xml_writer_cdata_counted(raptor_xml_writer* xml_writer,
1491 const unsigned char* str, unsigned int length)
1492 Write XML character data in str of length length to the XML
1493 Writer xml_writer. The characters in str will be XML escaped.
1494
1495 void raptor_xml_writer_raw(raptor_xml_writer* xml_writer, const
1496 unsigned char* str)
1497 Write character data in str length to the XML Writer xml_writer
1498 without XML escaping.
1499
1500 void raptor_xml_writer_raw_counted(raptor_xml_writer* xml_writer, const
1501 unsigned char* str, unsigned int length)
1502 Write character data in str of length length to the XML Writer
1503 xml_writer without XML escaping.
1504
1505 void raptor_xml_writer_comment(raptor_xml_writer* xml_writer, const
1506 unsigned char* str)
1507 Write an XML comment in str to the XML Writer xml_writer.
1508
1509 void raptor_xml_writer_comment_counted(raptor_xml_writer* xml_writer,
1510 const unsigned char* str, unsigned int length)
1511 Write an XML comment in str of length length to the XML Writer
1512 xml_writer.
1513
1514 int raptor_xml_writer_features_enumerate(const raptor_feature feature,
1515 const char **name, raptor_uri **uri, const char **label)
1516 Return the name, URI, string label (all optional) for an XML
1517 write feature, returning non-zero if no such feature exists.
1518
1519 Raptor features have URIs that are constructed from the URI http://fea‐
1520 ture.librdf.org/raptor- and the name so for example feature scanForRDF
1521 has URI http://feature.librdf.org/raptor-scanForRDF
1522
1523 int raptor_xml_writer_set_feature(raptor_xml_writer* xml_writer, rap‐
1524 tor_feature feature, int value)
1525 Set an XML writer feature feature to a particular value.
1526 Returns non 0 on failure or if the feature is unknown. The cur‐
1527 rent defined writer features are:
1528 Feature Values
1529 RAPTOR_FEATURE_WRITER_AUTO_INDENT Boolean (non 0 true)
1530 RAPTOR_FEATURE_WRITER_AUTO_EMPTY Boolean (non 0 true)
1531 RAPTOR_FEATURE_WRITER_INDENT_WIDTH Integer
1532 RAPTOR_FEATURE_WRITER_XML_DECLARATION Boolean (non 0 true)
1533
1534 If the writer_auto_indent feature is set (default true), the XML writer
1535 will automatically indent the output.
1536
1537 If the writer_auto_empty feature is set (default true), the XML writer
1538 will automatically generate empty elements if a start/end element
1539 sequence has no content.
1540
1541 If the writer_indent_width feature is set (default 2) if the XML writer
1542 is outputing indented XML, it will use that many spaces.
1543
1544 If the writer_xml_declaration feature is set (default true) the XML
1545 declaration is written at the start of serialized XML.
1546
1547 int raptor_xml_writer_set_feature_string(raptor_xml_writer *xml_writer,
1548 raptor_feature feature, const unsigned char *value)
1549 Set an XML writer feature feature to a particular string value.
1550 Returns non 0 on failure or if the feature is unknown. The cur‐
1551 rent defined XML writer features are given in rap‐
1552 tor_xml_writer_set_feature and at present only take integer val‐
1553 ues. If an integer value feature is set with this function,
1554 value is interpreted as an integer and then that value is used.
1555
1556 int raptor_xml_writer_get_feature(raptor_xml_writer* xml_writer, rap‐
1557 tor_feature feature)
1558 Get XML writer feature integer values. The allowed feature val‐
1559 ues and types are given under raptor_xml_writer_features_enumer‐
1560 ate.
1561
1562 const unsigned char *raptor_xml_writer_get_feature_string(rap‐
1563 tor_xml_writer* xml_writer, raptor_feature feature)
1564 Get XML writer feature string values. The allowed feature values
1565 and types are given under raptor_xml_writer_features_enumerate.
1566
1568 1.4.16
1569 raptor_namespaces_init now returns an integer status
1570
1571 Added raptor_new_xml_element_from_namespace_local_name
1572
1573 Added raptor_uri_compare.
1574
1575 Added new features for the 'grddl' parser: RAPTOR_FEA‐
1576 TURE_HTML_TAG_SOUP, RAPTOR_FEATURE_MICROFORMATS and RAPTOR_FEA‐
1577 TURE_HTML_LINK.
1578
1579 Added parser feature RAPTOR_FEATURE_WWW_TIMEOUT
1580
1581 Added raptor_graph_handler typedef and raptor_set_graph_handler
1582
1583 Added raptor_www_final_uri_handler typedef and rap‐
1584 tor_www_set_final_uri_handler
1585
1586 Added raptor_www_set_connection_timeout
1587
1588 Added raptor_www_get_final_uri
1589
1590 1.4.15
1591 No changes.
1592
1593 1.4.14
1594 Add two new exported strings raptor_license_string and rap‐
1595 tor_home_url_string.
1596
1597 Added new features for the 'dot' serializer: RAPTOR_FEA‐
1598 TURE_RESOURCE_BORDER, RAPTOR_FEATURE_LITERAL_BORDER, RAPTOR_FEA‐
1599 TURE_BNODE_BORDER, RAPTOR_FEATURE_RESOURCE_FILL, RAPTOR_FEATURE_LIT‐
1600 ERAL_FILL and RAPTOR_FEATURE_BNODE_FILL
1601
1602 Added raptor_parser_generate_id
1603
1604 Added raptor_iostream_write_string_turtle
1605
1606 1.4.13
1607 No API changes.
1608
1609 1.4.12
1610 No API changes.
1611
1612 1.4.11
1613 Added raptor_get_feature_count
1614
1615 Added raptor_get_need_base_uri
1616
1617 Added parser feature RAPTOR_FEATURE_NO_NET
1618
1619 Added raptor_www_set_uri_filter, raptor_parser_set_uri_filter with fil‐
1620 ter type raptor_uri_filter_func
1621
1622 1.4.10
1623 No API changes.
1624
1625 1.4.9
1626 Added raptor_parser_get_accept_header
1627
1628 Added raptor_xml_element_is_empty
1629
1630 Added raptor_qname_get_namespace
1631
1632 Added raptor_iostream_write_uri
1633
1634 Added raptor_namespaces_qname_from_uri.
1635
1636 Added raptor_namespace_get_counted_prefix
1637
1638 Added raptor_serialize_set_namespace_from_namespace
1639
1640 Deprecated raptor_uri_is_file_uri for new rap‐
1641 tor_uri_string_is_file_uri.
1642
1643 Added raptor_xml_element_get_attributes and raptor_xml_ele‐
1644 ment_get_attributes_count
1645
1646 1.4.8
1647 Added raptor_set_namespace_handler.
1648
1649 Added XML 1.1 serializing support, feature RAPTOR_FEA‐
1650 TURE_WRITER_XML_VERSION with shortname xmlVersion for serializer and
1651 xml writer classes to support it. Added XML writer feature RAPTOR_FEA‐
1652 TURE_WRITER_XML_DECLARATION to control generation of the XML declara‐
1653 tion. Added new functions raptor_xml_any_escape_string and rap‐
1654 tor_iostream_write_xml_any_escaped_string to allow generating XML 1.1
1655 or XML 1.0.
1656
1657 RAPTOR_IDENTIFIER_TYPE_PREDICATE will no longer be generated from ver‐
1658 sion 1.4.9 onwards as the type of returned statement predicates. RAP‐
1659 TOR_IDENTIFIER_TYPE_RESOURCE will be returned.
1660
1661 RAPTOR_IDENTIFIER_TYPE_ORDINAL may no longer be generated from version
1662 1.4.9 onwards, RAPTOR_IDENTIFIER_TYPE_RESOURCE may replace it.
1663
1664 1.4.7
1665 No changes.
1666
1667 1.4.6
1668 No changes.
1669
1670 1.4.5
1671 Deprecated raptor_ntriples_string_as_utf8_string (never documented
1672 above) since it can only work with a raptor_parser object which makes
1673 it rather unusable alone.
1674
1675 Added XML writer features and support functions raptor_xml_writer_fea‐
1676 tures_enumerate, raptor_xml_writer_set_feature, rap‐
1677 tor_xml_writer_set_feature_string, raptor_xml_writer_get_feature and
1678 raptor_xml_writer_get_feature_string
1679
1680 1.4.3
1681 Added XML Writer class (raptor_xml_writer) and XML Element class (rap‐
1682 tor_xml_element)
1683
1684 Added raptor_parser_get_feature_string, raptor_parser_set_fea‐
1685 ture_string, raptor_serializer_set_feature_string, raptor_serial‐
1686 izer_get_feature_string and raptor_feature_value_type.
1687
1688 Added raptor_serializer_set_namespace, raptor_serializer_set_feature
1689 and raptor_serializer_get_feature.
1690
1691 Added raptor_new_namespace_from_uri, raptor_new_names‐
1692 pace_parts_from_string, Added raptor_namespaces_find_namespace_by_uri.
1693 and raptor_iostream_write_namespace to write a namespace declaration to
1694 an iostream.
1695
1696 Added copy constructor raptor_qname_copy and rap‐
1697 tor_iostream_write_qname to write a qname to an iostream.
1698
1699 Added raptor_sequence_join to join two sequences, leaving one empty.
1700
1701 Added raptor_iostream_write_stringbuffer to write a stringbuffer to an
1702 iostream.
1703
1704 Added N-Triples raptor_iostream_write_string_ntriples and rap‐
1705 tor_iostream_write_statement_ntriples utility functions for writing to
1706 raptor_iostreams.
1707
1708 Added raptor_uri_to_relative_counted_uri_string, raptor_uri_to_rela‐
1709 tive_uri_string. raptor_uri_print, raptor_uri_to_counted_string and
1710 raptor_uri_to_string
1711
1712 Added unicode name checking utility functions for XML 1.0 and XML 1.1
1713 name starting character and continued name character. raptor_uni‐
1714 code_is_xml10_namestartchar raptor_unicode_is_xml10_namechar, rap‐
1715 tor_unicode_is_xml11_namechar and raptor_unicode_is_xml11_names‐
1716 tartchar.
1717
1718 Added raptor_xml_name_check to check if a name is a legal XML 1.0 or
1719 1.0 name. and raptor_iostream_write_xml_escaped_string to write an
1720 XML-escaped string to an iostream.
1721
1722 Added UTF8-checking utility function raptor_utf8_check.
1723
1724 1.4.2
1725 No changes.
1726
1727 1.4.1
1728 The raptor_xml_escape_string now returns <0 on failure rather than 0,
1729 so that if an empty string is escaped, 0 bytes required is returned.
1730
1731 1.4.0
1732 Added new raptor_serializer class supporting RDF/XML (name rdfxml) and
1733 N-Triples (name ntriples).
1734 Added new raptor_iostream class
1735 Added raptor_stringbuffer_copy_to_string to allow efficient copy-out of
1736 a constructed string.
1737 Added raptor_www_fetch_to_string to allow retrieving of web content as
1738 a single string.
1739
1740 1.3.3
1741 Added raptor_calloc_memory to provide a calloc inside raptor.
1742 Added feature check_rdf_id (see raptor_set_feature documentation).
1743
1744 1.3.2
1745 Added raptor_alloc_memory to allocate memory inside raptor.
1746
1747 Added accessor functions for the public raptor_locator structure:
1748
1749 raptor_locator_line
1750 raptor_locator_column
1751 raptor_locator_byte
1752 raptor_locator_file
1753 raptor_locator_uri
1754
1755 1.3.1
1756 Correct raptor_print_statement declaration argument statement to have
1757 one less 'const', to match the code.
1758
1759 1.3.0
1760 Added the following parser methods, utility methods and helper func‐
1761 tions:
1762
1763 raptor_new_parser_for_content (Parser class constructor)
1764 raptor_get_mime_type
1765 raptor_get_feature
1766 raptor_syntax_name_check
1767 raptor_guess_parser_name
1768 raptor_features_enumerate
1769 raptor_feature_from_uri
1770 raptor_www_set_http_accept (WWW class)
1771
1772 Changed raptor_set_feature to now return an int success or failure.
1773
1774 Added the following functions:
1775 raptor_free_memory
1776 raptor_unicode_char_to_utf8
1777 raptor_utf8_to_unicode_char
1778 raptor_vsnprintf
1779
1780 Added the raptor_sequence class, its constructor, destructor, methods
1781 and helper functions.
1782
1783 Added the raptor_stringbuffer class and constructor, destructor and
1784 methods.
1785
1786 Deprecated raptor_print_statement_detailed always intended to be inter‐
1787 nal.
1788
1789 1.2.0
1790 Added raptor_syntaxes_enumerate to get full information on syntax mime
1791 type and URIs as well as name and label.
1792
1793 N-Triples Plus parser renamed to Turtle (name turtle)
1794
1795 1.1.0
1796 Added N-Triples Plus parser (name ntriples-plus)
1797
1798 Made URI class constructors, methods and factory methods as well as
1799 some other utility functions using or returning URIs or literals take
1800 unsigned char* rather than char*. The affected calls are:
1801
1802 URI factory methods changed to all take/return unsigned char* for URI
1803 strings:
1804 raptor_new_uri_func
1805 raptor_new_uri_from_local_name_func
1806 raptor_new_uri_relative_to_base_func
1807 raptor_uri_as_string_func
1808 raptor_uri_as_counted_string_func
1809
1810 Constructors and methods changed to take/return unsigned char* for URI
1811 strings:
1812 raptor_statement_part_as_counted_string
1813 raptor_statement_part_as_string
1814 raptor_new_uri
1815 raptor_new_uri_from_uri_local_name
1816 raptor_new_uri_relative_to_base
1817 raptor_uri_as_string
1818 raptor_uri_as_counted_string
1819 raptor_print_ntriples_string
1820
1821 Changed to use unsigned char* for URI strings, char* for filenames:
1822 raptor_uri_resolve_uri_reference
1823 raptor_uri_filename_to_uri_string
1824 raptor_uri_uri_string_to_filename
1825 raptor_uri_uri_string_to_filename_fragment
1826 raptor_uri_is_file_uri
1827
1828 Changed to return unsigned char* for UTF8 string:
1829 raptor_ntriples_string_as_utf8_string
1830
1831 Added raptor_parsers_enumerate to discover supported parsers.
1832
1833 Added raptor_uri_uri_string_to_filename_fragment with fragment arg to
1834 return the URI fragment.
1835
1836 Made the raptor_namespace, raptor_namespace_stack and raptor_qname
1837 class and APIs public.
1838
1839 Added feature non_nfc_fatal (see raptor_set_feature documentation).
1840
1841 1.0.0
1842 Removed the following deprecated methods and functions (see 0.9.6
1843 changes for the new names):
1844 raptor_free, raptor_new, raptor_ntriples_free, raptor_ntriples_new,
1845 raptor_ntriples_parse_file, raptor_ntriples_set_error_handler, rap‐
1846 tor_ntriples_set_fatal_error_handler, raptor_ntriples_set_state‐
1847 ment_handler and raptor_parser_abort.
1848
1849 Added raptor_parse_file_stream for reading FILE* streams without neces‐
1850 sarily having a file.
1851
1852 0.9.12
1853 Added raptor_new_uri_for_retrieval to turn URI references into URIs
1854 suitable for retrieval (no fragments).
1855
1856 0.9.11
1857 Added raptor_get_name and raptor_get_label.
1858
1859 raptor_xml_escape_string now takes error message handler, data pointer,
1860 loses parser argument.
1861
1862 Added raptor_set_default_generate_id_parameters and raptor_set_gener‐
1863 ate_id_handler to control the default generation of IDs, allow full
1864 customisation.
1865
1866 0.9.10
1867 Added raptor_set_parser_strict and raptor_www_no_www_library_init_fin‐
1868 ish.
1869
1870 raptor_xml_escape_string now takes an output string length pointer.
1871
1872 Added raptor_statement_part_as_counted_string, raptor_state‐
1873 ment_part_as_string and raptor_parse_abort.
1874
1875 Deprecated raptor_parser_abort.
1876
1877 0.9.9
1878 Added raptor_www class and all its constructors, destructor, methods,
1879 calls.
1880
1881 Added raptor_parse_uri, raptor_parser_abort, rap‐
1882 tor_ntriples_term_as_string and raptor_xml_escape_string.
1883
1884 0.9.7
1885 raptor_parse_chunk, raptor_new_uri_from_id, arguments are now unsigned
1886 char.
1887
1888 Added raptor_new_uri_for_xmlbase.
1889
1890 0.9.6
1891 In this version, the raptor/ntriples parser calling APIs were modified.
1892 The following table lists the changes:
1893
1894 OLD API NEW API (0.9.6+)
1895 raptor_new() raptor_new_parser("rdfxml")
1896 ntriples_new() raptor_new_parser("ntriples")
1897 raptor_free raptor_free_parser
1898 ntriples_free raptor_ntriples_parser
1899 raptor_ntriples_parse_file raptor_parse_file
1900 raptor_ntriples_set_error_handler raptor_set_error_handler
1901 raptor_ntriples_set_fatal_error_handler raptor_set_fatal_error_handler
1902 raptor_ntriples_set_statement_handler raptor_set_statement_handler
1903
1905 RDF/XML Syntax (Revised), Dave Beckett (ed.) W3C Recommendation,
1906 http://www.w3.org/TR/rdf-syntax-grammar/ ⟨http://www.w3.org/TR/rdf-
1907 syntax-grammar/⟩
1908
1909 N-Triples, in RDF Test Cases, Jan Grant and Dave Beckett (eds.) W3C
1910 Recommendation, http://www.w3.org/TR/rdf-testcases/#ntriples
1911 ⟨http://www.w3.org/TR/rdf-testcases/#ntriples⟩
1912
1913 Turtle - Terse RDF Triple Language, Dave Beckett,
1914 http://www.dajobe.org/2004/01/turtle/
1915 ⟨http://www.dajobe.org/2004/01/turtle/⟩
1916
1917 RSS 0.91 spec revision 3, Dan Libby, Netscape,
1918 http://my.netscape.com/publish/formats/rss-spec-0.91.html
1919 ⟨http://my.netscape.com/publish/formats/rss-spec-0.91.html⟩
1920
1921 RDF Site Summary (RSS) 1.0, http://purl.org/rss/1.0/spec
1922 ⟨http://purl.org/rss/1.0/spec⟩
1923
1924 Atom 1.0 syndication format, RFC 4287,
1925 http://www.ietf.org/rfc/rfc4287.txt
1926 ⟨http://www.ietf.org/rfc/rfc4287.txt⟩
1927
1928 Gleaning Resource Descriptions from Dialects of Languages (GRDDL), Dan
1929 Connolly (ed.), W3C Recommendation, 2007-09-11,
1930 http://www.w3.org/TR/2007/REC-grddl-20070911/
1931 ⟨http://www.w3.org/TR/2007/REC-grddl-20070911/⟩
1932
1933
1935 rapper(1),[22mraptor-config(1)
1936
1938 Dave Beckett - http://purl.org/net/dajobe/
1939 ⟨http://purl.org/net/dajobe/⟩
1940
1941
1942
1943 2007-09-30 libraptor(3)