This is a documentation preview for the next version of Tracker, generated from tracker.git commit 22a1624.

See the Tracker website for more documentation.

TrackerNamespaceManager

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

Stability Level

Stable, unless otherwise indicated

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── TrackerNamespaceManager

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

 

ns

the URL of the given namespace

 

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_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.

[transfer none]


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_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.

[nullable]


tracker_namespace_manager_new ()

TrackerNamespaceManager *
tracker_namespace_manager_new (void);

Creates a new TrackerNamespaceManager instance.

Returns

a new TrackerNamespaceManager instance


tracker_namespace_manager_print_turtle ()

char *
tracker_namespace_manager_print_turtle
                               (TrackerNamespaceManager *self);

Writes out all namespaces as Turtle prefix statements.

Parameters

Returns

a newly-allocated string


tracker_namespace_manager_foreach ()

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

Calls func for each known prefix / URI pair.

Parameters

self

a TrackerNamespaceManager

 

func

the function to call for each prefix / URI pair.

[scope call]

user_data

user data to pass to the function

 

Types and Values

TrackerNamespaceManager

typedef struct _TrackerNamespaceManager TrackerNamespaceManager;

The TrackerNamespaceManager object represents a mapping of prefixes and namespaces.