## TrackerNamespaceManager TrackerNamespaceManager — A set of well-known namespaces, and known abbreviations for them |

## Stability Level

Stable, unless otherwise indicated

## Functions

void | tracker_namespace_manager_add_prefix ()
char * | tracker_namespace_manager_expand_uri ()
TrackerNamespaceManager * | tracker_namespace_manager_get_default ()
gboolean | tracker_namespace_manager_has_prefix ()
const char * | tracker_namespace_manager_lookup_prefix ()
TrackerNamespaceManager * | tracker_namespace_manager_new ()
char * | tracker_namespace_manager_print_turtle ()

## Includes

    #include <tracker-namespace-manager.h>

## Description

TrackerNamespaceManager keeps track of namespaces. It allows you to assign short prefixes for them to avoid typing full URLs all the time. The syntax used is that of Compact URIs (CURIEs) as defined here: (https://www.w3.org/TR/2010/NOTE-curie-20101216) Usually you will want to use the default namespace manager, as returned by `tracker_namespace_manager_get_default()`. This has a set of well-known prefixes predefined.

## Functions

### tracker_namespace_manager_add_prefix ()

    void
    tracker_namespace_manager_add_prefix (TrackerNamespaceManager *self,
                                          const char *prefix,
                                          const char *ns);

Adds `prefix` as the recognised abbreviaton of `namespace` .

Only one prefix is allowed for a given namespace, and all prefixes must be unique.

#### Parameters

self | a TrackerNamespaceManager |
prefix | a short, unique prefix to identify `namespace` |
namespace | the URL of the given namespace |

Since: 1.10

### tracker_namespace_manager_expand_uri ()

    char *
    tracker_namespace_manager_expand_uri (TrackerNamespaceManager *self,
                                          const char *compact_uri);

If `compact_uri` begins with one of the prefixes known to this TrackerNamespaceManager, then the return value will be the expanded URI. Otherwise, a copy of `compact_uri` will be returned.

#### Parameters

self | a TrackerNamespaceManager |
compact_uri | a URI or compact URI |

#### Returns

a newly-allocated string

Since: 1.10

### tracker_namespace_manager_get_default ()

    TrackerNamespaceManager *
    tracker_namespace_manager_get_default (void);

Returns the global TrackerNamespaceManager that contains a set of well-known namespaces and prefixes, such as rdf:, rdfs:, nie:, tracker:, etc.

Note that the list of prefixes and namespaces is hardcoded in libtracker-sparql. It may not correspond with the installed set of ontologies, if they have been modified since they were installed.

#### Returns

a global, shared TrackerNamespaceManager instance

Since: 1.10

### tracker_namespace_manager_has_prefix ()

    gboolean
    tracker_namespace_manager_has_prefix (TrackerNamespaceManager *self,
                                          const char *prefix);

#### Parameters

self | a TrackerNamespaceManager |
prefix | a string |

#### Returns

`TRUE` if the TrackerNamespaceManager knows about `prefix` , `FALSE` otherwise

Since: 1.10

### tracker_namespace_manager_lookup_prefix ()

    const char *
    tracker_namespace_manager_lookup_prefix
                                   (TrackerNamespaceManager *self,
                                    const char *prefix);

Looks up the namespace URI corresponding to `prefix` , or `NULL` if the prefix is not known.

#### Parameters

self | a TrackerNamespaceManager |
prefix | a string |

#### Returns

a string owned by the TrackerNamespaceManager, or `NULL`

Since: 1.10

### tracker_namespace_manager_new ()

    TrackerNamespaceManager *
    tracker_namespace_manager_new (void);

Creates a new TrackerNamespaceManager instance.

#### Returns

a new TrackerNamespaceManager instance

Since: 1.10

### tracker_namespace_manager_print_turtle ()

    char *
    tracker_namespace_manager_print_turtle
                                   (TrackerNamespaceManager *self);

Writes out all namespaces as Turtle `prefix` statements.

#### Parameters

self | a TrackerNamespaceManager |

#### Returns

a newly-allocated string

Since: 1.10

## Types and Values