uri

uri

Functions

Types and Values

typedef librdf_uri

Description

Functions

librdf_new_uri ()

librdf_uri *
librdf_new_uri (librdf_world *world,
                const unsigned char *uri_string);

Constructor - create a new librdf_uri object from a URI string.

A new URI is constructed from a copy of the string. If the string is a NULL pointer or empty (0 length) then the result is NULL.

Parameters

world

redland world object

 

uri_string

URI in string form

 

Returns

a new librdf_uri object or NULL on failure


librdf_new_uri2 ()

librdf_uri *
librdf_new_uri2 (librdf_world *world,
                 const unsigned char *uri_string,
                 size_t length);

Constructor - create a new librdf_uri object from a counted URI string.

A new URI is constructed from a copy of the string. If the string is a NULL pointer or 0 length or empty (first byte is 0) then the result is NULL.

Parameters

world

redland world object

 

uri_string

URI in string form

 

length

length of string

 

Returns

a new librdf_uri object or NULL on failure


librdf_new_uri_from_uri ()

librdf_uri *
librdf_new_uri_from_uri (librdf_uri *old_uri);

Copy constructor - create a new librdf_uri object from an existing librdf_uri object.

Parameters

old_uri

librdf_uri object

 

Returns

a new librdf_uri object or NULL on failure


librdf_new_uri_from_uri_local_name ()

librdf_uri *
librdf_new_uri_from_uri_local_name (librdf_uri *old_uri,
                                    const unsigned char *local_name);

Copy constructor - create a new librdf_uri object from an existing librdf_uri object and a local name.

Parameters

old_uri

librdf_uri object

 

local_name

local name to append to URI

 

Returns

a new librdf_uri object or NULL on failure


librdf_free_uri ()

void
librdf_free_uri (librdf_uri *uri);

Destructor - destroy a librdf_uri object.

Parameters

uri

librdf_uri object

 

librdf_uri_as_string ()

unsigned char *
librdf_uri_as_string (librdf_uri *uri);

Get a pointer to the string representation of the URI.

Returns a shared pointer to the URI string representation. Note: does not allocate a new string so the caller must not free it.

Parameters

uri

librdf_uri object

 

Returns

string representation of URI


librdf_uri_as_counted_string ()

unsigned char *
librdf_uri_as_counted_string (librdf_uri *uri,
                              size_t *len_p);

Get a pointer to the string representation of the URI with length.

Returns a shared pointer to the URI string representation. Note: does not allocate a new string so the caller must not free it.

Parameters

uri

librdf_uri object

 

len_p

pointer to location to store length

 

Returns

string representation of URI


librdf_uri_print ()

void
librdf_uri_print (librdf_uri *uri,
                  FILE *fh);

Print the URI to the given file handle.

Parameters

uri

librdf_uri object

 

fh

file handle

 

librdf_uri_to_string ()

unsigned char *
librdf_uri_to_string (librdf_uri *uri);

Format the URI as a string.

Note: this method allocates a new string since this is a _to_ method and the caller must free the resulting memory.

Parameters

uri

librdf_uri object

 

Returns

string representation of the URI or NULL on failure


librdf_uri_to_counted_string ()

unsigned char *
librdf_uri_to_counted_string (librdf_uri *uri,
                              size_t *len_p);

Format the URI as a counted string.

Note: this method allocates a new string since this is a _to_ method and the caller must free the resulting memory.

Parameters

uri

librdf_uri object

 

len_p

pointer to location to store length

 

Returns

string representation of the URI or NULL on failure


librdf_uri_equals ()

int
librdf_uri_equals (librdf_uri *first_uri,
                   librdf_uri *second_uri);

Compare two librdf_uri objects for equality.

Parameters

first_uri

librdf_uri object 1

 

second_uri

librdf_uri object 2

 

Returns

non 0 if the objects are equal


librdf_uri_is_file_uri ()

int
librdf_uri_is_file_uri (librdf_uri *uri);

Test if a URI points to a filename.

Parameters

uri

librdf_uri object

 

Returns

Non zero if the URI points to a file


librdf_uri_to_filename ()

const char *
librdf_uri_to_filename (librdf_uri *uri);

Return pointer to filename of URI.

Returns a pointer to a newly allocated buffer that the caller must free. This will fail if the URI is not a file: URI. This can be checked with librdf_uri_is_file_uri

Parameters

uri

librdf_uri object

 

Returns

pointer to filename or NULL on failure


librdf_new_uri_normalised_to_base ()

librdf_uri *
librdf_new_uri_normalised_to_base (const unsigned char *uri_string,
                                   librdf_uri *source_uri,
                                   librdf_uri *base_uri);

Constructor - create a new librdf_uri object from a URI string stripped of the source URI, made relative to the base URI.

Parameters

uri_string

URI in string form

 

source_uri

source URI to remove

 

base_uri

base URI to add

 

Returns

a new librdf_uri object or NULL on failure


librdf_new_uri_relative_to_base ()

librdf_uri *
librdf_new_uri_relative_to_base (librdf_uri *base_uri,
                                 const unsigned char *uri_string);

Constructor - create a new librdf_uri object from a URI string relative to a base URI.

An empty uri_string or NULL is equivalent to librdf_new_uri_from_uri(base_uri)

Parameters

base_uri

absolute base URI

 

uri_string

relative URI string

 

Returns

a new librdf_uri object or NULL on failure


librdf_new_uri_from_filename ()

librdf_uri *
librdf_new_uri_from_filename (librdf_world *world,
                              const char *filename);

Constructor - create a new librdf_uri object from a filename.

Parameters

world

Redland librdf_world object

 

filename

filename

 

Returns

a new librdf_uri object or NULL on failure


librdf_uri_compare ()

int
librdf_uri_compare (librdf_uri *uri1,
                    librdf_uri *uri2);

Compare two librdf_uri objects lexicographically.

A NULL URI is always less than (never equal to) a non-NULL URI.

Parameters

uri1

librdf_uri object 1 or NULL

 

uri2

librdf_uri object 2 or NULL

 

Returns

<0 if uri1 is less than uri2 , 0 if equal, >0 if uri1 is greater than uri2


librdf_uri_filter_func ()

int
(*librdf_uri_filter_func) (void *user_data,
                           librdf_uri *uri);

Callback function for librdf_parser_set_uri_filter()

Parameters

user_data

user data

 

uri

librdf_uri URI to check

 

Returns

non-0 to filter the URI

Types and Values

librdf_uri

typedef struct raptor_uri_s librdf_uri;

Redland URI class.