Set the identifier creator handler

Identifiers are created in some parsers by generating them automatically or via hints given a syntax. Raptor can customise this process using a user-supplied identifier handler function. For example, in RDF/XML generated blank node identifiers and those those specified rdf:nodeID are passed through this process. Setting a handler allows the identifier generation mechanism to be fully replaced. A lighter alternative is to use raptor_set_default_generate_id_parameters() to adjust the default algorithm for generated identifiers.

It is used as follows

  raptor_generate_id_handler id_handler;

  raptor_set_generate_id_handler(rdf_parser, user_data, id_handler);

The id_handler takes the following signature:

unsigned char*
generate_id_handler(void* user_data, raptor_genid_type type,
                    unsigned char* user_id) {
   /* return a new generated ID based on user_id (optional) */
}

where the raptor_genid_type provides extra information on the identifier being created and user_id an optional user-supplied identifier, such as the value of a rdf:nodeID in RDF/XML.



Navigation: Redland Home Page

Copyright 2000-2010 Dave Beckett