ontoviz.namespace

Module Contents

Classes

Namespace

str(object='') -> str

ClosedNamespace

A namespace with a closed list of members

NamespaceManager

Class for managing prefix => namespace mappings

Functions

is_ncname(name)

split_uri(uri[, split_start])

Attributes

RDF

RDFS

OWL

XSD

SKOS

DOAP

FOAF

DC

DCTERMS

VOID

XMLNS

class ontoviz.namespace.Namespace[source]

Bases: str

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

property title[source]

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

term(name)[source]
__getitem__(key, default=None)[source]

Return self[key].

__getattr__(name)[source]
__repr__()[source]

Return repr(self).

class ontoviz.namespace.ClosedNamespace(uri, terms)[source]

Bases: object

A namespace with a closed list of members

Trying to create terms not listen is an error

term(name)[source]
__getitem__(key, default=None)[source]
__getattr__(name)[source]
__str__()[source]

Return str(self).

__repr__()[source]

Return repr(self).

ontoviz.namespace.RDF[source]
ontoviz.namespace.RDFS[source]
ontoviz.namespace.OWL[source]
ontoviz.namespace.XSD[source]
ontoviz.namespace.SKOS[source]
ontoviz.namespace.DOAP[source]
ontoviz.namespace.FOAF[source]
ontoviz.namespace.DC[source]
ontoviz.namespace.DCTERMS[source]
ontoviz.namespace.VOID[source]
class ontoviz.namespace.NamespaceManager(graph)[source]

Bases: object

Class for managing prefix => namespace mappings

Sample usage from FuXi …

ruleStore = N3RuleStore(additionalBuiltins=additionalBuiltins)
nsMgr = NamespaceManager(Graph(ruleStore))
ruleGraph = Graph(ruleStore,namespace_manager=nsMgr)

and …

>>> import rdflib
>>> from rdflib import Graph
>>> from rdflib.namespace import Namespace, NamespaceManager
>>> exNs = Namespace('http://example.com/')
>>> namespace_manager = NamespaceManager(Graph())
>>> namespace_manager.bind('ex', exNs, override=False)
>>> g = Graph()
>>> g.namespace_manager = namespace_manager
>>> all_ns = [n for n in g.namespace_manager.namespaces()]
>>> assert ('ex', rdflib.term.URIRef('http://example.com/')) in all_ns
>>>
store[source]
reset()[source]
__get_store()[source]
qname(uri)[source]
qname_strict(uri)[source]
normalizeUri(rdfTerm)[source]

Takes an RDF Term and ‘normalizes’ it into a QName (using the registered prefix) or (unlike compute_qname) the Notation 3 form for URIs: <…URI…>

compute_qname(uri, generate=True)[source]
compute_qname_strict(uri, generate=True)[source]
bind(prefix, namespace, override=True, replace=False)[source]

bind a given namespace to the prefix

if override, rebind, even if the given namespace is already bound to another prefix.

if replace, replace any existing prefix with the new namespace

namespaces()[source]
absolutize(uri, defrag=1)[source]
ontoviz.namespace.is_ncname(name)[source]
ontoviz.namespace.XMLNS = 'http://www.w3.org/XML/1998/namespace'[source]
ontoviz.namespace.split_uri(uri, split_start=SPLIT_START_CATEGORIES)[source]