| Raptor RDF Syntax Parsing and Serializing Library Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
typedef raptor_world; raptor_world* raptor_new_world (void); int raptor_world_open (raptor_world *world); void raptor_free_world (raptor_world *world); enum raptor_world_flag; int raptor_world_set_flag (raptor_world *world, raptor_world_flag flag, int value); int raptor_world_set_libxslt_security_preferences (raptor_world *world, void *security_preferences); int raptor_world_set_log_handler (raptor_world *world, void *user_data, raptor_log_handler handler); int raptor_world_enumerate_parsers (raptor_world *world, unsigned int counter, const char **name, const char **label, const char **mime_type, unsigned char **uri_string); int raptor_world_is_parser_name (raptor_world *world, const char *name); const char* raptor_world_guess_parser_name (raptor_world *world, raptor_uri *uri, const char *mime_type, unsigned char *buffer, size_t len, unsigned char *identifier); int raptor_world_enumerate_serializers (raptor_world *world, unsigned int counter, const char **name, const char **label, const char **mime_type, unsigned char **uri_string); int raptor_world_is_serializer_name (raptor_world *world, const char *name);
How to initialise and terminate the library, set library-wide configuration flags and options.
raptor_world* raptor_new_world (void);
Allocate a new raptor_world object.
The raptor_world is initialized with raptor_world_open().
Allocation and initialization are decoupled to allow
changing settings on the world object before init.
Returns : |
uninitialized raptor_world object or NULL on failure |
int raptor_world_open (raptor_world *world);
Initialise the raptor library.
Initializes a raptor_world object created by raptor_new_world().
Allocation and initialization are decoupled to allow
changing settings on the world object before init.
The initialized world object is used with subsequent raptor API calls.
|
raptor_world object |
Returns : |
non-0 on failure |
void raptor_free_world (raptor_world *world);
Terminate the raptor library.
Destroys the raptor_world object and all related information.
|
raptor_world object |
typedef enum {
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 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.
| if set (non-0 value) - save/restore the libxml generic error handler when raptor library initializes (default set) | |
| if set (non-0 value) - save/restore the libxml structured error handler when raptor library terminates (default set) | |
| if set (non-0 value) - each URI is saved interned in-memory and reused (default set) | |
| 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. |
int raptor_world_set_flag (raptor_world *world, raptor_world_flag flag, int value);
Set library-wide configuration
This function is used to control raptor-wide options across
classes. These options 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.
See the raptor_world_flags documentation for full details of what the flags mean.
|
world |
|
flag |
|
value |
Returns : |
0 on success, non-0 on failure: <0 on errors (-1 if flag is unknown, -2 if value is illegal) and >0 if world is already opened |
int raptor_world_set_libxslt_security_preferences (raptor_world *world, void *security_preferences);
Set libxslt security preferences policy object
The security_preferences object will NOT become owned by
raptor_world
If libxslt is compiled into the library, security_preferences
should be an xsltSecurityPrefsPtr and will be used to call
xsltSetCtxtSecurityPrefs() when an XSLT engine is initialised.
If libxslt is not compiled in, the object set here is not used.
|
world |
|
security preferences (an xsltSecurityPrefsPtr) |
Returns : |
0 on success, non-0 on failure: <0 on errors and >0 if world is already opened |
int raptor_world_set_log_handler (raptor_world *world, void *user_data, raptor_log_handler handler);
Set the message (error, warning, info) handling function.
The function will receive callbacks when messages are generated
|
world object |
|
user data to pass to function |
|
pointer to the function |
Returns : |
non-0 on failure |
int raptor_world_enumerate_parsers (raptor_world *world, unsigned int counter, const char **name, const char **label, const char **mime_type, unsigned char **uri_string);
Get information on syntaxes.
|
raptor_world object |
|
index into the list of syntaxes |
|
pointer to store the name of the syntax (or NULL) |
|
pointer to store syntax readable label (or NULL) |
|
pointer to store syntax MIME Type (or NULL) |
|
pointer to store syntax URI string (or NULL) |
Returns : |
non 0 on failure of if counter is out of range |
int raptor_world_is_parser_name (raptor_world *world, const char *name);
Check name of a parser.
|
raptor_world object |
|
the syntax name |
Returns : |
non 0 if name is a known syntax name |
const char* raptor_world_guess_parser_name (raptor_world *world, raptor_uri *uri, const char *mime_type, unsigned char *buffer, size_t len, unsigned char *identifier);
Guess a parser name for content.
Find a parser by scoring recognition of the syntax by a block of characters, the content identifier or a mime type. The content identifier is typically a filename or URI or some other identifier.
|
raptor_world object |
|
URI identifying the syntax (or NULL) |
|
mime type identifying the content (or NULL) |
|
buffer of content to guess (or NULL) |
|
length of buffer |
|
identifier of content (or NULL) |
Returns : |
a parser name or NULL if no guess could be made |
int raptor_world_enumerate_serializers (raptor_world *world, unsigned int counter, const char **name, const char **label, const char **mime_type, unsigned char **uri_string);
Get information on syntax serializers.
|
raptor_world object |
|
index into the list of syntaxes |
|
pointer to store the name of the syntax (or NULL) |
|
pointer to store syntax readable label (or NULL) |
|
pointer to store syntax MIME Type (or NULL) |
|
pointer to store syntax URI string (or NULL) |
Returns : |
non 0 on failure of if counter is out of range |
int raptor_world_is_serializer_name (raptor_world *world, const char *name);
Check name of a serializer.
|
raptor_world object |
|
the syntax name |
Returns : |
non 0 if name is a known syntax name |
Navigation: Redland Home Page