ontoviz.namespace¶
Module Contents¶
Classes¶
str(object='') -> str |
|
A namespace with a closed list of members |
|
Class for managing prefix => namespace mappings |
Functions¶
|
|
|
Attributes¶
- class ontoviz.namespace.Namespace[source]¶
Bases:
strstr(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’.
- class ontoviz.namespace.ClosedNamespace(uri, terms)[source]¶
Bases:
objectA namespace with a closed list of members
Trying to create terms not listen is an error
- class ontoviz.namespace.NamespaceManager(graph)[source]¶
Bases:
objectClass 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 >>>
- 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…>