:py:mod:`ontoviz.namespace` =========================== .. py:module:: ontoviz.namespace Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: ontoviz.namespace.Namespace ontoviz.namespace.ClosedNamespace ontoviz.namespace.NamespaceManager Functions ~~~~~~~~~ .. autoapisummary:: ontoviz.namespace.is_ncname ontoviz.namespace.split_uri Attributes ~~~~~~~~~~ .. autoapisummary:: ontoviz.namespace.RDF ontoviz.namespace.RDFS ontoviz.namespace.OWL ontoviz.namespace.XSD ontoviz.namespace.SKOS ontoviz.namespace.DOAP ontoviz.namespace.FOAF ontoviz.namespace.DC ontoviz.namespace.DCTERMS ontoviz.namespace.VOID ontoviz.namespace.XMLNS .. py:class:: Namespace Bases: :py:obj:`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'. .. py:property:: title 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. .. py:method:: term(name) .. py:method:: __getitem__(key, default=None) Return self[key]. .. py:method:: __getattr__(name) .. py:method:: __repr__() Return repr(self). .. py:class:: ClosedNamespace(uri, terms) Bases: :py:obj:`object` A namespace with a closed list of members Trying to create terms not listen is an error .. py:method:: term(name) .. py:method:: __getitem__(key, default=None) .. py:method:: __getattr__(name) .. py:method:: __str__() Return str(self). .. py:method:: __repr__() Return repr(self). .. py:data:: RDF .. py:data:: RDFS .. py:data:: OWL .. py:data:: XSD .. py:data:: SKOS .. py:data:: DOAP .. py:data:: FOAF .. py:data:: DC .. py:data:: DCTERMS .. py:data:: VOID .. py:class:: NamespaceManager(graph) Bases: :py:obj:`object` Class for managing prefix => namespace mappings Sample usage from FuXi ... .. code-block:: python ruleStore = N3RuleStore(additionalBuiltins=additionalBuiltins) nsMgr = NamespaceManager(Graph(ruleStore)) ruleGraph = Graph(ruleStore,namespace_manager=nsMgr) and ... .. code-block:: pycon >>> 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 >>> .. py:attribute:: store .. py:method:: reset() .. py:method:: __get_store() .. py:method:: qname(uri) .. py:method:: qname_strict(uri) .. py:method:: normalizeUri(rdfTerm) 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...> .. py:method:: compute_qname(uri, generate=True) .. py:method:: compute_qname_strict(uri, generate=True) .. py:method:: bind(prefix, namespace, override=True, replace=False) 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 .. py:method:: namespaces() .. py:method:: absolutize(uri, defrag=1) .. py:function:: is_ncname(name) .. py:data:: XMLNS :value: 'http://www.w3.org/XML/1998/namespace' .. py:function:: split_uri(uri, split_start=SPLIT_START_CATEGORIES)