/* -*- Mode: c; c-basic-offset: 2 -*- * * raptor.h - Redland Parser Toolkit for RDF (Raptor) - public API * * Copyright (C) 2000-2013, David Beckett http://www.dajobe.org/ * Copyright (C) 2000-2005, University of Bristol, UK http://www.bristol.ac.uk/ * * This package is Free Software and part of Redland http://librdf.org/ * * It is licensed under the following three licenses as alternatives: * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version * 2. GNU General Public License (GPL) V2 or any newer version * 3. Apache License, V2.0 or any newer version * * You may not use this file except in compliance with at least one of * the above three licenses. * * See LICENSE.html or LICENSE.txt at the top of this package for the * complete terms and further detail along with the license texts for * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. * *
*/
#ifndef RAPTOR_H #define RAPTOR_H
#ifdef __cplusplus extern"C" { #endif
#include <stdio.h>
/* Required for va_list in raptor_vsnprintf */ #include <stdarg.h>
/** * RAPTOR_V2_AVAILABLE * * Flag for marking raptor2 API availability.
*/ #define RAPTOR_V2_AVAILABLE 1
/** * RAPTOR_VERSION: * * Raptor library version number * * Format: major * 10000 + minor * 100 + release
*/ #define RAPTOR_VERSION 20016
/** * raptor_type_q: * @mime_type: MIME type string * @mime_type_len: length of @mime_type * @q: Q value 0-10 standing for decimal 0.0-1.0 * * (MIME Type, Q) pair
*/ typedefstruct { constchar* mime_type;
size_t mime_type_len; unsignedchar q;
} raptor_type_q;
/** * raptor_syntax_bitflags: * @RAPTOR_SYNTAX_NEED_BASE_URI: the syntax requires a base URI * * Bit flags for #raptor_syntax_description flags field
*/ typedefenum {
RAPTOR_SYNTAX_NEED_BASE_URI = 1
} raptor_syntax_bitflags;
/** * raptor_syntax_description: * @names: array of syntax names - the first one (required) is the public name, the rest are aliases. The array is NULL terminated. * @names_count: size of @names array * @label: long descriptive label for syntax * @mime_types: Array of (MIME type, Q) values associated with the syntax (or NULL). If present the array is NULL terminated. * @mime_types_count: size of @mime_types array * @uri_strings: array of URIs identifying the syntax (or NULL). The first one if present is the main URI, the rest are aliases. The array is NULL terminated. * @uri_strings_count: size of @uri_strings array * @flags: See #raptor_syntax_bitflags for the bits * * Description of a syntax or file format. *
*/ typedefstruct { constchar* const* names; unsignedint names_count;
/** * raptor_term_type: * @RAPTOR_TERM_TYPE_URI: RDF URI * @RAPTOR_TERM_TYPE_LITERAL: RDF literal * @RAPTOR_TERM_TYPE_BLANK: RDF blank node * @RAPTOR_TERM_TYPE_UNKNOWN: Internal * * Type of term in a #raptor_statement * * Node type 3 is unused but exists to preserve numeric compatibility * with librdf_node_type values.
*/ typedefenum {
RAPTOR_TERM_TYPE_UNKNOWN = 0,
RAPTOR_TERM_TYPE_URI = 1,
RAPTOR_TERM_TYPE_LITERAL = 2, /* unused type 3 */
RAPTOR_TERM_TYPE_BLANK = 4
} raptor_term_type;
/** * raptor_locator: * @uri: URI of location (or NULL) * @file: Filename of location (or NULL) * @line: Line number of location (or <0 for no line) * @column: Column number of location (or <0 for no column) * @byte: Byte number of location (or <0 for no byte) * * Location information for an error, warning or information message.
*/ typedefstruct {
raptor_uri *uri; constchar *file; int line; int column; int byte;
} raptor_locator;
/** * raptor_option: * @RAPTOR_OPTION_SCANNING: If true (default false), the RDF/XML * parser will look for embedded rdf:RDF elements inside the XML * content, and not require that the XML start with an rdf:RDF root * element. * @RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES: If true (default true) * then the RDF/XML parser will allow non-XML namespaced attributes * to be accepted as well as rdf: namespaced ones. For example, * 'about' and 'ID' will be interpreted as if they were rdf:about * and rdf:ID respectively. * @RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES: If true (default true) * then the RDF/XML parser will allow unknown parsetypes to be * present and will pass them on to the user. Unimplemented at * present. * @RAPTOR_OPTION_ALLOW_BAGID: If true (default true) then the * RDF/XML parser will support the rdf:bagID attribute that was * removed from the RDF/XML language when it was revised. This * support may be removed in future. * @RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST: If true (default false) * then the RDF/XML parser will generate the idList rdf:type * rdf:List triple in the handling of rdf:parseType="Collection". * This triple was removed during the revising of RDF/XML after * collections were initially added. * @RAPTOR_OPTION_NORMALIZE_LANGUAGE: If true (default true) then * XML language values such as from xml:lang will be normalized to * lowercase. * @RAPTOR_OPTION_NON_NFC_FATAL: If true (default false) then * illegal Unicode Normal Form C in literals will give a fatal * error, otherwise just a warning. * @RAPTOR_OPTION_WARN_OTHER_PARSETYPES: If true (default true) then * the RDF/XML parser will warn about unknown rdf:parseType values. * @RAPTOR_OPTION_CHECK_RDF_ID: If true (default true) then the * RDF/XML will check rdf:ID attribute values for duplicates and * cause an error if any are found. * @RAPTOR_OPTION_RELATIVE_URIS: If true (default true) then * relative URIs will be used wherever possible when serializing. * @RAPTOR_OPTION_WRITER_AUTO_INDENT: Automatically indent elements when * seriailizing. * @RAPTOR_OPTION_WRITER_AUTO_EMPTY: Automatically detect and * abbreviate empty elements when serializing. * @RAPTOR_OPTION_WRITER_INDENT_WIDTH: Integer number of spaces to use * for each indent level when serializing with auto indent. * @RAPTOR_OPTION_WRITER_XML_VERSION: Integer XML version XML 1.0 (10) or XML 1.1 (11) * @RAPTOR_OPTION_WRITER_XML_DECLARATION: Write XML 1.0 or 1.1 declaration. * @RAPTOR_OPTION_NO_NET: Deny network requests inside other requests. * @RAPTOR_OPTION_RESOURCE_BORDER: Border color of resource * nodes for GraphViz DOT serializer. * @RAPTOR_OPTION_LITERAL_BORDER: Border color of literal nodes * for GraphViz DOT serializer. * @RAPTOR_OPTION_BNODE_BORDER: Border color of blank nodes for * GraphViz DOT serializer. * @RAPTOR_OPTION_RESOURCE_FILL: Fill color of resource nodes * for GraphViz DOT serializer. * @RAPTOR_OPTION_LITERAL_FILL: Fill color of literal nodes for * GraphViz DOT serializer. * @RAPTOR_OPTION_BNODE_FILL: Fill color of blank nodes for * GraphViz DOT serializer. * @RAPTOR_OPTION_HTML_TAG_SOUP: Use a lax HTML parser if an XML parser * fails when read HTML for GRDDL parser. * @RAPTOR_OPTION_MICROFORMATS: Look for microformats for GRDDL parser. * @RAPTOR_OPTION_HTML_LINK: Look for head <link> to type rdf/xml * for GRDDL parser. * @RAPTOR_OPTION_WWW_TIMEOUT: Set timeout for internal WWW URI requests * for GRDDL parser. * @RAPTOR_OPTION_WRITE_BASE_URI: Write @base directive for Turtle/N3. * @RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL: HTTP Cache-Control: header * @RAPTOR_OPTION_WWW_HTTP_USER_AGENT: HTTP User-Agent: header * @RAPTOR_OPTION_JSON_CALLBACK: JSON serializer callback function. * @RAPTOR_OPTION_JSON_EXTRA_DATA: JSON serializer extra top-level data * @RAPTOR_OPTION_RSS_TRIPLES: Atom/RSS serializer writes extra RDF triples it finds (none, rdf-xml, atom-triples) * @RAPTOR_OPTION_ATOM_ENTRY_URI: Atom entry URI. If given, generate an Atom Entry Document with the item having the given URI, otherwise generate an Atom Feed Document with any items found. * @RAPTOR_OPTION_PREFIX_ELEMENTS: Integer. If set, generate Atom/RSS1.0 documents with prefixed elements, otherwise unprefixed. * @RAPTOR_OPTION_STRICT: Boolean. If set, operate in strict conformance mode. * @RAPTOR_OPTION_WWW_CERT_FILENAME: String. SSL client certificate filename * @RAPTOR_OPTION_WWW_CERT_TYPE: String. SSL client certificate type * @RAPTOR_OPTION_WWW_CERT_PASSPHRASE: String. SSL client certificate passphrase * @RAPTOR_OPTION_WWW_SSL_VERIFY_PEER: Integer. SSL verify peer - non-0 to verify peer SSL certificate (default) * @RAPTOR_OPTION_WWW_SSL_VERIFY_HOST: Integer. SSL verify host - 0 none, 1 CN match, 2 host match (default). Other values are ignored. * @RAPTOR_OPTION_NO_FILE: Deny file reading requests inside other requests. * @RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES: When reading XML, load external entities. * @RAPTOR_OPTION_LAST: Internal * * Raptor parser, serializer or XML writer options.
*/ typedefenum {
RAPTOR_OPTION_SCANNING,
RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES,
RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES,
RAPTOR_OPTION_ALLOW_BAGID,
RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST,
RAPTOR_OPTION_NORMALIZE_LANGUAGE,
RAPTOR_OPTION_NON_NFC_FATAL,
RAPTOR_OPTION_WARN_OTHER_PARSETYPES,
RAPTOR_OPTION_CHECK_RDF_ID,
RAPTOR_OPTION_RELATIVE_URIS,
RAPTOR_OPTION_WRITER_AUTO_INDENT,
RAPTOR_OPTION_WRITER_AUTO_EMPTY,
RAPTOR_OPTION_WRITER_INDENT_WIDTH,
RAPTOR_OPTION_WRITER_XML_VERSION,
RAPTOR_OPTION_WRITER_XML_DECLARATION,
RAPTOR_OPTION_NO_NET,
RAPTOR_OPTION_RESOURCE_BORDER,
RAPTOR_OPTION_LITERAL_BORDER,
RAPTOR_OPTION_BNODE_BORDER,
RAPTOR_OPTION_RESOURCE_FILL,
RAPTOR_OPTION_LITERAL_FILL,
RAPTOR_OPTION_BNODE_FILL,
RAPTOR_OPTION_HTML_TAG_SOUP,
RAPTOR_OPTION_MICROFORMATS,
RAPTOR_OPTION_HTML_LINK,
RAPTOR_OPTION_WWW_TIMEOUT,
RAPTOR_OPTION_WRITE_BASE_URI,
RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL,
RAPTOR_OPTION_WWW_HTTP_USER_AGENT,
RAPTOR_OPTION_JSON_CALLBACK,
RAPTOR_OPTION_JSON_EXTRA_DATA,
RAPTOR_OPTION_RSS_TRIPLES,
RAPTOR_OPTION_ATOM_ENTRY_URI,
RAPTOR_OPTION_PREFIX_ELEMENTS,
RAPTOR_OPTION_STRICT,
RAPTOR_OPTION_WWW_CERT_FILENAME,
RAPTOR_OPTION_WWW_CERT_TYPE,
RAPTOR_OPTION_WWW_CERT_PASSPHRASE,
RAPTOR_OPTION_NO_FILE,
RAPTOR_OPTION_WWW_SSL_VERIFY_PEER,
RAPTOR_OPTION_WWW_SSL_VERIFY_HOST,
RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES,
RAPTOR_OPTION_LAST = RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES
} raptor_option;
/** * raptor_term_literal_value: * @string: literal string * @string_len: length of string * @datatype: datatype URI (or NULL) * @language: literal language (or NULL) * @language_len: length of language * * Literal term value - this typedef exists solely for use in #raptor_term * * Either @datatype or @language may be non-NULL but not both.
*/ typedefstruct { unsignedchar *string; unsignedint string_len;
/** * raptor_term_blank_value: * @string: literal string * @string_len: length of string * * Blank term value - this typedef exists solely for use in #raptor_term *
*/ typedefstruct { unsignedchar *string; unsignedint string_len;
} raptor_term_blank_value;
/** * raptor_term_value: * @uri: uri value when term type is #RAPTOR_TERM_TYPE_URI * @literal: literal value when term type is #RAPTOR_TERM_TYPE_LITERAL * @blank: blank value when term type is #RAPTOR_TERM_TYPE_BLANK * * Term value - this typedef exists solely for use in #raptor_term *
**/ typedefunion {
raptor_uri *uri;
/** * raptor_term: * @world: world * @usage: usage reference count (if >0) * @type: term type * @value: term values per type * * An RDF statement term *
*/ typedefstruct {
raptor_world* world;
int usage;
raptor_term_type type;
raptor_term_value value;
} raptor_term;
/** * raptor_statement: * @world: world pointer * @usage: usage count * @subject: statement subject * @predicate: statement predicate * @object: statement object * @graph: statement graph name (or NULL if not present) * * An RDF triple with optional graph name (quad) * * See #raptor_term for a description of how the fields may be used. * As returned by a parser statement_handler.
*/ typedefstruct {
raptor_world* world; int usage;
raptor_term* subject;
raptor_term* predicate;
raptor_term* object;
raptor_term* graph;
} raptor_statement;
/** * raptor_log_level: * @RAPTOR_LOG_LEVEL_NONE: Internal * @RAPTOR_LOG_LEVEL_TRACE: very fine-grained tracing messages information * @RAPTOR_LOG_LEVEL_DEBUG: fine-grained tracing messages suitable for debugging * @RAPTOR_LOG_LEVEL_INFO: coarse-grained information messages * @RAPTOR_LOG_LEVEL_WARN: warning messages of potentially harmful problems * @RAPTOR_LOG_LEVEL_ERROR: error messages where the application can continue * @RAPTOR_LOG_LEVEL_FATAL: fatal error message where the application will likely abort * @RAPTOR_LOG_LEVEL_LAST: Internal * * Log levels
*/ typedefenum {
RAPTOR_LOG_LEVEL_NONE,
RAPTOR_LOG_LEVEL_TRACE,
RAPTOR_LOG_LEVEL_DEBUG,
RAPTOR_LOG_LEVEL_INFO,
RAPTOR_LOG_LEVEL_WARN,
RAPTOR_LOG_LEVEL_ERROR,
RAPTOR_LOG_LEVEL_FATAL,
RAPTOR_LOG_LEVEL_LAST = RAPTOR_LOG_LEVEL_FATAL
} raptor_log_level;
/** * raptor_log_message: * @code: error code or < 0 if not used or known * @domain: message domain or #RAPTOR_DOMAIN_NONE if not used or known * @level: log message level * @locator: location associated with message or NULL if not known * @text: message string * * Log message.
*/ typedefstruct { int code;
raptor_domain domain;
raptor_log_level level;
raptor_locator *locator; constchar *text;
} raptor_log_message;
/** * raptor_log_handler: * @user_data: user data * @message: log message * * Handler function for log messages with location * * Used during parsing and serializing for errors and warnings that * may include location information. Handlers may be set * by raptor_world_set_log_handler(). *
*/ typedefvoid (*raptor_log_handler)(void *user_data, raptor_log_message *message);
/** * raptor_statement_handler: * @user_data: user data * @statement: statement to report * * Statement (triple) reporting handler function. * * This handler function set with * raptor_parser_set_statement_handler() on a parser receives * statements as the parsing proceeds. The @statement argument to the * handler is shared and must be copied by the caller with * raptor_statement_copy().
*/ typedefvoid (*raptor_statement_handler)(void *user_data, raptor_statement *statement);
/** * raptor_graph_mark_flags: * @RAPTOR_GRAPH_MARK_START: mark is start of graph (otherwise is end) * @RAPTOR_GRAPH_MARK_DECLARED: mark was declared in syntax rather than implict * * Graph mark handler bitmask flags
*/ typedefenum {
RAPTOR_GRAPH_MARK_START = 1,
RAPTOR_GRAPH_MARK_DECLARED = 2
} raptor_graph_mark_flags;
/** * raptor_graph_mark_handler: * @user_data: user data * @graph: graph to report, NULL for the default graph * @flags: bitmask of #raptor_graph_mark_flags flags * * Graph start/end mark handler function. * * Records start and end of graphs happening in a stream of generated * #raptor_statement via the statement handler. The callback starts a * graph when @flags has #RAPTOR_GRAPH_MARK_START bit set. * * The start and ends may be either declared in the syntax via some * keyword or mechanism such as TRiG {} syntax when @flags has bit * #RAPTOR_GRAPH_MARK_DECLARED set, or be implied by the start/end of * the data in other syntaxes, and the bit will be unset.
*/ typedefvoid (*raptor_graph_mark_handler)(void *user_data, raptor_uri *graph, int flags);
/** * raptor_generate_bnodeid_handler: * @user_data: user data * @user_bnodeid: a user-specified ID or NULL if none available. * * Generate a blank node identifier handler function. * * Return value: new blank node ID to use
*/ typedefunsignedchar* (*raptor_generate_bnodeid_handler)(void *user_data, unsignedchar* user_bnodeid);
/** * raptor_namespace_handler: * @user_data: user data * @nspace: #raptor_namespace declared * * XML Namespace declaration reporting handler set by * raptor_parser_set_namespace_handler().
*/ typedefvoid (*raptor_namespace_handler)(void* user_data, raptor_namespace *nspace);
/** * raptor_www_write_bytes_handler: * @www: WWW object * @userdata: user data * @ptr: data pointer * @size: size of individual item * @nmemb: number of items * * Receiving bytes of data from WWW retrieval handler. * * Set by raptor_www_set_write_bytes_handler().
*/ typedefvoid (*raptor_www_write_bytes_handler)(raptor_www* www, void *userdata, constvoid *ptr, size_t size, size_t nmemb);
/** * raptor_www_content_type_handler: * @www: WWW object * @userdata: user data * @content_type: content type seen * * Receiving Content-Type: header from WWW retrieval handler. * * Set by raptor_www_set_content_type_handler().
*/ typedefvoid (*raptor_www_content_type_handler)(raptor_www* www, void *userdata, constchar *content_type);
/** * raptor_www_final_uri_handler: * @www: WWW object * @userdata: user data * @final_uri: final URI seen * * Receiving the final resolved URI from a WWW retrieval * * Set by raptor_www_set_final_uri_handler().
*/ typedefvoid (*raptor_www_final_uri_handler)(raptor_www* www, void *userdata, raptor_uri *final_uri);
/** * raptor_uri_filter_func: * @user_data: user data * @uri: #raptor_uri URI to check * * Callback function for #raptor_www_set_uri_filter * * Return value: non-0 to filter the URI
*/ typedefint (*raptor_uri_filter_func)(void *user_data, raptor_uri* uri);
/** * raptor_world_flag: * @RAPTOR_WORLD_FLAG_LIBXML_GENERIC_ERROR_SAVE: if set (non-0 value) - save/restore the libxml generic error handler when raptor library initializes (default set) * @RAPTOR_WORLD_FLAG_LIBXML_STRUCTURED_ERROR_SAVE: if set (non-0 value) - save/restore the libxml structured error handler when raptor library terminates (default set) * @RAPTOR_WORLD_FLAG_URI_INTERNING: if set (non-0 value) - each URI is saved interned in-memory and reused (default set) * @RAPTOR_WORLD_FLAG_WWW_SKIP_INIT_FINISH: if set (non-0 value) the raptor will neither initialise or terminate the lower level WWW library. Usually in raptor initialising either curl_global_init (for libcurl) are called and in raptor cleanup, curl_global_cleanup is called. This flag allows the application finer control over these libraries such as setting other global options or potentially calling and terminating raptor several times. It does mean that applications which use this call must do their own extra work in order to allocate and free all resources to the system. * * Raptor world flags * * These are used by raptor_world_set_flags() to control raptor-wide * options across classes. These must be set before * raptor_world_open() is called explicitly or implicitly (by * creating a raptor object). There is no enumeration function for * these flags because they are not user options and must be set * before the library is initialised. For similar reasons, there is * no get function. * * If any libxml handler saving/restoring is enabled, any existing * handler and context is saved before parsing and restored * afterwards. Otherwise, no saving/restoring is performed. *
*/ typedefenum {
RAPTOR_WORLD_FLAG_LIBXML_GENERIC_ERROR_SAVE = 1,
RAPTOR_WORLD_FLAG_LIBXML_STRUCTURED_ERROR_SAVE = 2,
RAPTOR_WORLD_FLAG_URI_INTERNING = 3,
RAPTOR_WORLD_FLAG_WWW_SKIP_INIT_FINISH = 4
} raptor_world_flag;
/** * raptor_data_compare_arg_handler: * @data1: first object * @data2: second object * @user_data: user data argument * * Function to compare two data objects with a user data argument * * Designed to be used with raptor_sort_r() and compatible functions * such as raptor_sequence_sort_r() which uses it. * * Return value: compare value <0 if @data1 is before @data2, =0 if equal, >0 if @data1 is after @data2
*/ typedefint (*raptor_data_compare_arg_handler)(constvoid *data1, constvoid *data2, void *user_data);
/** * raptor_data_compare_handler: * @data1: first data object * @data2: second data object * * Function to compare two data objects - signature like strcmp() and function pssed to qsort() * * Designed to be passed into generic data structure constructors * like raptor_new_avltree(). * * Return value: compare value <0 if @data1 is before @data2, =0 if equal, >0 if @data1 is after @data2
*/ typedefint (*raptor_data_compare_handler)(constvoid* data1, constvoid* data2);
/** * raptor_data_malloc_handler: * @size: data size * * Typedef for a function to allocate memory - signature like malloc() * * Designed to be passed into constructors * like raptor_www_fetch_to_string * * Return value: pointer to newly allocated memory or NULL on failure
*/ typedefvoid* (*raptor_data_malloc_handler)(size_t size);
/** * raptor_data_free_handler: * @data: data object or NULL * * Typedef for function to free a data object - signature like free() * * Designed to be passed into generic data structure constructors * like raptor_new_avltree(). If @data is NULL, nothing should be done.
*/ typedefvoid (*raptor_data_free_handler)(void* data);
/** * raptor_data_context_free_handler: * @context: context data for the free function * @object: object to free * * Handler function for freeing a sequence item with a contextual pointer. * * Set by raptor_new_sequence_with_context().
*/ typedefvoid (*raptor_data_context_free_handler)(void* context, void* object);
/** * raptor_data_print_handler: * @object: object to print * @fh: FILE* to print to * * Handler function for printing an object to a stream. * * Set by raptor_new_sequence() * * Return value: non-0 on failure
*/ typedefint (*raptor_data_print_handler)(void *object, FILE *fh);
/** * raptor_data_context_print_handler: * @context: context data for the print function * @object: object to print * @fh: FILE* to print to * * Function function for printing an object with data context to a stream. * * Set by raptor_new_sequence_with_context() * * Return value: non-0 on failure
*/ typedefint (*raptor_data_context_print_handler)(void *context, void *object, FILE *fh);
/* methods */
RAPTOR_API int raptor_sequence_size(raptor_sequence* seq);
RAPTOR_API int raptor_sequence_set_at(raptor_sequence* seq, int idx, void *data);
RAPTOR_API int raptor_sequence_push(raptor_sequence* seq, void *data);
RAPTOR_API int raptor_sequence_shift(raptor_sequence* seq, void *data);
RAPTOR_API void* raptor_sequence_get_at(raptor_sequence* seq, int idx);
RAPTOR_API void* raptor_sequence_pop(raptor_sequence* seq);
RAPTOR_API void* raptor_sequence_unshift(raptor_sequence* seq);
RAPTOR_API void* raptor_sequence_delete_at(raptor_sequence* seq, int idx);
RAPTOR_API void raptor_sequence_sort(raptor_sequence* seq, raptor_data_compare_handler compare);
RAPTOR_API void raptor_sequence_sort_r(raptor_sequence* seq, raptor_data_compare_arg_handler compare, void* user_data);
RAPTOR_API int raptor_sequence_swap(raptor_sequence* seq, int i, int j);
RAPTOR_API int raptor_sequence_reverse(raptor_sequence* seq, int start_index, int length);
RAPTOR_API int raptor_sequence_next_permutation(raptor_sequence *seq, raptor_data_compare_handler compare);
/* helper for printing sequences of strings */
RAPTOR_API int raptor_sequence_print(raptor_sequence* seq, FILE* fh);
RAPTOR_API int raptor_sequence_join(raptor_sequence* dest, raptor_sequence *src);
/* Unicode and UTF8 */
/** * raptor_unichar: * * raptor Unicode codepoint
*/ typedefunsignedlong raptor_unichar;
RAPTOR_API int raptor_unicode_utf8_string_put_char(raptor_unichar c, unsignedchar *output, size_t length);
RAPTOR_API int raptor_unicode_utf8_string_get_char(constunsignedchar *input, size_t length, raptor_unichar *output);
RAPTOR_API int raptor_unicode_is_xml11_namestartchar(raptor_unichar c);
RAPTOR_API int raptor_unicode_is_xml10_namestartchar(raptor_unichar c);
RAPTOR_API int raptor_unicode_is_xml11_namechar(raptor_unichar c);
RAPTOR_API int raptor_unicode_is_xml10_namechar(raptor_unichar c);
RAPTOR_API int raptor_unicode_check_utf8_string(constunsignedchar *string, size_t length);
RAPTOR_API int raptor_unicode_utf8_strlen(constunsignedchar *string, size_t length);
RAPTOR_API
size_t raptor_unicode_utf8_substr(unsignedchar* dest, size_t* dest_length_p, constunsignedchar* src, size_t src_length, int startingLoc, int length);
/* methods */
RAPTOR_API int raptor_stringbuffer_append_counted_string(raptor_stringbuffer* stringbuffer, constunsignedchar *string, size_t length, int do_copy);
RAPTOR_API int raptor_stringbuffer_append_string(raptor_stringbuffer* stringbuffer, constunsignedchar *string, int do_copy);
RAPTOR_API int raptor_stringbuffer_append_decimal(raptor_stringbuffer* stringbuffer, int integer);
RAPTOR_API int raptor_stringbuffer_append_hexadecimal(raptor_stringbuffer* stringbuffer, int hex);
RAPTOR_API int raptor_stringbuffer_append_stringbuffer(raptor_stringbuffer* stringbuffer, raptor_stringbuffer* append);
RAPTOR_API int raptor_stringbuffer_prepend_counted_string(raptor_stringbuffer* stringbuffer, constunsignedchar *string, size_t length, int do_copy);
RAPTOR_API int raptor_stringbuffer_prepend_string(raptor_stringbuffer* stringbuffer, constunsignedchar *string, int do_copy);
RAPTOR_API unsignedchar* raptor_stringbuffer_as_string(raptor_stringbuffer* stringbuffer);
RAPTOR_API
size_t raptor_stringbuffer_length(raptor_stringbuffer* stringbuffer);
RAPTOR_API int raptor_stringbuffer_copy_to_string(raptor_stringbuffer* stringbuffer, unsignedchar *string, size_t length);
/** * raptor_iostream_init_func: * @context: stream context data * * Handler function for #raptor_iostream initialising. * * Return value: non-0 on failure.
*/ typedefint (*raptor_iostream_init_func) (void *context);
/** * raptor_iostream_finish_func: * @context: stream context data * * Handler function for #raptor_iostream terminating. *
*/ typedefvoid (*raptor_iostream_finish_func) (void *context);
/** * raptor_iostream_write_byte_func * @context: stream context data * @byte: byte to write * * Handler function for implementing raptor_iostream_write_byte(). * * Return value: non-0 on failure.
*/ typedefint (*raptor_iostream_write_byte_func) (void *context, constint byte);
/** * raptor_iostream_write_bytes_func: * @context: stream context data * @ptr: pointer to bytes to write * @size: size of item * @nmemb: number of items * * Handler function for implementing raptor_iostream_write_bytes(). * * Return value: non-0 on failure.
*/ typedefint (*raptor_iostream_write_bytes_func) (void *context, constvoid *ptr, size_t size, size_t nmemb);
/** * raptor_iostream_write_end_func: * @context: stream context data * * Handler function for implementing raptor_iostream_write_end(). * * Return value: non-0 on failure.
*/ typedefint (*raptor_iostream_write_end_func) (void *context);
/** * raptor_iostream_read_bytes_func: * @context: stream context data * @ptr: pointer to buffer to read into * @size: size of buffer * @nmemb: number of items * * Handler function for implementing raptor_iostream_read_bytes(). * * Return value: number of items read, 0 or < @size on EOF, <0 on failure
*/ typedefint (*raptor_iostream_read_bytes_func) (void *context, void *ptr, size_t size, size_t nmemb);
/** * raptor_iostream_read_eof_func: * @context: stream context data * * Handler function for implementing raptor_iostream_read_eof(). * * Return value: non-0 if EOF
*/ typedefint (*raptor_iostream_read_eof_func) (void *context);
/** * raptor_iostream_handler: * @version: interface version. Presently 1 or 2. * @init: initialisation handler - optional, called at most once (V1) * @finish: finishing handler - optional, called at most once (V1) * @write_byte: write byte handler - required (for writing) (V1) * @write_bytes: write bytes handler - required (for writing) (V1) * @write_end: write end handler - optional (for writing), called at most once (V1) * @read_bytes: read bytes handler - required (for reading) (V2) * @read_eof: read EOF handler - required (for reading) (V2) * * I/O stream implementation handler structure. *
*/ typedefstruct { int version;
/* SPARQL literal: allows raw UTF8 for printable literals */
RAPTOR_ESCAPED_WRITE_SPARQL_LITERAL = RAPTOR_ESCAPED_WRITE_BITFLAG_UTF8,
/* SPARQL long literal: no BS-escapes allowed */
RAPTOR_ESCAPED_WRITE_SPARQL_LONG_LITERAL = RAPTOR_ESCAPED_WRITE_BITFLAG_UTF8,
/* SPARQL uri: have to escape certain characters */
RAPTOR_ESCAPED_WRITE_SPARQL_URI = RAPTOR_ESCAPED_WRITE_BITFLAG_UTF8 | RAPTOR_ESCAPED_WRITE_BITFLAG_SPARQL_URI_ESCAPES,
/* Turtle (2013) escapes are like SPARQL */
RAPTOR_ESCAPED_WRITE_TURTLE_URI = RAPTOR_ESCAPED_WRITE_SPARQL_URI,
RAPTOR_ESCAPED_WRITE_TURTLE_LITERAL = RAPTOR_ESCAPED_WRITE_SPARQL_LITERAL,
RAPTOR_ESCAPED_WRITE_TURTLE_LONG_LITERAL = RAPTOR_ESCAPED_WRITE_SPARQL_LONG_LITERAL,
RAPTOR_API int raptor_string_ntriples_write(constunsignedchar *string, size_t len, constchar delim, raptor_iostream *iostr);
RAPTOR_API int raptor_bnodeid_ntriples_write(constunsignedchar *bnodeid, size_t len, raptor_iostream *iostr);
RAPTOR_API RAPTOR_DEPRECATED int raptor_string_python_write(constunsignedchar *string, size_t len, constchar delim, unsignedint mode, raptor_iostream *iostr);
RAPTOR_API int raptor_statement_ntriples_write(const raptor_statement *statement, raptor_iostream* iostr, int write_graph_term);
RAPTOR_API int raptor_string_escaped_write(constunsignedchar *string, size_t len, constchar delim, unsignedint flags, raptor_iostream *iostr);
/* Parser and Serializer options */
/** * raptor_option_value_type: * @RAPTOR_OPTION_VALUE_TYPE_BOOL: Boolean integer value. Non-0 is true * @RAPTOR_OPTION_VALUE_TYPE_INT: Decimal integer value * @RAPTOR_OPTION_VALUE_TYPE_STRING: String value * @RAPTOR_OPTION_VALUE_TYPE_URI: URI String value. * @RAPTOR_OPTION_VALUE_TYPE_LAST: internal * * Option value types.
*/ typedefenum {
RAPTOR_OPTION_VALUE_TYPE_BOOL,
RAPTOR_OPTION_VALUE_TYPE_INT,
RAPTOR_OPTION_VALUE_TYPE_STRING,
RAPTOR_OPTION_VALUE_TYPE_URI,
RAPTOR_OPTION_VALUE_TYPE_LAST = RAPTOR_OPTION_VALUE_TYPE_URI
} raptor_option_value_type;
/** * raptor_option_description: * @domain: domain ID * @option: option ID * @value_type: data type of option value * @name: short name for option * @name_len: length of @name * @label: description of option * @uri: URI identifying option * * Description of an option for a domain.
*/ typedefstruct {
raptor_domain domain;
raptor_option option;
raptor_option_value_type value_type; constchar* name;
size_t name_len; constchar* label;
raptor_uri* uri;
} raptor_option_description;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.