Skip to content

questions about DefinedNamespaces (OWL, RDFS, etc etc) #1593

@jclerman

Description

@jclerman

I have some questions about the new DefinedNamespace:

  1. Can we restore a non-private API to get the URI of the namespace itself? Something like the uri() method on the now-deprecated ClosedNamespace:
rdflib.OWL.uri()   # "http://www.w3.org/2002/07/owl#"
  1. I couldn't find a documented way to get the complete set of URIs within a DefinedNamespace. It appears necessary to do something like this:
from rdflib import OWL, URIRef
owl_uris: Set[URIRef] = {OWL[str(x)] for x in OWL.__annotations__}  # this can be generalized to a function

It would be nice to have the above functionality implemented as, say, a method (on DefinedNamespaceMeta?). On ClosedNamespace, it looks like it was possible to get this result via dir(OWL), since __dir__ was defined on that class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions