| Raptor RDF Syntax Library Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#define RAPTOR_VERSION #define RAPTOR_VERSION_MAJOR #define RAPTOR_VERSION_MINOR #define RAPTOR_VERSION_RELEASE #define RAPTOR_VERSION_STRING extern const unsigned int raptor_version_major; extern const unsigned int raptor_version_minor; extern const unsigned int raptor_version_release; extern const unsigned int raptor_version_decimal; void (*raptor_statement_handler) (void *user_data,raptor_statement *statement); char * raptor_vsnprintf (const char *message,va_list arguments); void (*raptor_log_handler) (void *user_data,raptor_log_message *message); raptor_log_message; enum raptor_log_level; const char * raptor_log_level_get_label (raptor_log_level level); enum raptor_domain; const char * raptor_domain_get_label (raptor_domain domain); int (*raptor_data_compare_handler) (const void *data1,const void *data2); void (*raptor_data_context_free_handler) (void *context,void *object); int (*raptor_data_context_print_handler) (void *context,void *object,FILE *fh); void (*raptor_data_free_handler) (void *data); void * (*raptor_data_malloc_handler) (size_t size); int (*raptor_data_print_handler) (void *object,FILE *fh); enum raptor_syntax_bitflags; raptor_syntax_description; int raptor_syntax_description_validate (raptor_syntax_description *desc); raptor_type_q;
How to get access to version numbers, set message and error handlers, list the parsed and serialized syntaxes provided in the library and various other utility functions.
#define RAPTOR_VERSION 20004
Raptor library version number
Format: major * 10000 + minor * 100 + release
extern const unsigned int raptor_version_major;
Library major version number as a decimal integer.
extern const unsigned int raptor_version_minor;
Library minor version number as a decimal integer.
extern const unsigned int raptor_version_release;
Library release version number as a decimal integer.
extern const unsigned int raptor_version_decimal;
Library full version as a decimal integer.
See also raptor_version_string.
void (*raptor_statement_handler) (void *user_data,raptor_statement *statement);
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().
|
user data |
|
statement to report |
char * raptor_vsnprintf (const char *message,va_list arguments);
Format output for a variable arguments list.
This is a wrapper around system versions of vsnprintf with different call and return conventions.
|
printf-style format string |
|
variable arguments list |
Returns : |
a newly allocated string as the format result or NULL on failure |
void (*raptor_log_handler) (void *user_data,raptor_log_message *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().
|
user data |
|
log message |
typedef struct {
int code;
raptor_domain domain;
raptor_log_level level;
raptor_locator *locator;
const char *text;
} raptor_log_message;
Log message.
| error code or < 0 if not used or known | |
raptor_domain |
message domain or RAPTOR_DOMAIN_NONE if not used or known |
raptor_log_level |
log message level |
raptor_locator * |
location associated with message or NULL if not known |
| message string |
typedef enum {
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;
Log levels
| Internal | |
| very fine-grained tracing messages information | |
| fine-grained tracing messages suitable for debugging | |
| coarse-grained information messages | |
| warning messages of potentially harmful problems | |
| error messages where the application can continue | |
| fatal error message where the application will likely abort | |
| Internal |
const char * raptor_log_level_get_label (raptor_log_level level);
Get label for a log message level
|
log message level |
Returns : |
label string or NULL if level is not valid |
typedef enum {
RAPTOR_DOMAIN_NONE,
RAPTOR_DOMAIN_IOSTREAM,
RAPTOR_DOMAIN_NAMESPACE,
RAPTOR_DOMAIN_PARSER,
RAPTOR_DOMAIN_QNAME,
RAPTOR_DOMAIN_SAX2,
RAPTOR_DOMAIN_SERIALIZER,
RAPTOR_DOMAIN_TERM,
RAPTOR_DOMAIN_TURTLE_WRITER,
RAPTOR_DOMAIN_URI,
RAPTOR_DOMAIN_WORLD,
RAPTOR_DOMAIN_WWW,
RAPTOR_DOMAIN_XML_WRITER,
RAPTOR_DOMAIN_LAST = RAPTOR_DOMAIN_XML_WRITER
} raptor_domain;
Log domain
| Internal | |
| I/O stream | |
| XML Namespace / namespace stack | |
| RDF Parser | |
| XML QName | |
| XML SAX2 | |
| RDF Serializer | |
| RDF Term | |
| Turtle Writer | |
| RDF Uri | |
| RDF world | |
| WWW | |
| XML Writer | |
| Internal |
const char * raptor_domain_get_label (raptor_domain domain);
Get label for a domain
|
domain |
Returns : |
label string or NULL if domain is not valid |
int (*raptor_data_compare_handler) (const void *data1,const void *data2);
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().
|
first data object |
|
second data object |
Returns : |
compare value <0 if data1 is before data2, =0 if equal, >0 if data1 is after data2
|
void (*raptor_data_context_free_handler) (void *context,void *object);
Handler function for freeing a sequence item with a contextual pointer.
Set by raptor_new_sequence_with_context().
|
context data for the free function |
|
object to free |
int (*raptor_data_context_print_handler) (void *context,void *object,FILE *fh);
Function function for printing an object with data context to a stream.
Set by raptor_new_sequence_with_context()
|
context data for the print function |
|
object to print |
|
FILE* to print to |
Returns : |
non-0 on failure |
void (*raptor_data_free_handler) (void *data);
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.
|
data object or NULL |
void * (*raptor_data_malloc_handler) (size_t size);
Typedef for a function to allocate memory - signature like malloc()
Designed to be passed into constructors like raptor_www_fetch_to_string
|
data size |
Returns : |
pointer to newly allocated memory or NULL on failure |
int (*raptor_data_print_handler) (void *object,FILE *fh);
Handler function for printing an object to a stream.
Set by raptor_new_sequence()
|
object to print |
|
FILE* to print to |
Returns : |
non-0 on failure |
typedef enum {
RAPTOR_SYNTAX_NEED_BASE_URI = 1
} raptor_syntax_bitflags;
Bit flags for raptor_syntax_description flags field
typedef struct {
const char* names;
unsigned int names_count;
const char* label;
const raptor_type_q* mime_types;
unsigned int mime_types_count;
const char* uri_strings;
unsigned int uri_strings_count;
unsigned int flags;
} raptor_syntax_description;
Description of a syntax or file format.
| array of syntax names - the first one (required) is the public name, the rest are aliases. The array is NULL terminated. | |
size of names array |
|
| long descriptive label for syntax | |
const raptor_type_q * |
Array of (MIME type, Q) values associated with the syntax (or NULL). If present the array is NULL terminated. |
size of mime_types array |
|
| 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. | |
size of uri_strings array |
|
| See raptor_syntax_bitflags for the bits |
int raptor_syntax_description_validate (raptor_syntax_description *desc);
Validate a syntax description has the required fields (name, labels) and update counts
|
description |
Returns : |
non-0 on failure |