Tracker.NamespaceManager¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Tracker.NamespaceManager(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
TrackerNamespaceManager
object represents a mapping between namespaces and their shortened prefixes.This object keeps track of namespaces, and allows you to assign short prefixes for them to avoid frequent use of full namespace IRIs. The syntax used is that of Compact URIs (CURIEs).
Usually you will want to use a namespace manager obtained through [method`Tracker`.SparqlConnection.get_namespace_manager] from the [class`Tracker`.SparqlConnection] that manages the RDF data, as that will contain all prefixes and namespaces that are pre-defined by its ontology.
- classmethod get_default()¶
- Returns:
a global, shared
TrackerNamespaceManager
instance- Return type:
Returns the global
TrackerNamespaceManager
that contains a set of well-known namespaces and prefixes, such asrdf:
,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.
Deprecated since version 3.3: Use [method`Tracker`.SparqlConnection.get_namespace_manager] instead.
- classmethod new()¶
- Returns:
a new
TrackerNamespaceManager
instance- Return type:
Creates a new, empty
TrackerNamespaceManager
instance.
- add_prefix(prefix, ns)¶
- Parameters:
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, The
TrackerNamespaceManager
instances obtained through [method`Tracker`.SparqlConnection.get_namespace_manager] are “sealed”, this API call should not performed on those.
- compress_uri(uri)¶
- Parameters:
uri (
str
) – a URI or compact URI- Returns:
(nullable): the compressed URI
- Return type:
If uri begins with one of the namespaces known to this
TrackerNamespaceManager
, then the return value will be the compressed URI. Otherwise,None
will be returned.New in version 3.3.
- expand_uri(compact_uri)¶
- Parameters:
compact_uri (
str
) – a URI or compact URI- Returns:
The possibly expanded URI in a newly-allocated string.
- Return type:
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.
- foreach(func, *user_data)¶
- Parameters:
func (
GLib.HFunc
) – the function to call for each prefix / URI pairuser_data (
object
orNone
) – user data to pass to the function
Calls func for each known prefix / URI pair.
- has_prefix(prefix)¶
- Parameters:
prefix (
str
) – a string- Returns:
True
if theTrackerNamespaceManager
knows about prefix,False
otherwise- Return type:
Returns whether prefix is known.