# TrackerNamespaceManager

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.

## TrackerNamespaceManager

    GObject
        ╰──TrackerNamespaceManager

The <structname>TrackerNamespaceManager</structname> object represents a mapping of prefixes and namespaces.

### Class structure

#### TrackerNamespaceManagerClass

##### Fields

`parent_class` (GObjectClass) –
No description available

### Tracker.NamespaceManagerClass

##### Attributes

`parent_class` (GObject.ObjectClass) –
No description available

### Tracker.NamespaceManagerClass

##### Attributes

`parent_class` (GObject.ObjectClass) –
No description available

## Tracker.NamespaceManager

    GObject.Object
        ╰──Tracker.NamespaceManager

The <structname>TrackerNamespaceManager</structname> object represents a mapping of prefixes and namespaces.

## Tracker.NamespaceManager

    GObject.Object
        ╰──Tracker.NamespaceManager

The <structname>TrackerNamespaceManager</structname> object represents a mapping of prefixes and namespaces.

### Constructors

#### tracker_namespace_manager_new

    TrackerNamespaceManager *
    tracker_namespace_manager_new ()

Creates a new TrackerNamespaceManager instance.

Returns –

a new TrackerNamespaceManager instance

#### Tracker.NamespaceManager.prototype.new

    function Tracker.NamespaceManager.prototype.new(): {
        // javascript wrapper for 'tracker_namespace_manager_new'
    }

Creates a new Tracker.NamespaceManager instance.

Returns (Tracker.NamespaceManager) –

a new Tracker.NamespaceManager instance

#### Tracker.NamespaceManager.new

    def Tracker.NamespaceManager.new ():
        #python wrapper for 'tracker_namespace_manager_new'

Creates a new Tracker.NamespaceManager instance.

Returns (Tracker.NamespaceManager) –

a new Tracker.NamespaceManager instance

### Methods

#### tracker_namespace_manager_add_prefix

    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.

Since 3.3, This function may not be used on TrackerNamespaceManager instances that were obtained through tracker_sparql_connection_get_namespace_manager.

Parameters:

`self` –

a TrackerNamespaceManager

`prefix` –

a short, unique prefix to identify namespace

`ns` –

the URL of the given namespace

#### Tracker.NamespaceManager.prototype.add_prefix

    function Tracker.NamespaceManager.prototype.add_prefix(prefix: String, ns: String): {
        // javascript wrapper for 'tracker_namespace_manager_add_prefix'
    }

Adds prefix as the recognised abbreviaton of namespace.

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

Since 3.3, This function may not be used on Tracker.NamespaceManager instances that were obtained through Tracker.SparqlConnection.prototype.get_namespace_manager.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`prefix` (String) –

a short, unique prefix to identify namespace

`ns` (String) –

the URL of the given namespace

#### Tracker.NamespaceManager.add_prefix

    def Tracker.NamespaceManager.add_prefix (self, prefix, ns):
        #python wrapper for 'tracker_namespace_manager_add_prefix'

Adds prefix as the recognised abbreviaton of namespace.

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

Since 3.3, This function may not be used on Tracker.NamespaceManager instances that were obtained through Tracker.SparqlConnection.get_namespace_manager.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`prefix` (str) –

a short, unique prefix to identify namespace

`ns` (str) –

the URL of the given namespace

#### tracker_namespace_manager_compress_uri

    char*
    tracker_namespace_manager_compress_uri (TrackerNamespaceManager * self,
                                            const char* uri)

If uri begins with one of the namespaces known to this TrackerNamespaceManager, then the return value will be the compressed URI. Otherwise, NULL will be returned.

Parameters:

`self` –

a TrackerNamespaceManager

`uri` –

a URI or compact URI

Returns ( [transfer: full]) –

(nullable): the compressed URI

Since : 3.3

#### Tracker.NamespaceManager.prototype.compress_uri

    function Tracker.NamespaceManager.prototype.compress_uri(uri: String): {
        // javascript wrapper for 'tracker_namespace_manager_compress_uri'
    }

If uri begins with one of the namespaces known to this Tracker.NamespaceManager, then the return value will be the compressed URI. Otherwise, NULL will be returned.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`uri` (String) –

a URI or compact URI

Returns (String) –

(nullable): the compressed URI

Since : 3.3

#### Tracker.NamespaceManager.compress_uri

    def Tracker.NamespaceManager.compress_uri (self, uri):
        #python wrapper for 'tracker_namespace_manager_compress_uri'

If uri begins with one of the namespaces known to this Tracker.NamespaceManager, then the return value will be the compressed URI. Otherwise, NULL will be returned.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`uri` (str) –

a URI or compact URI

Returns (str) –

(nullable): the compressed URI

Since : 3.3

#### 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

#### Tracker.NamespaceManager.prototype.expand_uri

    function Tracker.NamespaceManager.prototype.expand_uri(compact_uri: String): {
        // javascript wrapper for 'tracker_namespace_manager_expand_uri'
    }

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

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`compact_uri` (String) –

a URI or compact URI

Returns (String) –

a newly-allocated string

#### Tracker.NamespaceManager.expand_uri

    def Tracker.NamespaceManager.expand_uri (self, compact_uri):
        #python wrapper for 'tracker_namespace_manager_expand_uri'

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

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`compact_uri` (str) –

a URI or compact URI

Returns (str) –

a newly-allocated string

#### tracker_namespace_manager_foreach

    tracker_namespace_manager_foreach (TrackerNamespaceManager * self,
                                       GHFunc func,
                                       gpointer user_data)

Calls func for each known prefix / URI pair.

Parameters:

`self` –

a TrackerNamespaceManager

`func` ( [scope call]) –

the function to call for each prefix / URI pair

`user_data` –

user data to pass to the function

#### Tracker.NamespaceManager.prototype.foreach

    function Tracker.NamespaceManager.prototype.foreach(func: GLib.HFunc, user_data: Object): {
        // javascript wrapper for 'tracker_namespace_manager_foreach'
    }

Calls func for each known prefix / URI pair.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`func` (GLib.HFunc) –

the function to call for each prefix / URI pair

`user_data` (Object) –

user data to pass to the function

#### Tracker.NamespaceManager.foreach

    def Tracker.NamespaceManager.foreach (self, func, *user_data):
        #python wrapper for 'tracker_namespace_manager_foreach'

Calls func for each known prefix / URI pair.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`func` (GLib.HFunc) –

the function to call for each prefix / URI pair

`user_data` (variadic) –

user data to pass to the function

#### tracker_namespace_manager_has_prefix

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

Returns whether prefix is known.

Parameters:

`self` –

a TrackerNamespaceManager

`prefix` –

a string

Returns –

TRUE if the TrackerNamespaceManager knows about prefix, FALSE otherwise

#### Tracker.NamespaceManager.prototype.has_prefix

    function Tracker.NamespaceManager.prototype.has_prefix(prefix: String): {
        // javascript wrapper for 'tracker_namespace_manager_has_prefix'
    }

Returns whether prefix is known.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`prefix` (String) –

a string

Returns (Number) –

TRUE if the Tracker.NamespaceManager knows about prefix, FALSE otherwise

#### Tracker.NamespaceManager.has_prefix

    def Tracker.NamespaceManager.has_prefix (self, prefix):
        #python wrapper for 'tracker_namespace_manager_has_prefix'

Returns whether prefix is known.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`prefix` (str) –

a string

Returns (bool) –

TRUE if the Tracker.NamespaceManager knows about prefix, FALSE otherwise

#### 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 ( [nullable]) –

a string owned by the TrackerNamespaceManager, or NULL

#### Tracker.NamespaceManager.prototype.lookup_prefix

    function Tracker.NamespaceManager.prototype.lookup_prefix(prefix: String): {
        // javascript wrapper for 'tracker_namespace_manager_lookup_prefix'
    }

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

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`prefix` (String) –

a string

Returns (String) –

a string owned by the Tracker.NamespaceManager, or NULL

#### Tracker.NamespaceManager.lookup_prefix

    def Tracker.NamespaceManager.lookup_prefix (self, prefix):
        #python wrapper for 'tracker_namespace_manager_lookup_prefix'

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

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

`prefix` (str) –

a string

Returns (str) –

a string owned by the Tracker.NamespaceManager, or NULL

#### 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

#### Tracker.NamespaceManager.prototype.print_turtle

    function Tracker.NamespaceManager.prototype.print_turtle(): {
        // javascript wrapper for 'tracker_namespace_manager_print_turtle'
    }

Writes out all namespaces as Turtle prefix statements.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

Returns (String) –

a newly-allocated string

#### Tracker.NamespaceManager.print_turtle

    def Tracker.NamespaceManager.print_turtle (self):
        #python wrapper for 'tracker_namespace_manager_print_turtle'

Writes out all namespaces as Turtle prefix statements.

Parameters:

`self` (Tracker.NamespaceManager) –

a Tracker.NamespaceManager

Returns (str) –

a newly-allocated string

### Functions

#### tracker_namespace_manager_get_default

    TrackerNamespaceManager *
    tracker_namespace_manager_get_default ()

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 ( [transfer: none]) –

a global, shared TrackerNamespaceManager instance

deprecated : 3.3: Use tracker_sparql_connection_get_namespace_manager() instead.

#### Tracker.NamespaceManager.prototype.get_default

    function Tracker.NamespaceManager.prototype.get_default(): {
        // javascript wrapper for 'tracker_namespace_manager_get_default'
    }

Returns the global Tracker.NamespaceManager 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 (Tracker.NamespaceManager) –

a global, shared Tracker.NamespaceManager instance

deprecated : 3.3: Use tracker_sparql_connection_get_namespace_manager() instead.

#### Tracker.NamespaceManager.get_default

    def Tracker.NamespaceManager.get_default ():
        #python wrapper for 'tracker_namespace_manager_get_default'

Returns the global Tracker.NamespaceManager 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 (Tracker.NamespaceManager) –

a global, shared Tracker.NamespaceManager instance

deprecated : 3.3: Use tracker_sparql_connection_get_namespace_manager() instead.

The results of the search are