URI Factory
3
RAPTOR Library

# URI Factory

Provide an implementation for the URI class.

## Synopsis

    raptor_uri*         (*raptor_new_uri_func)              (void *context,
                                                             unsigned char *uri_string);
    raptor_uri*         (*raptor_new_uri_from_uri_local_name_func)
                                                            (void *context,
                                                             raptor_uri *uri,
                                                             unsigned char *local_name);
    raptor_uri*         (*raptor_new_uri_relative_to_base_func)
                                                            (void *context,
                                                             raptor_uri *base_uri,
                                                             unsigned char *uri_string);
    raptor_uri*         (*raptor_new_uri_for_rdf_concept_func)
                                                            (void *context,
                                                             const char *name);
    void                (*raptor_free_uri_func)             (void *context,
                                                             raptor_uri *uri);
    int                 (*raptor_uri_equals_func)           (void *context,
                                                             raptor_uri *uri1,
                                                             raptor_uri *uri2);
    raptor_uri*         (*raptor_uri_copy_func)             (void *context,
                                                             raptor_uri *uri);
    int                 (*raptor_uri_compare_func)          (void *context,
                                                             raptor_uri *uri1,
                                                             raptor_uri *uri2);

## Description

A factory that allows registering an implementation for the URI class to override the simple internal one (raptor_uri are char*). Normally used by redland to replace raptor_uri with librdf_uri

## Details

### raptor_new_uri_func ()

    raptor_uri*         (*raptor_new_uri_func)              (void *context,
                                                             unsigned char *uri_string);

Handler function for implementing `raptor_new_uri()`.

`context` :

  URI context data

`uri_string` :

  URI string

Returns :

  new URI object or NULL on failure

### raptor_new_uri_from_uri_local_name_func ()

    raptor_uri*         (*raptor_new_uri_from_uri_local_name_func)
                                                            (void *context,
                                                             raptor_uri *uri,
                                                             unsigned char *local_name);

Handler function for implementing `raptor_new_uri_from_uri_local_name()`.

`context` :

  URI context data

`uri` :

  URI object

`local_name` :

  local name string

Returns :

  new URI object or NULL on failure

### raptor_new_uri_relative_to_base_func ()

    raptor_uri*         (*raptor_new_uri_relative_to_base_func)
                                                            (void *context,
                                                             raptor_uri *base_uri,
                                                             unsigned char *uri_string);

Handler function for implementing `raptor_new_uri_relative_to_base()`.

`context` :

  URI context data

`base_uri` :

  base URI object

`uri_string` :

  relative URI string

Returns :

  new URI object or NULL on failure

### raptor_new_uri_for_rdf_concept_func ()

    raptor_uri*         (*raptor_new_uri_for_rdf_concept_func)
                                                            (void *context,
                                                             const char *name);

Handler function for implementing `raptor_new_uri_for_rdf_concept()`.

`context` :

  URI context data

`name` :

  RDF term

Returns :

  new URI object or NULL on failure

### raptor_free_uri_func ()

    void                (*raptor_free_uri_func)             (void *context,
                                                             raptor_uri *uri);

Handler function for implementing `raptor_free_uri()`.

`context` :

  URI context data

`uri` :

  URI object

### raptor_uri_equals_func ()

    int                 (*raptor_uri_equals_func)           (void *context,
                                                             raptor_uri *uri1,
                                                             raptor_uri *uri2);

Handler function for implementing `raptor_uri_equals()`.

`context` :

  URI context data

`uri1` :

  URI object 1

`uri2` :

  URI object 2

Returns :

  non-0 if the URIs are equal

### raptor_uri_copy_func ()

    raptor_uri*         (*raptor_uri_copy_func)             (void *context,
                                                             raptor_uri *uri);

Handler function for implementing `raptor_uri_copy()`.

`context` :

  URI context data

`uri` :

  URI object

Returns :

  new URI object or NULL on failure

### raptor_uri_compare_func ()

    int                 (*raptor_uri_compare_func)          (void *context,
                                                             raptor_uri *uri1,
                                                             raptor_uri *uri2);

Handler function for implementing `raptor_uri_equals()`.

`context` :

  URI context data

`uri1` :

  URI object 1

`uri2` :

  URI object 2

Returns :

  -1 if uri1 < uri2, 0 if equal, 1 if uri1 > uri2