World
3
REDLAND Library

# World

Initialisation and termination of library

## Synopsis

    typedef             librdf_world;
    librdf_world*       librdf_new_world                    (void);
    void                librdf_free_world                   (librdf_world *world);
    void                librdf_world_open                   (librdf_world *world);
    void                librdf_world_init_mutex             (librdf_world *world);
    void                librdf_world_set_error              (librdf_world *world,
                                                             void *user_data,
                                                             librdf_log_level_func error_handler);
    void                librdf_world_set_warning            (librdf_world *world,
                                                             void *user_data,
                                                             librdf_log_level_func warning_handler);
    void                librdf_world_set_logger             (librdf_world *world,
                                                             void *user_data,
                                                             librdf_log_func log_handler);
    void                librdf_world_set_digest             (librdf_world *world,
                                                             const char *name);
    #define             LIBRDF_WORLD_FEATURE_GENID_BASE
    #define             LIBRDF_WORLD_FEATURE_GENID_COUNTER
    librdf_node*        librdf_world_get_feature            (librdf_world *world,
                                                             librdf_uri *feature);
    int                 librdf_world_set_feature            (librdf_world *world,
                                                             librdf_uri *feature,
                                                             librdf_node *value);
    void                librdf_init_world                   (char *digest_factory_name,
                                                             void *not_used2);
    void                librdf_destroy_world                (void);

## Description

The Redland librdf_world class handles startup and termination of the library and cleanup of all allocated resources.

## Details

### librdf_world

    typedef struct librdf_world_s librdf_world;

Redland world class.

### librdf_new_world ()

    librdf_world*       librdf_new_world                    (void);

Create a new Redland execution environment.

Once this constructor is called to build a librdf_world object several functions may be called to set some parameters such as `librdf_world_set_error()`, `librdf_world_set_warning()`, `librdf_world_set_logger()`, `librdf_world_set_digest()`, `librdf_world_set_feature()`.

The world object needs initializing using `librdf_world_open()` whether or not the above functions are called. It will be automatically called by all object constructors in Redland 1.0.6 or later, but for earlier versions it MUST be called before using any other part of Redland.

Returns :

  a new librdf_world or NULL on failure

### librdf_free_world ()

    void                librdf_free_world                   (librdf_world *world);

Terminate the library and frees all allocated resources.

`world` :

  redland world object

### librdf_world_open ()

    void                librdf_world_open                   (librdf_world *world);

Open a created redland world environment.

`world` :

  redland world object

### librdf_world_init_mutex ()

    void                librdf_world_init_mutex             (librdf_world *world);

INTERNAL - Create the world mutex.

`world` :

  redland world object

### librdf_world_set_error ()

    void                librdf_world_set_error              (librdf_world *world,
                                                             void *user_data,
                                                             librdf_log_level_func error_handler);

Set the world error handling function.

The function will receive callbacks when the world fails. `librdf_world_set_logger()` provides richer access to all log messages and should be used in preference.

`world` :

  redland world object

`user_data` :

  user data to pass to function

`error_handler` :

  pointer to the function

### librdf_world_set_warning ()

    void                librdf_world_set_warning            (librdf_world *world,
                                                             void *user_data,
                                                             librdf_log_level_func warning_handler);

Set the world warning handling function.

The function will receive callbacks when the world gives a warning. `librdf_world_set_logger()` provides richer access to all log messages and should be used in preference.

`world` :

  redland world object

`user_data` :

  user data to pass to function

`warning_handler` :

  pointer to the function

### librdf_world_set_logger ()

    void                librdf_world_set_logger             (librdf_world *world,
                                                             void *user_data,
                                                             librdf_log_func log_handler);

Set the world log handling function.

The function will receive callbacks when redland generates a log message

`world` :

  redland world object

`user_data` :

  user data to pass to function

`log_handler` :

  pointer to the function

### librdf_world_set_digest ()

    void                librdf_world_set_digest             (librdf_world *world,
                                                             const char *name);

Set the default content digest name.

Sets the digest factory for various modules that need to make digests of their objects.

`world` :

  redland world object

`name` :

  Digest factory name

### LIBRDF_WORLD_FEATURE_GENID_BASE

    #define LIBRDF_WORLD_FEATURE_GENID_BASE "http://feature.librdf.org/genid-base"

World feature to set the generated ID base.

Must be set before the world is opened with `librdf_world_open()`.

### LIBRDF_WORLD_FEATURE_GENID_COUNTER

    #define LIBRDF_WORLD_FEATURE_GENID_COUNTER "http://feature.librdf.org/genid-counter"

World feature to set the generated ID counter.

Must be set before the world is opened with `librdf_world_open()`.

### librdf_world_get_feature ()

    librdf_node*        librdf_world_get_feature            (librdf_world *world,
                                                             librdf_uri *feature);

Get the value of a world feature.

`world` :

  librdf_world object

`feature` :

  librdf_uri feature property

Returns :

  new librdf_node feature value or NULL if no such feature exists or the value is empty.

### librdf_world_set_feature ()

    int                 librdf_world_set_feature            (librdf_world *world,
                                                             librdf_uri *feature,
                                                             librdf_node *value);

Set the value of a world feature.

`world` :

  librdf_world object

`feature` :

  librdf_uri feature property

`value` :

  librdf_node feature property value

Returns :

  non 0 on failure (negative if no such feature)

### librdf_init_world ()

    void                librdf_init_world                   (char *digest_factory_name,
                                                             void *not_used2);

Initialise the library `deprecated`: Do not use.

Use `librdf_new_world()` and `librdf_world_open()` on librdf_world object

See `librdf_world_set_digest_factory_name()` for documentation on arguments.

`digest_factory_name` :

  Name of digest factory to use

`not_used2` :

  Not used

### librdf_destroy_world ()

    void                librdf_destroy_world                (void);

Terminate the library `deprecated`: Do not use.

Use `librdf_free_world()` on librdf_world object

Terminates and frees the resources.